Blob Blame History Raw
From c1f59ef858a2b6b14f4c05f49cb8d5b4a1642451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Wilmet?= <swilmet@gnome.org>
Date: Sun, 7 Jun 2015 18:23:14 +0200
Subject: [PATCH 10/26] 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 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gedit/gedit-document.c b/gedit/gedit-document.c
index ab4fab6..cc59ea1 100644
--- a/gedit/gedit-document.c
+++ b/gedit/gedit-document.c
@@ -1662,11 +1662,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);
 			}
 		}
 	}
-- 
1.8.3.1