[gvfs] Allow unsetting keys with the standard Set dbus operation
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gvfs] Allow unsetting keys with the standard Set dbus operation
- Date: Thu, 25 Jun 2009 07:25:08 +0000 (UTC)
commit 4d7f64d2060884441d39726ce03393b2db597e06
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jun 25 09:19:54 2009 +0200
Allow unsetting keys with the standard Set dbus operation
Passing a key value type of Byte means unset that key.
metadata/meta-daemon.c | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/metadata/meta-daemon.c b/metadata/meta-daemon.c
index f86e581..51ce68c 100644
--- a/metadata/meta-daemon.c
+++ b/metadata/meta-daemon.c
@@ -119,6 +119,7 @@ metadata_set (const char *treefile,
gboolean res;
const char *key;
int n_elements;
+ char c;
info = tree_info_lookup (treefile);
if (info == NULL)
@@ -160,7 +161,7 @@ metadata_set (const char *treefile,
}
g_strfreev (strv);
}
- else
+ else if (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING)
{
/* string */
if (!_g_dbus_message_iter_get_args (iter, derror,
@@ -178,6 +179,24 @@ metadata_set (const char *treefile,
res = FALSE;
}
}
+ else if (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_BYTE)
+ {
+ /* Unset */
+ if (!_g_dbus_message_iter_get_args (iter, derror,
+ DBUS_TYPE_BYTE, &c,
+ 0))
+ {
+ res = FALSE;
+ break;
+ }
+ if (!meta_tree_unset (info->tree, path, key))
+ {
+ dbus_set_error (derror,
+ DBUS_ERROR_FAILED,
+ _("Unable to unset metadata key"));
+ res = FALSE;
+ }
+ }
}
tree_info_schedule_writeout (info);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]