[glib/wip/rishi/gfile-google: 1/2] gfile: Add new g_file_resolve_created_path() API



commit 908877381e5b985a2ba0bbef92460074a494917f
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Dec 16 16:58:18 2014 +0100

    gfile: Add new g_file_resolve_created_path() API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741602

 docs/reference/gio/gio-sections.txt |    1 +
 gio/gfile.c                         |   40 +++++++++++++++++++++++++++++++++++
 gio/gfile.h                         |    9 +++++++
 3 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index d91f598..40678db 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -169,6 +169,7 @@ g_file_eject_mountable
 g_file_eject_mountable_finish
 g_file_eject_mountable_with_operation
 g_file_eject_mountable_with_operation_finish
+g_file_resolve_created_path
 g_file_start_mountable
 g_file_start_mountable_finish
 g_file_stop_mountable
diff --git a/gio/gfile.c b/gio/gfile.c
index 0fd62f2..9b10a39 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -338,6 +338,10 @@ static gboolean           g_file_real_measure_disk_usage_finish   (GFile
                                                                    guint64                       *num_files,
                                                                    GError                       **error);
 
+static GFile *            g_file_real_resolve_created_path        (GFile                  *file,
+                                                                   GCancellable           *cancellable,
+                                                                   GError                **error);
+
 typedef GFileIface GFileInterface;
 G_DEFINE_INTERFACE (GFile, g_file, G_TYPE_OBJECT)
 
@@ -382,6 +386,7 @@ g_file_default_init (GFileIface *iface)
   iface->measure_disk_usage = g_file_real_measure_disk_usage;
   iface->measure_disk_usage_async = g_file_real_measure_disk_usage_async;
   iface->measure_disk_usage_finish = g_file_real_measure_disk_usage_finish;
+  iface->resolve_created_path = g_file_real_resolve_created_path;
 }
 
 
@@ -7745,6 +7750,41 @@ g_file_measure_disk_usage_finish (GFile         *file,
   return G_FILE_GET_IFACE (file)->measure_disk_usage_finish (file, result, disk_usage, num_dirs, num_files, 
error);
 }
 
+static GFile *
+g_file_real_resolve_created_path (GFile         *file,
+                                  GCancellable  *cancellable,
+                                  GError       **error)
+{
+  return g_object_ref (file);
+}
+
+/**
+ * g_file_resolve_created_path:
+ * @file: a #GFile
+ * @cancellable: (allow-none): optional #GCancellable
+ * @error: (allow-none): %NULL, or a pointer to a %NULL #GError pointer
+ *
+ * Find out the actual location of @file just after it has been
+ * created.
+ *
+ * Returns: (transfer full): a #GFile specifying what @file was
+ * created as, or %NULL if there was an error. Free the returned
+ * object with g_object_unref();
+ *
+ * Since: 2.44
+ **/
+GFile *
+g_file_resolve_created_path (GFile         *file,
+                             GCancellable  *cancellable,
+                             GError       **error)
+{
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+  g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  return G_FILE_GET_IFACE (file)->resolve_created_path (file, cancellable, error);
+}
+
 /**
  * g_file_start_mountable:
  * @file: input #GFile
diff --git a/gio/gfile.h b/gio/gfile.h
index 368bb04..2c92d23 100644
--- a/gio/gfile.h
+++ b/gio/gfile.h
@@ -586,6 +586,10 @@ struct _GFileIface
                                                        guint64                       *num_dirs,
                                                        guint64                       *num_files,
                                                        GError                       **error);
+
+  GFile *             (* resolve_created_path)        (GFile                *file,
+                                                       GCancellable         *cancellable,
+                                                       GError              **error);
 };
 
 GLIB_AVAILABLE_IN_ALL
@@ -1139,6 +1143,11 @@ gboolean                g_file_measure_disk_usage_finish  (GFile
                                                            guint64                       *num_files,
                                                            GError                       **error);
 
+GLIB_AVAILABLE_IN_2_44
+GFile *                 g_file_resolve_created_path       (GFile                      *file,
+                                                           GCancellable               *cancellable,
+                                                           GError                    **error);
+
 GLIB_AVAILABLE_IN_ALL
 void                    g_file_start_mountable            (GFile                      *file,
                                                           GDriveStartFlags            flags,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]