Merge lp:~3v1n0/indicator-messages/launch-app-with-timestamp into lp:indicator-messages/13.04

Proposed by Marco Trevisan (Treviño) on 2013-04-03
Status: Merged
Approved by: Mathieu Trudel-Lapierre on 2013-04-04
Approved revision: 340
Merged at revision: 339
Proposed branch: lp:~3v1n0/indicator-messages/launch-app-with-timestamp
Merge into: lp:indicator-messages/13.04
Diff against target: 78 lines (+16/-4)
3 files modified
src/app-section.c (+10/-3)
src/im-app-menu-item.c (+4/-1)
src/messages-service.c (+2/-0)
To merge this branch: bzr merge lp:~3v1n0/indicator-messages/launch-app-with-timestamp
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration 2013-04-03 Approve on 2013-04-04
Mathieu Trudel-Lapierre 2013-04-03 Approve on 2013-04-04
Review via email: mp+156922@code.launchpad.net

This proposal supersedes a proposal from 2013-04-03.

Commit message

AppSection: use the GAppLaunchContext with event timestamp when launching an app

Description of the change

When launching an application with GAppInfo, we need to set the launch context timestamp in order to make the Window Manager to correctly focus the applications if needed.

Empathy fix to work with this: lp:~3v1n0/empathy/empathy-activate-with-platform-data/+merge/156913

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Mathieu Trudel-Lapierre (cyphermox) wrote :

Approve, looks fine.

review: Approve
Mathieu Trudel-Lapierre (cyphermox) wrote : Posted in a previous version of this proposal

Approve.

review: Approve
review: Approve (continuous-integration)

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 2012-09-18 19:54:37 +0000
3+++ src/app-section.c 2013-04-03 17:28:32 +0000
4@@ -25,6 +25,7 @@
5 #include "config.h"
6 #endif
7
8+#include <gdk/gdk.h>
9 #include <glib/gi18n.h>
10 #include <gio/gdesktopappinfo.h>
11 #include <gio/gio.h>
12@@ -390,7 +391,7 @@
13 g_simple_action_group_clear (priv->static_shortcuts);
14
15 is_running = priv->name_watch_id > 0;
16- launch = g_simple_action_new_stateful ("launch", NULL, g_variant_new_boolean (is_running));
17+ launch = g_simple_action_new_stateful ("launch", G_VARIANT_TYPE_UINT32, g_variant_new_boolean (is_running));
18 g_signal_connect (launch, "activate", G_CALLBACK (activate_cb), self);
19 g_signal_connect (launch, "change-state", G_CALLBACK (launch_action_change_state), self);
20 g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (launch));
21@@ -506,13 +507,19 @@
22 AppSection * mi = APP_SECTION (userdata);
23 AppSectionPrivate * priv = mi->priv;
24 GError *error = NULL;
25-
26- if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, NULL, &error)) {
27+ GdkDisplay *display = gdk_display_get_default();
28+ GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
29+
30+ gdk_app_launch_context_set_timestamp (launch_context, g_variant_get_uint32 (param));
31+
32+ if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) {
33 g_warning("Unable to execute application for desktop file '%s': %s",
34 g_desktop_app_info_get_filename (priv->appinfo),
35 error->message);
36 g_error_free (error);
37 }
38+
39+ g_object_unref (launch_context);
40 }
41
42 static void
43
44=== modified file 'src/im-app-menu-item.c'
45--- src/im-app-menu-item.c 2012-08-27 14:42:05 +0000
46+++ src/im-app-menu-item.c 2013-04-03 17:28:32 +0000
47@@ -238,7 +238,10 @@
48 ImAppMenuItemPrivate *priv = IM_APP_MENU_ITEM (item)->priv;
49
50 if (priv->action && priv->action_group)
51- g_action_group_activate_action (priv->action_group, priv->action, NULL);
52+ {
53+ guint32 event_time = gtk_get_current_event_time ();
54+ g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32(event_time));
55+ }
56 }
57
58 static void
59
60=== modified file 'src/messages-service.c'
61--- src/messages-service.c 2013-01-22 20:23:57 +0000
62+++ src/messages-service.c 2013-04-03 17:28:32 +0000
63@@ -24,6 +24,7 @@
64 #include <config.h>
65 #include <locale.h>
66 #include <libindicator/indicator-service.h>
67+#include <gdk/gdk.h>
68 #include <gio/gio.h>
69 #include <gio/gdesktopappinfo.h>
70 #include <glib/gi18n.h>
71@@ -622,6 +623,7 @@
72 GMainLoop * mainloop;
73 IndicatorService * service;
74
75+ gdk_init(&argc, &argv);
76 mainloop = g_main_loop_new (NULL, FALSE);
77
78 /* Create the Indicator Service interface */

Subscribers

People subscribed via source and target branches