summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-03 23:11:46 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-07-03 23:11:46 -0400
commit2a63ef4765d46371ed64a1782f44097baf9f75d0 (patch)
tree3e9dd6e6e927bf00cbb0010389248c966ea3afdd
parent9564a340be68000cd639fee05c0402347abd47d3 (diff)
downloadgvfs-standard-file-info.tar.gz
daemonfile: Set the standard::file attributestandard-file-info
When requested, set the standard::file attribute. This attribute is going to be used by the GTK file chooser. GLib defines a name for this attribute, but we use the literal string here to avoid a hard dependency on a recent version of GLib, just for a macro.
-rw-r--r--client/gdaemonfile.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 2a8c1511..09aac6d7 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -791,6 +791,21 @@ add_metadata (GFile *file,
g_file_attribute_matcher_unref (matcher);
}
+static void
+add_file (GFile *file,
+ const char *attributes,
+ GFileInfo *info)
+{
+ GFileAttributeMatcher *matcher;
+
+ matcher = g_file_attribute_matcher_new (attributes);
+
+ if (g_file_attribute_matcher_matches (matcher, "standard::file"))
+ g_file_info_set_attribute_object (info, "standard::file", G_OBJECT (file));
+
+ g_file_attribute_matcher_unref (matcher);
+}
+
static GFileInfo *
g_daemon_file_query_info (GFile *file,
const char *attributes,
@@ -840,8 +855,11 @@ g_daemon_file_query_info (GFile *file,
g_variant_unref (iter_info);
if (info)
- add_metadata (file, attributes, info);
-
+ {
+ add_metadata (file, attributes, info);
+ add_file (file, attributes, info);
+ }
+
return info;
}
@@ -890,6 +908,7 @@ query_info_async_cb (GVfsDBusMount *proxy,
file = G_FILE (g_task_get_source_object (task));
add_metadata (file, data->attributes, info);
+ add_file (file, data->attributes, info);
g_task_return_pointer (task, info, g_object_unref);