[gvfs/standard-file-info] daemonfile: Set the standard::file attribute
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/standard-file-info] daemonfile: Set the standard::file attribute
- Date: Sat, 4 Jul 2020 03:13:43 +0000 (UTC)
commit 2a63ef4765d46371ed64a1782f44097baf9f75d0
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 3 23:11:46 2020 -0400
daemonfile: Set the standard::file attribute
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.
client/gdaemonfile.c | 23 +++++++++++++++++++++--
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]