summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2009-06-25 12:28:49 +0200
committerAlexander Larsson <alexl@redhat.com>2009-06-25 21:00:37 +0200
commit10abe67d01e5d0845727446471159ed02584547d (patch)
tree68074d3c0a98bf1f02e807b0c29c85a24a9ce090
parent48842732168909ce3b4c9136a28c2e5a5a25d98b (diff)
downloadgvfs-10abe67d01e5d0845727446471159ed02584547d.tar.gz
(de)marshal the attribute status in GFileInfo
-rw-r--r--client/gdaemonfile.c2
-rw-r--r--common/gvfsdaemonprotocol.c25
-rw-r--r--common/gvfsdaemonprotocol.h3
-rw-r--r--common/gvfsfileinfo.c4
-rw-r--r--daemon/gvfsjobsetattribute.c2
5 files changed, 27 insertions, 9 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 9c70b3cf..1ecc5b0b 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -1979,7 +1979,7 @@ g_daemon_file_set_attribute (GFile *file,
DBUS_TYPE_UINT32,
&flags_dbus);
- _g_dbus_append_file_attribute (&iter, attribute, type, value_p);
+ _g_dbus_append_file_attribute (&iter, attribute, 0, type, value_p);
my_error = NULL;
reply = _g_vfs_daemon_call_sync (message,
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);
}
diff --git a/daemon/gvfsjobsetattribute.c b/daemon/gvfsjobsetattribute.c
index 3904a3f2..264a5361 100644
--- a/daemon/gvfsjobsetattribute.c
+++ b/daemon/gvfsjobsetattribute.c
@@ -113,7 +113,7 @@ g_vfs_job_set_attribute_new (DBusConnection *connection,
flags = flags_u32;
- if (!(filename && _g_dbus_get_file_attribute (&iter, &attribute, &type, &value)))
+ if (!(filename && _g_dbus_get_file_attribute (&iter, &attribute, NULL, &type, &value)))
{
reply = dbus_message_new_error (message,
DBUS_ERROR_FAILED,