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

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Mathieu Trudel-Lapierre
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 Approve
Mathieu Trudel-Lapierre Approve
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.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
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 :

Approve, looks fine.

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

Approve.

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

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 2012-09-18 19:54:37 +0000
+++ src/app-section.c 2013-04-03 17:28:32 +0000
@@ -25,6 +25,7 @@
25#include "config.h"25#include "config.h"
26#endif26#endif
2727
28#include <gdk/gdk.h>
28#include <glib/gi18n.h>29#include <glib/gi18n.h>
29#include <gio/gdesktopappinfo.h>30#include <gio/gdesktopappinfo.h>
30#include <gio/gio.h>31#include <gio/gio.h>
@@ -390,7 +391,7 @@
390 g_simple_action_group_clear (priv->static_shortcuts);391 g_simple_action_group_clear (priv->static_shortcuts);
391392
392 is_running = priv->name_watch_id > 0;393 is_running = priv->name_watch_id > 0;
393 launch = g_simple_action_new_stateful ("launch", NULL, g_variant_new_boolean (is_running));394 launch = g_simple_action_new_stateful ("launch", G_VARIANT_TYPE_UINT32, g_variant_new_boolean (is_running));
394 g_signal_connect (launch, "activate", G_CALLBACK (activate_cb), self);395 g_signal_connect (launch, "activate", G_CALLBACK (activate_cb), self);
395 g_signal_connect (launch, "change-state", G_CALLBACK (launch_action_change_state), self);396 g_signal_connect (launch, "change-state", G_CALLBACK (launch_action_change_state), self);
396 g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (launch));397 g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (launch));
@@ -506,13 +507,19 @@
506 AppSection * mi = APP_SECTION (userdata);507 AppSection * mi = APP_SECTION (userdata);
507 AppSectionPrivate * priv = mi->priv;508 AppSectionPrivate * priv = mi->priv;
508 GError *error = NULL;509 GError *error = NULL;
509510 GdkDisplay *display = gdk_display_get_default();
510 if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, NULL, &error)) {511 GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
512
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)) {
511 g_warning("Unable to execute application for desktop file '%s': %s",516 g_warning("Unable to execute application for desktop file '%s': %s",
512 g_desktop_app_info_get_filename (priv->appinfo),517 g_desktop_app_info_get_filename (priv->appinfo),
513 error->message);518 error->message);
514 g_error_free (error);519 g_error_free (error);
515 }520 }
521
522 g_object_unref (launch_context);
516}523}
517524
518static void525static void
519526
=== modified file 'src/im-app-menu-item.c'
--- src/im-app-menu-item.c 2012-08-27 14:42:05 +0000
+++ src/im-app-menu-item.c 2013-04-03 17:28:32 +0000
@@ -238,7 +238,10 @@
238 ImAppMenuItemPrivate *priv = IM_APP_MENU_ITEM (item)->priv;238 ImAppMenuItemPrivate *priv = IM_APP_MENU_ITEM (item)->priv;
239239
240 if (priv->action && priv->action_group)240 if (priv->action && priv->action_group)
241 g_action_group_activate_action (priv->action_group, priv->action, NULL);241 {
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));
244 }
242}245}
243246
244static void247static void
245248
=== modified file 'src/messages-service.c'
--- src/messages-service.c 2013-01-22 20:23:57 +0000
+++ src/messages-service.c 2013-04-03 17:28:32 +0000
@@ -24,6 +24,7 @@
24#include <config.h>24#include <config.h>
25#include <locale.h>25#include <locale.h>
26#include <libindicator/indicator-service.h>26#include <libindicator/indicator-service.h>
27#include <gdk/gdk.h>
27#include <gio/gio.h>28#include <gio/gio.h>
28#include <gio/gdesktopappinfo.h>29#include <gio/gdesktopappinfo.h>
29#include <glib/gi18n.h>30#include <glib/gi18n.h>
@@ -622,6 +623,7 @@
622 GMainLoop * mainloop;623 GMainLoop * mainloop;
623 IndicatorService * service;624 IndicatorService * service;
624625
626 gdk_init(&argc, &argv);
625 mainloop = g_main_loop_new (NULL, FALSE);627 mainloop = g_main_loop_new (NULL, FALSE);
626628
627 /* Create the Indicator Service interface */629 /* Create the Indicator Service interface */

Subscribers

People subscribed via source and target branches