[glib] resource file: Return some filesystem info
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] resource file: Return some filesystem info
- Date: Fri, 21 Aug 2015 04:02:20 +0000 (UTC)
commit d942c64267ec72c19fa1b74050f238041918a479
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 21 00:01:12 2015 -0400
resource file: Return some filesystem info
We now return "resource" as the filesystem type, and state
that the filesystem if readonly.
gio/gresourcefile.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gio/gresourcefile.c b/gio/gresourcefile.c
index 352879f..f4af711 100644
--- a/gio/gresourcefile.c
+++ b/gio/gresourcefile.c
@@ -518,6 +518,28 @@ g_resource_file_query_info (GFile *file,
return info;
}
+static GFileInfo *
+g_resource_file_query_filesystem_info (GFile *file,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GFileInfo *info;
+ GFileAttributeMatcher *matcher;
+
+ info = g_file_info_new ();
+
+ matcher = g_file_attribute_matcher_new (attributes);
+ if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE))
+ g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "resource");
+
+ if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY))
g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE);
+
+ g_file_attribute_matcher_unref (matcher);
+
+ return info;
+}
+
static GFileAttributeInfoList *
g_resource_file_query_settable_attributes (GFile *file,
GCancellable *cancellable,
@@ -612,6 +634,7 @@ g_resource_file_file_iface_init (GFileIface *iface)
iface->get_child_for_display_name = g_resource_file_get_child_for_display_name;
iface->enumerate_children = g_resource_file_enumerate_children;
iface->query_info = g_resource_file_query_info;
+ iface->query_filesystem_info = g_resource_file_query_filesystem_info;
iface->query_settable_attributes = g_resource_file_query_settable_attributes;
iface->query_writable_namespaces = g_resource_file_query_writable_namespaces;
iface->read_fn = g_resource_file_read;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]