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



commit 5e751f2e702d6bf9235fa80f7208c852dbae974c
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 |   33 ++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index e031589..56c51ca 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -6382,6 +6382,39 @@ 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) {
+                                       GFile *real_dest;
+                                       const gchar *target;
+
+                                       target = g_file_info_get_symlink_target (info);
+                                       real_dest = g_file_resolve_relative_path (dest, target);
+                                       g_object_unref (dest);
+                                       dest = real_dest;
+                               }
+                       }
+
+                       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]