[nautilus/wip/rishi/gfile-google: 1/2] file-operations: Let directory creation work on Google Drive



commit 0e3f7b06da941af918f724dfbcbca901ab8fa316
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 25 10:27:31 2015 +0200

    file-operations: Let directory creation work on Google Drive
    
    Immediately check if the newly created directory is volatile or not,
    and if it is then switch to using the "real" persistent URI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=751481

 libnautilus-private/nautilus-file-operations.c |   31 ++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index e031589..0d8d651 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -6382,6 +6382,37 @@ create_job (GIOSchedulerJob *io_job,
                                             common->cancellable,
                                             &error);
 
+#ifdef G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE
+               if (res) {
+                       GFileInfo *info = NULL;
+
+                       info = g_file_query_info (dest,
+                                                 G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK","
+                                                 G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE","
+                                                 G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+                                                 G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                                 common->cancellable,
+                                                 &error);
+                       if (info == NULL) {
+                               res = FALSE;
+                       } else {
+                               gboolean is_volatile;
+
+                               is_volatile = g_file_info_get_attribute_boolean (info,
+                                                                                
G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE);
+                               if (is_volatile) {
+                                       const gchar *target;
+
+                                       target = g_file_info_get_symlink_target (info);
+                                       g_object_unref (dest);
+                                       dest = g_file_new_for_uri (target);
+                               }
+                       }
+
+                       g_clear_object (&info);
+               }
+#endif /* G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE */
+
                if (res && common->undo_info != NULL) {
                        nautilus_file_undo_info_create_set_data (NAUTILUS_FILE_UNDO_INFO_CREATE 
(common->undo_info),
                                                                 dest, NULL, 0);


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