[nautilus/wip/corey/fix-sort: 2/8] vfs-file: Handle setting metadata with a NULL list
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/fix-sort: 2/8] vfs-file: Handle setting metadata with a NULL list
- Date: Fri, 21 Oct 2022 00:14:44 +0000 (UTC)
commit 9e284fb531c19e460799043713921355ae5bd62c
Author: Corey Berla <corey berla me>
Date: Tue Sep 27 15:20:49 2022 -0700
vfs-file: Handle setting metadata with a NULL list
Previous to 013edfaa7e567560baf2718ec75980b0118c93da, we had a special case
for handling NULL values when calling nautilus_file_set_metadata_list,
but after that commit, the NULL was passed directly to
g_file_info_set_attribute_stringv() which is not allow. This broke
the "Reset to Default" button in the column chooser.
g_file_info_remove_attribute() does not produce the expected behavior
so simply set the attribute string to an empty string.
src/nautilus-vfs-file.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-vfs-file.c b/src/nautilus-vfs-file.c
index d9d288e43..9e6038c52 100644
--- a/src/nautilus-vfs-file.c
+++ b/src/nautilus-vfs-file.c
@@ -203,7 +203,14 @@ vfs_file_set_metadata_as_list (NautilusFile *file,
info = g_file_info_new ();
gio_key = g_strconcat ("metadata::", key, NULL);
- g_file_info_set_attribute_stringv (info, gio_key, value);
+ if (value == NULL)
+ {
+ g_file_info_set_attribute (info, gio_key, G_FILE_ATTRIBUTE_TYPE_INVALID, NULL);
+ }
+ else
+ {
+ g_file_info_set_attribute_stringv (info, gio_key, value);
+ }
g_free (gio_key);
location = nautilus_file_get_location (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]