aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-02-19 15:55:50 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-02-19 15:55:50 +0000
commite7c2a6f30ad33feed480ede7482f570e5d661ab2 (patch)
tree5438c7ca179d123a96168ae7dc4785ca1fa133c8
parent051a469fee96bd9f48771a731a334b65468f907f (diff)
parent261ef70765e5ba220911cad762bd91b08a5ebe44 (diff)
downloadayatana-indicator-messages-e7c2a6f30ad33feed480ede7482f570e5d661ab2.tar.gz
ayatana-indicator-messages-e7c2a6f30ad33feed480ede7482f570e5d661ab2.tar.bz2
ayatana-indicator-messages-e7c2a6f30ad33feed480ede7482f570e5d661ab2.zip
Provide functions that allow for action names directly Fixes: #1385331
Approved by: PS Jenkins bot, Lars Uebernickel
-rw-r--r--src/im-application-list.c44
-rw-r--r--tests/manual17
2 files changed, 46 insertions, 15 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index cbabc64..2d0d7fd 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -343,6 +343,17 @@ application_update_draws_attention (Application * app)
return was_drawing_attention != app->draws_attention;
}
+static void
+im_application_list_source_removed_action (Application *app,
+ const gchar *action_name)
+{
+ g_action_map_remove_action (G_ACTION_MAP(app->source_actions), action_name);
+ g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, action_name);
+
+ if (application_update_draws_attention(app))
+ im_application_list_update_root_action (app->list);
+}
+
/* Remove a source from an application, signal up and update the status
of the draws attention flag. */
static void
@@ -353,11 +364,7 @@ im_application_list_source_removed (Application *app,
action_name = escape_action_name (id);
- g_action_map_remove_action (G_ACTION_MAP(app->source_actions), action_name);
- g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, action_name);
-
- if (application_update_draws_attention(app))
- im_application_list_update_root_action (app->list);
+ im_application_list_source_removed_action (app, action_name);
g_free (action_name);
}
@@ -389,19 +396,15 @@ im_application_list_source_activated (GSimpleAction *action,
app->cancellable, NULL, NULL);
}
- im_application_list_source_removed (app, action_name);
+ im_application_list_source_removed_action (app, action_name);
g_free (source_id);
}
static void
-im_application_list_message_removed (Application *app,
- const gchar *id)
+im_application_list_message_removed_action (Application *app,
+ const gchar *action_name)
{
- gchar *action_name;
-
- action_name = escape_action_name (id);
-
g_action_map_remove_action (G_ACTION_MAP(app->message_actions), action_name);
g_action_muxer_remove (app->message_sub_actions, action_name);
@@ -409,6 +412,17 @@ im_application_list_message_removed (Application *app,
im_application_list_update_root_action (app->list);
g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, action_name);
+}
+
+static void
+im_application_list_message_removed (Application *app,
+ const gchar *id)
+{
+ gchar *action_name;
+
+ action_name = escape_action_name (id);
+
+ im_application_list_message_removed_action(app, action_name);
g_free (action_name);
}
@@ -442,7 +456,7 @@ im_application_list_message_activated (GSimpleAction *action,
app->cancellable, NULL, NULL);
}
- im_application_list_message_removed (app, action_name);
+ im_application_list_message_removed_action (app, action_name);
g_free (message_id);
}
@@ -498,11 +512,11 @@ im_application_list_remove_all (GSimpleAction *action,
source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));
for (it = source_actions; *it; it++)
- im_application_list_source_removed (app, *it);
+ im_application_list_source_removed_action (app, *it);
message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));
for (it = message_actions; *it; it++)
- im_application_list_message_removed (app, *it);
+ im_application_list_message_removed_action (app, *it);
if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */
{
diff --git a/tests/manual b/tests/manual
index 412a97a..d638875 100644
--- a/tests/manual
+++ b/tests/manual
@@ -61,3 +61,20 @@ Test-case indicator-messages/unity8-embedded-greeter
<dt>Clear the message in the greeter</dt>
<dd>The message should no longer be in the messaging menu</dd>
</dl>
+
+Test-case indicator-messages/push-message-twitter
+<dl>
+ <dt>From a shell prompt send a simultated Twitter push notification</dt>
+ <dd>gdbus call --session --dest com.ubuntu.Postal --object-path /com/ubuntu/Postal/com_2eubuntu_2edeveloper_2ewebapps_2ewebapp_2dtwitter --method com.ubuntu.Postal.Post com.ubuntu.developer.webapps.webapp-twitter_webapp-twitter '"{\"message\": \"foobar\", \"notification\":{\"card\": {\"summary\": \"yes\", \"body\": \"hello\", \"popup\": true, \"persist\": true}}}"'</dd>
+ <dd>The messaging envelope on the panel should change to highlight a message</dd>
+ <dt>Open the messaging menu</dt>
+ <dd>The menu should contain an entry with the Twitter icon for the application</dd>
+ <dd>The title of the message should be 'yes'</dd>
+ <dd>The body of the message should be 'hello'</dd>
+ <dd>At the bottom of them menu there should be a 'Clear All' menu item</dd>
+ <dt>Clear the message using the 'Clear All' command</dt>
+ <dd>The Twitter message should disappear</dd>
+ <dd>The 'Clear All' item should disappear</dd>
+ <dd>The icon in the panel should return to its original state</dd>
+</dl>
+