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
=== modified file 'src/im-application-list.c'
--- src/im-application-list.c 2015-01-26 19:04:11 +0000
+++ src/im-application-list.c 2015-02-19 03:12:28 +0000
@@ -343,6 +343,17 @@
343 return was_drawing_attention != app->draws_attention;343 return was_drawing_attention != app->draws_attention;
344}344}
345345
346static void
347im_application_list_source_removed_action (Application *app,
348 const gchar *action_name)
349{
350 g_action_map_remove_action (G_ACTION_MAP(app->source_actions), action_name);
351 g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, action_name);
352
353 if (application_update_draws_attention(app))
354 im_application_list_update_root_action (app->list);
355}
356
346/* Remove a source from an application, signal up and update the status357/* Remove a source from an application, signal up and update the status
347 of the draws attention flag. */358 of the draws attention flag. */
348static void359static void
@@ -353,11 +364,7 @@
353364
354 action_name = escape_action_name (id);365 action_name = escape_action_name (id);
355366
356 g_action_map_remove_action (G_ACTION_MAP(app->source_actions), action_name);367 im_application_list_source_removed_action (app, action_name);
357 g_signal_emit (app->list, signals[SOURCE_REMOVED], 0, app->id, action_name);
358
359 if (application_update_draws_attention(app))
360 im_application_list_update_root_action (app->list);
361368
362 g_free (action_name);369 g_free (action_name);
363}370}
@@ -389,19 +396,15 @@
389 app->cancellable, NULL, NULL);396 app->cancellable, NULL, NULL);
390 }397 }
391398
392 im_application_list_source_removed (app, action_name);399 im_application_list_source_removed_action (app, action_name);
393400
394 g_free (source_id);401 g_free (source_id);
395}402}
396403
397static void404static void
398im_application_list_message_removed (Application *app,405im_application_list_message_removed_action (Application *app,
399 const gchar *id)406 const gchar *action_name)
400{407{
401 gchar *action_name;
402
403 action_name = escape_action_name (id);
404
405 g_action_map_remove_action (G_ACTION_MAP(app->message_actions), action_name);408 g_action_map_remove_action (G_ACTION_MAP(app->message_actions), action_name);
406 g_action_muxer_remove (app->message_sub_actions, action_name);409 g_action_muxer_remove (app->message_sub_actions, action_name);
407410
@@ -409,6 +412,17 @@
409 im_application_list_update_root_action (app->list);412 im_application_list_update_root_action (app->list);
410413
411 g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, action_name);414 g_signal_emit (app->list, signals[MESSAGE_REMOVED], 0, app->id, action_name);
415}
416
417static void
418im_application_list_message_removed (Application *app,
419 const gchar *id)
420{
421 gchar *action_name;
422
423 action_name = escape_action_name (id);
424
425 im_application_list_message_removed_action(app, action_name);
412426
413 g_free (action_name);427 g_free (action_name);
414}428}
@@ -442,7 +456,7 @@
442 app->cancellable, NULL, NULL);456 app->cancellable, NULL, NULL);
443 }457 }
444458
445 im_application_list_message_removed (app, action_name);459 im_application_list_message_removed_action (app, action_name);
446460
447 g_free (message_id);461 g_free (message_id);
448}462}
@@ -498,11 +512,11 @@
498512
499 source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));513 source_actions = g_action_group_list_actions (G_ACTION_GROUP (app->source_actions));
500 for (it = source_actions; *it; it++)514 for (it = source_actions; *it; it++)
501 im_application_list_source_removed (app, *it);515 im_application_list_source_removed_action (app, *it);
502516
503 message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));517 message_actions = g_action_group_list_actions (G_ACTION_GROUP (app->message_actions));
504 for (it = message_actions; *it; it++)518 for (it = message_actions; *it; it++)
505 im_application_list_message_removed (app, *it);519 im_application_list_message_removed_action (app, *it);
506520
507 if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */521 if (app->proxy != NULL) /* If it is remote, we tell the app we've cleared */
508 {522 {
509523
=== modified file 'tests/manual'
--- tests/manual 2014-10-10 15:22:50 +0000
+++ tests/manual 2015-02-19 03:12:28 +0000
@@ -61,3 +61,20 @@
61 <dt>Clear the message in the greeter</dt>61 <dt>Clear the message in the greeter</dt>
62 <dd>The message should no longer be in the messaging menu</dd>62 <dd>The message should no longer be in the messaging menu</dd>
63</dl>63</dl>
64
65Test-case indicator-messages/push-message-twitter
66<dl>
67 <dt>From a shell prompt send a simultated Twitter push notification</dt>
68 <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>
69 <dd>The messaging envelope on the panel should change to highlight a message</dd>
70 <dt>Open the messaging menu</dt>
71 <dd>The menu should contain an entry with the Twitter icon for the application</dd>
72 <dd>The title of the message should be 'yes'</dd>
73 <dd>The body of the message should be 'hello'</dd>
74 <dd>At the bottom of them menu there should be a 'Clear All' menu item</dd>
75 <dt>Clear the message using the 'Clear All' command</dt>
76 <dd>The Twitter message should disappear</dd>
77 <dd>The 'Clear All' item should disappear</dd>
78 <dd>The icon in the panel should return to its original state</dd>
79</dl>
80

Subscribers

People subscribed via source and target branches