[gedit/gnome-3-14] GeditDocument: fix bug when setting metadata



commit 57fd9fb5f6df82b95b63e72f57547dfa4d6daf54
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Dec 14 17:20:27 2014 +0100

    GeditDocument: fix bug when setting metadata
    
    g_file_info_copy_into() begins to clear @dest_info, and then copy the
    attributes from @src_info to @dest_info.
    
    So the previously loaded metadata in doc->priv->metadata_info were
    removed each time that gedit_document_set_metadata() was called (with
    the gvfs metadata). Now the new attributes are correctly copied, without
    removing the other ones.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741426

 gedit/gedit-document.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index c9c139b..f5a848f 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1653,21 +1653,26 @@ gedit_document_set_metadata (GeditDocument *doc,
                if (value != NULL)
                {
                        g_file_info_set_attribute_string (info, key, value);
+
+                       if (doc->priv->metadata_info != NULL)
+                       {
+                               g_file_info_set_attribute_string (doc->priv->metadata_info, key, value);
+                       }
                }
                else
                {
                        /* Unset the key */
                        g_file_info_remove_attribute (info, key);
+
+                       if (doc->priv->metadata_info != NULL)
+                       {
+                               g_file_info_remove_attribute (doc->priv->metadata_info, key);
+                       }
                }
        }
 
        va_end (var_args);
 
-       if (doc->priv->metadata_info != NULL)
-       {
-               g_file_info_copy_into (info, doc->priv->metadata_info);
-       }
-
        location = gtk_source_file_get_location (doc->priv->file);
 
        if (location != NULL)


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