[gedit] Unset correctly GVFS file attributes



commit f174a0480e6e187437c6df27d457a2740d4abc13
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jun 7 18:10:26 2015 +0200

    Unset correctly GVFS file attributes
    
    remove_attribute() removes the attribute from the FileInfo, so when
    calling g_file_set_attributes_from_info(), the attribute value is kept
    as-is, it was not unset.
    
    To unset the file attribute, we must set the attribute to an invalid
    type (it seems there is no nicer way to do it).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741853

 gedit/gedit-document.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index 54629f2..5774c73 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1772,11 +1772,17 @@ set_gvfs_metadata (GeditDocument *doc,
        else
        {
                /* Unset the key */
-               g_file_info_remove_attribute (info, key);
+               g_file_info_set_attribute (info,
+                                          key,
+                                          G_FILE_ATTRIBUTE_TYPE_INVALID,
+                                          NULL);
 
                if (priv->metadata_info != NULL)
                {
-                       g_file_info_remove_attribute (priv->metadata_info, key);
+                       g_file_info_set_attribute (priv->metadata_info,
+                                                  key,
+                                                  G_FILE_ATTRIBUTE_TYPE_INVALID,
+                                                  NULL);
                }
        }
 }


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