aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-04-03 17:40:56 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-04-03 17:40:56 +0200
commit23d93b9cf3dceac06f26bf741f9128d556244cbc (patch)
tree14eb378890366c748637c3fc620562e486582ba2 /src
parent39fc49c52e23b9bb0964fc90716e63a3a4129c38 (diff)
downloadayatana-indicator-messages-23d93b9cf3dceac06f26bf741f9128d556244cbc.tar.gz
ayatana-indicator-messages-23d93b9cf3dceac06f26bf741f9128d556244cbc.tar.bz2
ayatana-indicator-messages-23d93b9cf3dceac06f26bf741f9128d556244cbc.zip
AppSection: use the GAppLaunchContext with event timestamp when launching an app
Diffstat (limited to 'src')
-rw-r--r--src/app-section.c11
-rw-r--r--src/messages-service.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/src/app-section.c b/src/app-section.c
index 6aac52a..93f59a2 100644
--- a/src/app-section.c
+++ b/src/app-section.c
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config.h"
#endif
+#include <gdk/gdk.h>
#include <glib/gi18n.h>
#include <gio/gdesktopappinfo.h>
#include <gio/gio.h>
@@ -390,7 +391,7 @@ app_section_update_menu (AppSection *self)
g_simple_action_group_clear (priv->static_shortcuts);
is_running = priv->name_watch_id > 0;
- launch = g_simple_action_new_stateful ("launch", NULL, g_variant_new_boolean (is_running));
+ launch = g_simple_action_new_stateful ("launch", G_VARIANT_TYPE_UINT32, g_variant_new_boolean (is_running));
g_signal_connect (launch, "activate", G_CALLBACK (activate_cb), self);
g_signal_connect (launch, "change-state", G_CALLBACK (launch_action_change_state), self);
g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (launch));
@@ -506,13 +507,19 @@ activate_cb (GSimpleAction *action,
AppSection * mi = APP_SECTION (userdata);
AppSectionPrivate * priv = mi->priv;
GError *error = NULL;
+ GdkDisplay *display = gdk_display_get_default();
+ GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display);
- if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, NULL, &error)) {
+ gdk_app_launch_context_set_timestamp (launch_context, g_variant_get_uint32 (param));
+
+ if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error)) {
g_warning("Unable to execute application for desktop file '%s': %s",
g_desktop_app_info_get_filename (priv->appinfo),
error->message);
g_error_free (error);
}
+
+ g_object_unref (launch_context);
}
static void
diff --git a/src/messages-service.c b/src/messages-service.c
index 48c830e..f93cf68 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -24,6 +24,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <config.h>
#include <locale.h>
#include <libindicator/indicator-service.h>
+#include <gdk/gdk.h>
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>
#include <glib/gi18n.h>
@@ -622,6 +623,7 @@ main (int argc, char ** argv)
GMainLoop * mainloop;
IndicatorService * service;
+ gdk_init(&argc, &argv);
mainloop = g_main_loop_new (NULL, FALSE);
/* Create the Indicator Service interface */