[gedit/gnome-3-16] Unset correctly GVFS file attributes



commit 76b95976bef764e7c23344f37cbf368a61be78e6
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jun 7 18:23:14 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 e7903ae..374c5f1 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1692,11 +1692,17 @@ gedit_document_set_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 (doc->priv->metadata_info != NULL)
                        {
-                               g_file_info_remove_attribute (doc->priv->metadata_info, key);
+                               g_file_info_set_attribute (doc->priv->metadata_info,
+                                                          key,
+                                                          G_FILE_ATTRIBUTE_TYPE_INVALID,
+                                                          NULL);
                        }
                }
        }


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