Merge lp:~3v1n0/indicator-messages/shortcut-nicks-context into lp:~indicator-applet-developers/indicator-messages/trunk.13.10

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Mathieu Trudel-Lapierre
Approved revision: 342
Merged at revision: 341
Proposed branch: lp:~3v1n0/indicator-messages/shortcut-nicks-context
Merge into: lp:~indicator-applet-developers/indicator-messages/trunk.13.10
Diff against target: 104 lines (+36/-10)
3 files modified
src/app-section.c (+20/-8)
src/ido-menu-item.c (+15/-1)
src/im-app-menu-item.c (+1/-1)
To merge this branch: bzr merge lp:~3v1n0/indicator-messages/shortcut-nicks-context
Reviewer Review Type Date Requested Status
Mathieu Trudel-Lapierre Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+160142@code.launchpad.net

Commit message

AppSection: Use the Launch Context with proper activate event timestamp to exec the libindicator shortcut nicks.

Description of the change

Use the Launch Context with proper activate event timestamp to exec the libindicator shortcut nicks.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/app-section.c'
--- src/app-section.c 2013-04-22 08:45:52 +0000
+++ src/app-section.c 2013-04-22 15:30:36 +0000
@@ -291,6 +291,17 @@
291 G_OBJECT_CLASS (app_section_parent_class)->dispose (object);291 G_OBJECT_CLASS (app_section_parent_class)->dispose (object);
292}292}
293293
294static GAppLaunchContext *
295get_launch_context (guint32 timestamp)
296{
297 GdkDisplay *display = gdk_display_get_default();
298 GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
299
300 gdk_app_launch_context_set_timestamp (launch_context, timestamp);
301
302 return G_APP_LAUNCH_CONTEXT (launch_context);
303}
304
294/* Respond to one of the shortcuts getting clicked on. */305/* Respond to one of the shortcuts getting clicked on. */
295static void306static void
296nick_activate_cb (GSimpleAction *action,307nick_activate_cb (GSimpleAction *action,
@@ -303,10 +314,14 @@
303314
304 g_return_if_fail(priv->ids != NULL);315 g_return_if_fail(priv->ids != NULL);
305316
306 if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, NULL)) {317 GAppLaunchContext *context = get_launch_context (g_variant_get_uint32 (param));
318
319 if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, context)) {
307 g_warning("Unable to execute nick '%s' for desktop file '%s'",320 g_warning("Unable to execute nick '%s' for desktop file '%s'",
308 nick, g_desktop_app_info_get_filename (priv->appinfo));321 nick, g_desktop_app_info_get_filename (priv->appinfo));
309 }322 }
323
324 g_object_unref (context);
310}325}
311326
312static void327static void
@@ -416,7 +431,7 @@
416431
417 name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]);432 name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]);
418433
419 action = g_simple_action_new (nicks[i], NULL);434 action = g_simple_action_new (nicks[i], G_VARIANT_TYPE_UINT32);
420 g_signal_connect(action, "activate", G_CALLBACK (nick_activate_cb), self);435 g_signal_connect(action, "activate", G_CALLBACK (nick_activate_cb), self);
421 g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (action));436 g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (action));
422 g_object_unref (action);437 g_object_unref (action);
@@ -507,12 +522,9 @@
507 AppSection * mi = APP_SECTION (userdata);522 AppSection * mi = APP_SECTION (userdata);
508 AppSectionPrivate * priv = mi->priv;523 AppSectionPrivate * priv = mi->priv;
509 GError *error = NULL;524 GError *error = NULL;
510 GdkDisplay *display = gdk_display_get_default();525 GAppLaunchContext *launch_context = get_launch_context (g_variant_get_uint32 (param));
511 GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);526
512527 if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, launch_context, &error)) {
513 gdk_app_launch_context_set_timestamp (launch_context, g_variant_get_uint32 (param));
514
515 if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) {
516 g_warning("Unable to execute application for desktop file '%s': %s",528 g_warning("Unable to execute application for desktop file '%s': %s",
517 g_desktop_app_info_get_filename (priv->appinfo),529 g_desktop_app_info_get_filename (priv->appinfo),
518 error->message);530 error->message);
519531
=== modified file 'src/ido-menu-item.c'
--- src/ido-menu-item.c 2012-09-18 19:54:37 +0000
+++ src/ido-menu-item.c 2013-04-22 15:30:36 +0000
@@ -282,10 +282,24 @@
282ido_menu_item_activate (GtkMenuItem *item)282ido_menu_item_activate (GtkMenuItem *item)
283{283{
284 IdoMenuItemPrivate *priv = IDO_MENU_ITEM (item)->priv;284 IdoMenuItemPrivate *priv = IDO_MENU_ITEM (item)->priv;
285 GVariant *parameter;
285286
286 /* see ido_menu_item_set_active */287 /* see ido_menu_item_set_active */
287 if (!priv->in_set_active && priv->action && priv->action_group)288 if (!priv->in_set_active && priv->action && priv->action_group)
288 g_action_group_activate_action (priv->action_group, priv->action, priv->target);289 {
290 guint32 event_time = gtk_get_current_event_time ();
291
292 if (priv->target)
293 {
294 parameter = priv->target;
295 }
296 else
297 {
298 parameter = g_variant_new_uint32 (event_time);
299 }
300
301 g_action_group_activate_action (priv->action_group, priv->action, parameter);
302 }
289303
290 if (priv->in_set_active)304 if (priv->in_set_active)
291 GTK_MENU_ITEM_CLASS (ido_menu_item_parent_class)->activate (item);305 GTK_MENU_ITEM_CLASS (ido_menu_item_parent_class)->activate (item);
292306
=== modified file 'src/im-app-menu-item.c'
--- src/im-app-menu-item.c 2013-04-03 15:38:07 +0000
+++ src/im-app-menu-item.c 2013-04-22 15:30:36 +0000
@@ -240,7 +240,7 @@
240 if (priv->action && priv->action_group)240 if (priv->action && priv->action_group)
241 {241 {
242 guint32 event_time = gtk_get_current_event_time ();242 guint32 event_time = gtk_get_current_event_time ();
243 g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32(event_time));243 g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32 (event_time));
244 }244 }
245}245}
246246

Subscribers

People subscribed via source and target branches