GFile: add new g_file_measure_disk_usage() API

This is essentially the equivalent of 'du'.

This is currently only supported on local files.  gvfs will add support for the
interface later.

https://bugzilla.gnome.org/show_bug.cgi?id=704893
This commit is contained in:
Ryan Lortie
2013-07-28 13:41:17 -04:00
parent 242a735fe0
commit 6ec2bb17c3
6 changed files with 713 additions and 0 deletions

View File

@@ -561,6 +561,30 @@ struct _GFileIface
gboolean (* poll_mountable_finish) (GFile *file,
GAsyncResult *result,
GError **error);
gboolean (* measure_disk_usage) (GFile *file,
GFileMeasureFlags flags,
GCancellable *cancellable,
GFileMeasureProgressCallback progress_callback,
gpointer progress_data,
guint64 *disk_usage,
guint64 *num_dirs,
guint64 *num_files,
GError **error);
void (* measure_disk_usage_async) (GFile *file,
GFileMeasureFlags flags,
gint io_priority,
GCancellable *cancellable,
GFileMeasureProgressCallback progress_callback,
gpointer progress_data,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* measure_disk_usage_finish) (GFile *file,
GAsyncResult *result,
guint64 *disk_usage,
guint64 *num_dirs,
guint64 *num_files,
GError **error);
};
GLIB_AVAILABLE_IN_ALL
@@ -1085,6 +1109,35 @@ GFileMonitor* g_file_monitor (GFile
GCancellable *cancellable,
GError **error);
GLIB_AVAILABLE_IN_2_38
gboolean g_file_measure_disk_usage (GFile *file,
GFileMeasureFlags flags,
GCancellable *cancellable,
GFileMeasureProgressCallback progress_callback,
gpointer progress_data,
guint64 *disk_usage,
guint64 *num_dirs,
guint64 *num_files,
GError **error);
GLIB_AVAILABLE_IN_2_38
void g_file_measure_disk_usage_async (GFile *file,
GFileMeasureFlags flags,
gint io_priority,
GCancellable *cancellable,
GFileMeasureProgressCallback progress_callback,
gpointer progress_data,
GAsyncReadyCallback callback,
gpointer user_data);
GLIB_AVAILABLE_IN_2_38
gboolean g_file_measure_disk_usage_finish (GFile *file,
GAsyncResult *result,
guint64 *disk_usage,
guint64 *num_dirs,
guint64 *num_files,
GError **error);
GLIB_AVAILABLE_IN_ALL
void g_file_start_mountable (GFile *file,
GDriveStartFlags flags,