aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-11-28 17:39:14 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-11-28 17:39:14 +0100
commite6930c0df67ab53fcb2f7183741dee1bc0d599d4 (patch)
treedf52c4e4a9159231bd68fd986875c533395b4978
parent235a7edc5c2fc2435c837f8a3d427dd0755f966d (diff)
downloadayatana-indicator-messages-e6930c0df67ab53fcb2f7183741dee1bc0d599d4.tar.gz
ayatana-indicator-messages-e6930c0df67ab53fcb2f7183741dee1bc0d599d4.tar.bz2
ayatana-indicator-messages-e6930c0df67ab53fcb2f7183741dee1bc0d599d4.zip
Expose message actions in the phone menu
And use com.canonical.indicator.messages.snapdecision as widget type if the message has actions.
-rw-r--r--src/im-application-list.c6
-rw-r--r--src/im-phone-menu.c11
-rw-r--r--src/im-phone-menu.h1
3 files changed, 15 insertions, 3 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index 1f901ec..c446d12 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -271,13 +271,15 @@ im_application_list_class_init (ImApplicationListClass *klass)
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE,
- 8,
+ 10,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_VARIANT,
G_TYPE_INT64,
G_TYPE_BOOLEAN);
@@ -529,7 +531,7 @@ im_application_list_message_added (Application *app,
g_simple_action_group_insert (app->message_actions, G_ACTION (action));
g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
- app->id, app_iconstr, id, iconstr, title, subtitle, body, time, draws_attention);
+ app->id, app_iconstr, id, iconstr, title, subtitle, body, actions, time, draws_attention);
g_variant_unref (actions);
g_free (app_iconstr);
diff --git a/src/im-phone-menu.c b/src/im-phone-menu.c
index 728c08b..6e511ac 100644
--- a/src/im-phone-menu.c
+++ b/src/im-phone-menu.c
@@ -151,6 +151,7 @@ im_phone_menu_add_message (ImPhoneMenu *menu,
const gchar *title,
const gchar *subtitle,
const gchar *body,
+ GVariant *actions,
gint64 time)
{
GMenuItem *item;
@@ -162,7 +163,15 @@ im_phone_menu_add_message (ImPhoneMenu *menu,
action_name = g_strconcat (app_id, ".msg.", id, NULL);
item = g_menu_item_new (title, action_name);
- g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.messageitem");
+
+ if (g_variant_n_children (actions))
+ {
+ g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.snapdecision");
+ g_menu_item_set_attribute (item, "x-canonical-message-actions", "v", actions);
+ }
+ else
+ g_menu_item_set_attribute (item, "x-canonical-type", "s", "com.canonical.indicator.messages.messageitem");
+
g_menu_item_set_attribute (item, "x-canonical-message-id", "s", id);
g_menu_item_set_attribute (item, "x-canonical-subtitle", "s", subtitle);
g_menu_item_set_attribute (item, "x-canonical-text", "s", body);
diff --git a/src/im-phone-menu.h b/src/im-phone-menu.h
index f6a6118..84908e2 100644
--- a/src/im-phone-menu.h
+++ b/src/im-phone-menu.h
@@ -45,6 +45,7 @@ void im_phone_menu_add_message (ImPhoneMenu *men
const gchar *title,
const gchar *subtitle,
const gchar *body,
+ GVariant *actions,
gint64 time);
void im_phone_menu_remove_message (ImPhoneMenu *menu,