diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/gvfsdaemonprotocol.c | 25 | ||||
-rw-r--r-- | common/gvfsdaemonprotocol.h | 3 | ||||
-rw-r--r-- | common/gvfsfileinfo.c | 4 |
3 files changed, 25 insertions, 7 deletions
diff --git a/common/gvfsdaemonprotocol.c b/common/gvfsdaemonprotocol.c index 7097d15b..09421bc9 100644 --- a/common/gvfsdaemonprotocol.c +++ b/common/gvfsdaemonprotocol.c @@ -183,12 +183,14 @@ _g_dbus_type_from_file_attribute_type (GFileAttributeType type) void _g_dbus_append_file_attribute (DBusMessageIter *iter, const char *attribute, + GFileAttributeStatus status, GFileAttributeType type, gpointer value_p) { DBusMessageIter variant_iter, inner_struct_iter; const char *dbus_type; GObject *obj = NULL; + guint32 dbus_status; dbus_type = _g_dbus_type_from_file_attribute_type (type); @@ -203,6 +205,12 @@ _g_dbus_append_file_attribute (DBusMessageIter *iter, &attribute)) _g_dbus_oom (); + dbus_status = status; + if (!dbus_message_iter_append_basic (&inner_struct_iter, + DBUS_TYPE_UINT32, + &dbus_status)) + _g_dbus_oom (); + if (dbus_type[0] == DBUS_TYPE_STRUCT) dbus_type = get_object_signature ((GObject *)value_p); @@ -286,10 +294,11 @@ _g_dbus_append_file_info (DBusMessageIter *iter, for (i = 0; attributes[i] != NULL; i++) { GFileAttributeType type; + GFileAttributeStatus status; gpointer value_p; - if (g_file_info_get_attribute_data (info, attributes[i], &type, &value_p, NULL)) - _g_dbus_append_file_attribute (&array_iter, attributes [i], type, value_p); + if (g_file_info_get_attribute_data (info, attributes[i], &type, &value_p, &status)) + _g_dbus_append_file_attribute (&array_iter, attributes [i], status, type, value_p); } g_strfreev (attributes); @@ -304,6 +313,7 @@ _g_dbus_append_file_info (DBusMessageIter *iter, gboolean _g_dbus_get_file_attribute (DBusMessageIter *iter, gchar **attribute, + GFileAttributeStatus *status, GFileAttributeType *type, GDbusAttributeValue *value) { @@ -313,7 +323,7 @@ _g_dbus_get_file_attribute (DBusMessageIter *iter, DBusMessageIter inner_struct_iter, variant_iter, cstring_iter, obj_iter; const gchar *attribute_temp; int element_type; - dbus_uint32_t obj_type; + dbus_uint32_t obj_type, dbus_status; dbus_bool_t dbus_bool; guint8 byte; GObject *obj; @@ -326,6 +336,10 @@ _g_dbus_get_file_attribute (DBusMessageIter *iter, dbus_message_iter_get_basic (&inner_struct_iter, &attribute_temp); *attribute = g_strdup (attribute_temp); + dbus_message_iter_get_basic (&inner_struct_iter, &dbus_status); + if (status) + *status = dbus_status; + dbus_message_iter_next (&inner_struct_iter); if (dbus_message_iter_get_arg_type (&inner_struct_iter) != DBUS_TYPE_VARIANT) @@ -465,6 +479,7 @@ _g_dbus_get_file_info (DBusMessageIter *iter, DBusMessageIter struct_iter, array_iter; gchar *attribute; GFileAttributeType type; + GFileAttributeStatus status; GDbusAttributeValue value; info = g_file_info_new (); @@ -481,10 +496,12 @@ _g_dbus_get_file_info (DBusMessageIter *iter, while (dbus_message_iter_get_arg_type (&array_iter) == DBUS_TYPE_STRUCT) { - if (!_g_dbus_get_file_attribute (&array_iter, &attribute, &type, &value)) + if (!_g_dbus_get_file_attribute (&array_iter, &attribute, &status, &type, &value)) goto error; g_file_info_set_attribute (info, attribute, type, _g_dbus_attribute_as_pointer (type, &value)); + if (status) + g_file_info_set_attribute_status (info, attribute, status); g_free (attribute); _g_dbus_attribute_value_destroy (type, &value); diff --git a/common/gvfsdaemonprotocol.h b/common/gvfsdaemonprotocol.h index 9dc61eb5..22051908 100644 --- a/common/gvfsdaemonprotocol.h +++ b/common/gvfsdaemonprotocol.h @@ -161,6 +161,7 @@ typedef struct { DBUS_TYPE_ARRAY_AS_STRING \ DBUS_STRUCT_BEGIN_CHAR_AS_STRING \ DBUS_TYPE_STRING_AS_STRING \ + DBUS_TYPE_UINT32_AS_STRING \ DBUS_TYPE_VARIANT_AS_STRING \ DBUS_STRUCT_END_CHAR_AS_STRING @@ -184,12 +185,14 @@ gpointer _g_dbus_attribute_as_pointer (GFileAttributeType ty const char*_g_dbus_type_from_file_attribute_type (GFileAttributeType type); void _g_dbus_append_file_attribute (DBusMessageIter *iter, const char *attribute, + GFileAttributeStatus status, GFileAttributeType type, gpointer value_p); void _g_dbus_append_file_info (DBusMessageIter *iter, GFileInfo *file_info); gboolean _g_dbus_get_file_attribute (DBusMessageIter *iter, gchar **attribute, + GFileAttributeStatus *status, GFileAttributeType *type, GDbusAttributeValue *value); GFileInfo *_g_dbus_get_file_info (DBusMessageIter *iter, diff --git a/common/gvfsfileinfo.c b/common/gvfsfileinfo.c index aef5bd50..b0ace11d 100644 --- a/common/gvfsfileinfo.c +++ b/common/gvfsfileinfo.c @@ -230,9 +230,6 @@ gvfs_file_info_demarshal (char *data, type = g_data_input_stream_read_byte (in, NULL, NULL); status = g_data_input_stream_read_byte (in, NULL, NULL); - /* TODO: There is no way to set the status. This is required for - g_file_set_attributes_from_info() */ - switch (type) { case G_FILE_ATTRIBUTE_TYPE_STRING: @@ -310,6 +307,7 @@ gvfs_file_info_demarshal (char *data, goto out; break; } + g_file_info_set_attribute_status (info, attr, status); g_free (attr); } |