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
1=== modified file 'src/app-section.c'
2--- src/app-section.c 2013-04-22 08:45:52 +0000
3+++ src/app-section.c 2013-04-22 15:30:36 +0000
4@@ -291,6 +291,17 @@
5 G_OBJECT_CLASS (app_section_parent_class)->dispose (object);
6 }
7
8+static GAppLaunchContext *
9+get_launch_context (guint32 timestamp)
10+{
11+ GdkDisplay *display = gdk_display_get_default();
12+ GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
13+
14+ gdk_app_launch_context_set_timestamp (launch_context, timestamp);
15+
16+ return G_APP_LAUNCH_CONTEXT (launch_context);
17+}
18+
19 /* Respond to one of the shortcuts getting clicked on. */
20 static void
21 nick_activate_cb (GSimpleAction *action,
22@@ -303,10 +314,14 @@
23
24 g_return_if_fail(priv->ids != NULL);
25
26- if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, NULL)) {
27+ GAppLaunchContext *context = get_launch_context (g_variant_get_uint32 (param));
28+
29+ if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, context)) {
30 g_warning("Unable to execute nick '%s' for desktop file '%s'",
31 nick, g_desktop_app_info_get_filename (priv->appinfo));
32 }
33+
34+ g_object_unref (context);
35 }
36
37 static void
38@@ -416,7 +431,7 @@
39
40 name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]);
41
42- action = g_simple_action_new (nicks[i], NULL);
43+ action = g_simple_action_new (nicks[i], G_VARIANT_TYPE_UINT32);
44 g_signal_connect(action, "activate", G_CALLBACK (nick_activate_cb), self);
45 g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (action));
46 g_object_unref (action);
47@@ -507,12 +522,9 @@
48 AppSection * mi = APP_SECTION (userdata);
49 AppSectionPrivate * priv = mi->priv;
50 GError *error = NULL;
51- GdkDisplay *display = gdk_display_get_default();
52- GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
53-
54- gdk_app_launch_context_set_timestamp (launch_context, g_variant_get_uint32 (param));
55-
56- if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) {
57+ GAppLaunchContext *launch_context = get_launch_context (g_variant_get_uint32 (param));
58+
59+ if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, launch_context, &error)) {
60 g_warning("Unable to execute application for desktop file '%s': %s",
61 g_desktop_app_info_get_filename (priv->appinfo),
62 error->message);
63
64=== modified file 'src/ido-menu-item.c'
65--- src/ido-menu-item.c 2012-09-18 19:54:37 +0000
66+++ src/ido-menu-item.c 2013-04-22 15:30:36 +0000
67@@ -282,10 +282,24 @@
68 ido_menu_item_activate (GtkMenuItem *item)
69 {
70 IdoMenuItemPrivate *priv = IDO_MENU_ITEM (item)->priv;
71+ GVariant *parameter;
72
73 /* see ido_menu_item_set_active */
74 if (!priv->in_set_active && priv->action && priv->action_group)
75- g_action_group_activate_action (priv->action_group, priv->action, priv->target);
76+ {
77+ guint32 event_time = gtk_get_current_event_time ();
78+
79+ if (priv->target)
80+ {
81+ parameter = priv->target;
82+ }
83+ else
84+ {
85+ parameter = g_variant_new_uint32 (event_time);
86+ }
87+
88+ g_action_group_activate_action (priv->action_group, priv->action, parameter);
89+ }
90
91 if (priv->in_set_active)
92 GTK_MENU_ITEM_CLASS (ido_menu_item_parent_class)->activate (item);
93
94=== modified file 'src/im-app-menu-item.c'
95--- src/im-app-menu-item.c 2013-04-03 15:38:07 +0000
96+++ src/im-app-menu-item.c 2013-04-22 15:30:36 +0000
97@@ -240,7 +240,7 @@
98 if (priv->action && priv->action_group)
99 {
100 guint32 event_time = gtk_get_current_event_time ();
101- g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32(event_time));
102+ g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32 (event_time));
103 }
104 }
105

Subscribers

People subscribed via source and target branches