summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@src.gnome.org>2007-09-13 14:24:32 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-09-13 14:24:32 +0000
commit33167345fadd071dc00ee67d4410397162d7e0b2 (patch)
tree8525425c73c88dc6b3a25a3697dea09925222a1b /common
parent3c0b23bd7421537bc59e7e7ce191f9a3ca220fad (diff)
downloadgvfs-33167345fadd071dc00ee67d4410397162d7e0b2.tar.gz
Add daemon side query attribute support
Original git commit by Alexander Larsson <alexl@redhat.com> at 1183735279 +0200 svn path=/trunk/; revision=678
Diffstat (limited to 'common')
-rw-r--r--common/gvfsdaemonprotocol.c44
-rw-r--r--common/gvfsdaemonprotocol.h6
2 files changed, 47 insertions, 3 deletions
diff --git a/common/gvfsdaemonprotocol.c b/common/gvfsdaemonprotocol.c
index 1d6030d1..4993d6d8 100644
--- a/common/gvfsdaemonprotocol.c
+++ b/common/gvfsdaemonprotocol.c
@@ -412,7 +412,6 @@ _g_dbus_get_file_info (DBusMessageIter *iter,
return NULL;
}
-
GFileAttributeInfoList *
_g_dbus_get_attribute_info_list (DBusMessageIter *iter,
GError **error)
@@ -454,3 +453,46 @@ _g_dbus_get_attribute_info_list (DBusMessageIter *iter,
return list;
}
+
+void
+_g_dbus_append_attribute_info_list (DBusMessageIter *iter,
+ GFileAttributeInfoList *list)
+{
+ DBusMessageIter array_iter, struct_iter;
+ int i;
+ dbus_uint32_t dbus_type;
+
+ if (!dbus_message_iter_open_container (iter,
+ DBUS_TYPE_ARRAY,
+ DBUS_STRUCT_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_UINT32_AS_STRING
+ DBUS_STRUCT_END_CHAR_AS_STRING,
+ &array_iter))
+ _g_dbus_oom ();
+
+ for (i = 0; i < list->n_infos; i++)
+ {
+ if (!dbus_message_iter_open_container (&array_iter,
+ DBUS_TYPE_STRUCT,
+ DBUS_TYPE_STRING_AS_STRING
+ DBUS_TYPE_UINT32_AS_STRING,
+ &struct_iter))
+ _g_dbus_oom ();
+
+ if (!dbus_message_iter_append_basic (&struct_iter,
+ DBUS_TYPE_STRING, &list->infos[i].name))
+ _g_dbus_oom ();
+
+ dbus_type = list->infos[i].type;
+ if (!dbus_message_iter_append_basic (&struct_iter,
+ DBUS_TYPE_UINT32, &dbus_type))
+ _g_dbus_oom ();
+
+ if (!dbus_message_iter_close_container (&array_iter, &struct_iter))
+ _g_dbus_oom ();
+ }
+
+ if (!dbus_message_iter_close_container (iter, &array_iter))
+ _g_dbus_oom ();
+}
diff --git a/common/gvfsdaemonprotocol.h b/common/gvfsdaemonprotocol.h
index d70acda0..fe7ca73a 100644
--- a/common/gvfsdaemonprotocol.h
+++ b/common/gvfsdaemonprotocol.h
@@ -145,8 +145,10 @@ gboolean _g_dbus_get_file_attribute (DBusMessageIter *it
GFileInfo *_g_dbus_get_file_info (DBusMessageIter *iter,
GError **error);
-GFileAttributeInfoList *_g_dbus_get_attribute_info_list (DBusMessageIter *iter,
- GError **error);
+GFileAttributeInfoList *_g_dbus_get_attribute_info_list (DBusMessageIter *iter,
+ GError **error);
+void _g_dbus_append_attribute_info_list (DBusMessageIter *iter,
+ GFileAttributeInfoList *list);
G_END_DECLS