David Reveman wrote: >> I think the correct solution would be to allow >> the dbus plugin to receive arrays and convert them >> to lists internally. I can have a look at doing this >> if you do not mind. >> > > yes, list options should be sent as arrays. i definitely don't mind, > please look at it. >
Here is a small patch that means lists options have to be sent as arrays, it should make it easier for language bindings. To send an array using dbus-send, use this syntax array:string:'foo','bar' It should work with all the datatypes, I haven't tested it but I see no reason why it shouldn't. Zero length arrays are fine so you can unset a list option by using this as the value array:string: This patch is for the set option only, I couldn't see any other place where an array needs to be converted to a list. Regards Mike
>From 532b92bd64956afdf3f9ebc304f375785afd247e Mon Sep 17 00:00:00 2001 From: [EMAIL PROTECTED] <[EMAIL PROTECTED](none)> Date: Fri, 26 Jan 2007 20:09:26 +0000 Subject: [PATCH] Allow set method to receive lists as dbus arrays --- plugins/dbus.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/plugins/dbus.c b/plugins/dbus.c index d20506e..0346e6b 100644 --- a/plugins/dbus.c +++ b/plugins/dbus.c @@ -454,7 +454,7 @@ dbusHandleSetOptionMessage (DBusConnection *connection, { if (strcmp (option->name, path[2]) == 0) { - DBusMessageIter iter; + DBusMessageIter iter, aiter; CompOptionValue value, tmpValue; Bool status = FALSE; @@ -462,11 +462,15 @@ dbusHandleSetOptionMessage (DBusConnection *connection, if (option->type == CompOptionTypeList) { - if (dbus_message_iter_init (message, &iter)) + if (dbus_message_iter_init (message, &iter) && + dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_ARRAY) { + dbus_message_iter_recurse (&iter, &aiter); + do { - if (dbusGetOptionValue (&iter, option->value.list.type, + if (dbusGetOptionValue (&aiter, + option->value.list.type, &tmpValue)) { CompOptionValue *v; @@ -480,10 +484,10 @@ dbusHandleSetOptionMessage (DBusConnection *connection, value.list.value = v; } } - } while (dbus_message_iter_next (&iter)); - } + } while (dbus_message_iter_next (&aiter)); - status = TRUE; + status = TRUE; + } } else if (dbus_message_iter_init (message, &iter)) { -- 1.4.4.3
_______________________________________________ compiz mailing list compiz@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/compiz