diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-11-28 17:24:31 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-11-28 17:24:31 +0100 |
commit | 235a7edc5c2fc2435c837f8a3d427dd0755f966d (patch) | |
tree | 7b667300eaf862ac992502bc0f22280f1061415b /libmessaging-menu/messaging-menu-message.c | |
parent | ced173aa7ea78c76922e07c84743d5b7f76c265e (diff) | |
download | ayatana-indicator-messages-235a7edc5c2fc2435c837f8a3d427dd0755f966d.tar.gz ayatana-indicator-messages-235a7edc5c2fc2435c837f8a3d427dd0755f966d.tar.bz2 ayatana-indicator-messages-235a7edc5c2fc2435c837f8a3d427dd0755f966d.zip |
Use aa{sv} instead of a(ssgav) to communicate actions to the service
Diffstat (limited to 'libmessaging-menu/messaging-menu-message.c')
-rw-r--r-- | libmessaging-menu/messaging-menu-message.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/libmessaging-menu/messaging-menu-message.c b/libmessaging-menu/messaging-menu-message.c index a17cdb6..886c552 100644 --- a/libmessaging-menu/messaging-menu-message.c +++ b/libmessaging-menu/messaging-menu-message.c @@ -470,24 +470,22 @@ action_to_variant (Action *action) { GVariantBuilder builder; - g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ssgav)")); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); - g_variant_builder_add (&builder, "s", action->id); - g_variant_builder_add (&builder, "s", action->label ? action->label : ""); + g_variant_builder_add (&builder, "{sv}", "name", g_variant_new_string (action->id)); + + if (action->label) + g_variant_builder_add (&builder, "{sv}", "label", g_variant_new_string (action->label)); if (action->parameter_type) { gchar *type = g_variant_type_dup_string (action->parameter_type); - g_variant_builder_add (&builder, "g", type); + g_variant_builder_add (&builder, "{sv}", "parameter-type", g_variant_new_signature (type)); g_free (type); } - else - g_variant_builder_add (&builder, "g", ""); - g_variant_builder_open (&builder, G_VARIANT_TYPE ("av")); if (action->parameter_hint) - g_variant_builder_add (&builder, "v", action->parameter_hint); - g_variant_builder_close (&builder); + g_variant_builder_add (&builder, "{sv}", "parameter-hint", action->parameter_hint); return g_variant_builder_end (&builder); } @@ -496,7 +494,7 @@ action_to_variant (Action *action) * messaging_menu_message_to_variant: * @msg: a #MessagingMenuMessage * - * Serializes @msg to a #GVariant of the form (sssssxa(ssgav)b): + * Serializes @msg to a #GVariant of the form (sssssxaa{sv}b): * * id * icon @@ -504,10 +502,7 @@ action_to_variant (Action *action) * subtitle * body * time - * array of actions: id - * label - * parameter_type - * parameter_hint (0 or 1 elements) + * array of action dictionaries * draws_attention * * Returns: a new floating #GVariant instance @@ -520,7 +515,7 @@ messaging_menu_message_to_variant (MessagingMenuMessage *msg) g_return_val_if_fail (MESSAGING_MENU_IS_MESSAGE (msg), NULL); - g_variant_builder_init (&builder, G_VARIANT_TYPE ("(sssssxa(ssgav)b)")); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("(sssssxaa{sv}b)")); g_variant_builder_add (&builder, "s", msg->id); @@ -541,7 +536,7 @@ messaging_menu_message_to_variant (MessagingMenuMessage *msg) g_variant_builder_add (&builder, "s", msg->body ? msg->body : ""); g_variant_builder_add (&builder, "x", msg->time); - g_variant_builder_open (&builder, G_VARIANT_TYPE ("a(ssgav)")); + g_variant_builder_open (&builder, G_VARIANT_TYPE ("aa{sv}")); for (it = msg->actions; it; it = it->next) g_variant_builder_add_value (&builder, action_to_variant (it->data)); g_variant_builder_close (&builder); |