Merge lp:~ted/indicator-messages/lp1385331-unescape-message-ids into lp:indicator-messages/15.04

Proposed by Ted Gould
Status: Merged
Approved by: Lars Karlitski
Approved revision: 439
Merged at revision: 437
Proposed branch: lp:~ted/indicator-messages/lp1385331-unescape-message-ids
Merge into: lp:indicator-messages/15.04
Diff against target: 123 lines (+46/-15)
2 files modified
src/im-application-list.c (+29/-15)
tests/manual (+17/-0)
To merge this branch: bzr merge lp:~ted/indicator-messages/lp1385331-unescape-message-ids
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+250235@code.launchpad.net

Commit message

Provide functions that allow for action names directly

Description of the change

Now with escaping and unescaping we need two sets of functions here, one that can handle the unescaped names and one that can handle the action names directly. This adds that and puts the right ones in the right places.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
439. By Ted Gould

Adding a manual test case for a Tweet

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

Looks good to me, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/im-application-list.c'
2--- src/im-application-list.c 2015-01-26 19:04:11 +0000
3+++ src/im-application-list.c 2015-02-19 03:12:28 +0000
4@@ -343,6 +343,17 @@
5 return was_drawing_attention != app->draws_attention;
6 }
7
8+static void
9+im_application_list_source_removed_action (Application *app,
10+ const gchar *action_name)
11+{
12+ g_action_map_remove_action (G_ACTION_MAP(app->source_actions), action_name);
13+ g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, action_name);
14+
15+ if (application_update_draws_attention(app))
16+ im_application_list_update_root_action (app->list);
17+}
18+
19 /* Remove a source from an application, signal up and update the status
20 of the draws attention flag. */
21 static void
22@@ -353,11 +364,7 @@
23
24 action_name = escape_action_name (id);
25
26- g_action_map_remove_action (G_ACTION_MAP(app->source_actions), action_name);
27- g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, action_name);
28-
29- if (application_update_draws_attention(app))
30- im_application_list_update_root_action (app->list);
31+ im_application_list_source_removed_action (app, action_name);
32
33 g_free (action_name);
34 }
35@@ -389,19 +396,15 @@
36 app->cancellable, NULL, NULL);
37 }
38
39- im_application_list_source_removed (app, action_name);
40+ im_application_list_source_removed_action (app, action_name);
41
42 g_free (source_id);
43 }
44
45 static void
46-im_application_list_message_removed (Application *app,
47- const gchar *id)
48+im_application_list_message_removed_action (Application *app,
49+ const gchar *action_name)
50 {
51- gchar *action_name;
52-
53- action_name = escape_action_name (id);
54-
55 g_action_map_remove_action (G_ACTION_MAP(app->message_actions), action_name);
56 g_action_muxer_remove (app->message_sub_actions, action_name);
57
58@@ -409,6 +412,17 @@
59 im_application_list_update_root_action (app->list);
60
61 g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, action_name);
62+}
63+
64+static void
65+im_application_list_message_removed (Application *app,
66+ const gchar *id)
67+{
68+ gchar *action_name;
69+
70+ action_name = escape_action_name (id);
71+
72+ im_application_list_message_removed_action(app, action_name);
73
74 g_free (action_name);
75 }
76@@ -442,7 +456,7 @@
77 app->cancellable, NULL, NULL);
78 }
79
80- im_application_list_message_removed (app, action_name);
81+ im_application_list_message_removed_action (app, action_name);
82
83 g_free (message_id);
84 }
85@@ -498,11 +512,11 @@
86
87 source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));
88 for (it = source_actions; *it; it++)
89- im_application_list_source_removed (app, *it);
90+ im_application_list_source_removed_action (app, *it);
91
92 message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));
93 for (it = message_actions; *it; it++)
94- im_application_list_message_removed (app, *it);
95+ im_application_list_message_removed_action (app, *it);
96
97 if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */
98 {
99
100=== modified file 'tests/manual'
101--- tests/manual 2014-10-10 15:22:50 +0000
102+++ tests/manual 2015-02-19 03:12:28 +0000
103@@ -61,3 +61,20 @@
104 <dt>Clear the message in the greeter</dt>
105 <dd>The message should no longer be in the messaging menu</dd>
106 </dl>
107+
108+Test-case indicator-messages/push-message-twitter
109+<dl>
110+ <dt>From a shell prompt send a simultated Twitter push notification</dt>
111+ <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>
112+ <dd>The messaging envelope on the panel should change to highlight a message</dd>
113+ <dt>Open the messaging menu</dt>
114+ <dd>The menu should contain an entry with the Twitter icon for the application</dd>
115+ <dd>The title of the message should be 'yes'</dd>
116+ <dd>The body of the message should be 'hello'</dd>
117+ <dd>At the bottom of them menu there should be a 'Clear All' menu item</dd>
118+ <dt>Clear the message using the 'Clear All' command</dt>
119+ <dd>The Twitter message should disappear</dd>
120+ <dd>The 'Clear All' item should disappear</dd>
121+ <dd>The icon in the panel should return to its original state</dd>
122+</dl>
123+

Subscribers

People subscribed via source and target branches