aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/com.canonical.indicator.messages.application.xml4
-rw-r--r--libmessaging-menu/messaging-menu-app.c2
-rw-r--r--libmessaging-menu/messaging-menu-message.c27
-rw-r--r--src/im-application-list.c8
4 files changed, 18 insertions, 23 deletions
diff --git a/common/com.canonical.indicator.messages.application.xml b/common/com.canonical.indicator.messages.application.xml
index 5e99780..6f038e6 100644
--- a/common/com.canonical.indicator.messages.application.xml
+++ b/common/com.canonical.indicator.messages.application.xml
@@ -5,7 +5,7 @@
<arg type="a(sssuxsb)" name="sources" direction="out" />
</method>
<method name="ListMessages">
- <arg type="a(sssssxa(ssgav)b)" name="message" direction="out" />
+ <arg type="a(sssssxaa{sv}b)" name="message" direction="out" />
</method>
<method name="ActivateSource">
<arg type="s" name="source_id" direction="in" />
@@ -30,7 +30,7 @@
<arg type="s" name="source_id" direction="in" />
</signal>
<signal name="MessageAdded">
- <arg type="(sssssxa(ssgav)b)" name="message" direction="in" />
+ <arg type="(sssssxaa{sv}b)" name="message" direction="in" />
</signal>
<signal name="MessageRemoved">
<arg type="s" name="message_id" direction="in" />
diff --git a/libmessaging-menu/messaging-menu-app.c b/libmessaging-menu/messaging-menu-app.c
index 8b9f76b..3747705 100644
--- a/libmessaging-menu/messaging-menu-app.c
+++ b/libmessaging-menu/messaging-menu-app.c
@@ -529,7 +529,7 @@ messaging_menu_app_list_messages (IndicatorMessagesApplication *app_interface,
GHashTableIter iter;
MessagingMenuMessage *message;
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssssxa(ssgav)b)"));
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(sssssxaa{sv}b)"));
g_hash_table_iter_init (&iter, app->messages);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &message))
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);
diff --git a/src/im-application-list.c b/src/im-application-list.c
index 7c53e69..1f901ec 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -511,14 +511,14 @@ im_application_list_message_added (Application *app,
const gchar *subtitle;
const gchar *body;
gint64 time;
- GVariantIter *action_iter;
+ GVariant *actions;
gboolean draws_attention;
GSimpleAction *action;
GIcon *app_icon;
gchar *app_iconstr;
- g_variant_get (message, "(&s&s&s&s&sxa(ssgav)b)",
- &id, &iconstr, &title, &subtitle, &body, &time, &action_iter, &draws_attention);
+ g_variant_get (message, "(&s&s&s&s&sx@aa{sv}b)",
+ &id, &iconstr, &title, &subtitle, &body, &time, &actions, &draws_attention);
app_icon = g_app_info_get_icon (G_APP_INFO (app->info));
app_iconstr = app_icon ? g_icon_to_string (app_icon) : NULL;
@@ -531,7 +531,7 @@ im_application_list_message_added (Application *app,
g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
app->id, app_iconstr, id, iconstr, title, subtitle, body, time, draws_attention);
- g_variant_iter_free (action_iter);
+ g_variant_unref (actions);
g_free (app_iconstr);
g_object_unref (action);
}