diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app-section.c | 27 | ||||
-rw-r--r-- | src/ido-detail-label.c | 17 | ||||
-rw-r--r-- | src/ido-menu-item.c | 16 | ||||
-rw-r--r-- | src/im-app-menu-item.c | 5 | ||||
-rw-r--r-- | src/messages-service.c | 2 |
5 files changed, 55 insertions, 12 deletions
diff --git a/src/app-section.c b/src/app-section.c index 6aac52a..1106c62 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> @@ -290,6 +291,17 @@ app_section_finalize (GObject *object) G_OBJECT_CLASS (app_section_parent_class)->dispose (object); } +static GAppLaunchContext * +get_launch_context (guint32 timestamp) +{ + GdkDisplay *display = gdk_display_get_default(); + GdkAppLaunchContext *launch_context = gdk_display_get_app_launch_context (display); + + gdk_app_launch_context_set_timestamp (launch_context, timestamp); + + return G_APP_LAUNCH_CONTEXT (launch_context); +} + /* Respond to one of the shortcuts getting clicked on. */ static void nick_activate_cb (GSimpleAction *action, @@ -302,10 +314,14 @@ nick_activate_cb (GSimpleAction *action, g_return_if_fail(priv->ids != NULL); - if (!indicator_desktop_shortcuts_nick_exec(priv->ids, nick)) { + GAppLaunchContext *context = get_launch_context (g_variant_get_uint32 (param)); + + if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, context)) { g_warning("Unable to execute nick '%s' for desktop file '%s'", nick, g_desktop_app_info_get_filename (priv->appinfo)); } + + g_object_unref (context); } static void @@ -390,7 +406,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)); @@ -415,7 +431,7 @@ app_section_update_menu (AppSection *self) name = indicator_desktop_shortcuts_nick_get_name(priv->ids, nicks[i]); - action = g_simple_action_new (nicks[i], NULL); + action = g_simple_action_new (nicks[i], G_VARIANT_TYPE_UINT32); g_signal_connect(action, "activate", G_CALLBACK (nick_activate_cb), self); g_simple_action_group_insert (priv->static_shortcuts, G_ACTION (action)); g_object_unref (action); @@ -506,13 +522,16 @@ activate_cb (GSimpleAction *action, AppSection * mi = APP_SECTION (userdata); AppSectionPrivate * priv = mi->priv; GError *error = NULL; + GAppLaunchContext *launch_context = get_launch_context (g_variant_get_uint32 (param)); - if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, NULL, &error)) { + if (!g_app_info_launch (G_APP_INFO (priv->appinfo), NULL, 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/ido-detail-label.c b/src/ido-detail-label.c index 780a2dd..8b7ef90 100644 --- a/src/ido-detail-label.c +++ b/src/ido-detail-label.c @@ -138,14 +138,19 @@ static PangoFontMetrics * gtk_widget_get_font_metrics (GtkWidget *widget, PangoContext *context) { - const PangoFontDescription *font; + PangoFontDescription *font; + PangoFontMetrics *metrics; + + gtk_style_context_get (gtk_widget_get_style_context (widget), + gtk_widget_get_state_flags (widget), + "font", &font, NULL); - font = gtk_style_context_get_font (gtk_widget_get_style_context (widget), - gtk_widget_get_state_flags (widget)); + metrics = pango_context_get_metrics (context, + font, + pango_context_get_language (context)); - return pango_context_get_metrics (context, - font, - pango_context_get_language (context)); + pango_font_description_free (font); + return metrics; } static gint diff --git a/src/ido-menu-item.c b/src/ido-menu-item.c index 32044ff..f702828 100644 --- a/src/ido-menu-item.c +++ b/src/ido-menu-item.c @@ -282,10 +282,24 @@ static void ido_menu_item_activate (GtkMenuItem *item) { IdoMenuItemPrivate *priv = IDO_MENU_ITEM (item)->priv; + GVariant *parameter; /* see ido_menu_item_set_active */ if (!priv->in_set_active && priv->action && priv->action_group) - g_action_group_activate_action (priv->action_group, priv->action, priv->target); + { + guint32 event_time = gtk_get_current_event_time (); + + if (priv->target) + { + parameter = priv->target; + } + else + { + parameter = g_variant_new_uint32 (event_time); + } + + g_action_group_activate_action (priv->action_group, priv->action, parameter); + } if (priv->in_set_active) GTK_MENU_ITEM_CLASS (ido_menu_item_parent_class)->activate (item); diff --git a/src/im-app-menu-item.c b/src/im-app-menu-item.c index a204631..03b11c2 100644 --- a/src/im-app-menu-item.c +++ b/src/im-app-menu-item.c @@ -238,7 +238,10 @@ im_app_menu_item_activate (GtkMenuItem *item) ImAppMenuItemPrivate *priv = IM_APP_MENU_ITEM (item)->priv; if (priv->action && priv->action_group) - g_action_group_activate_action (priv->action_group, priv->action, NULL); + { + guint32 event_time = gtk_get_current_event_time (); + g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32 (event_time)); + } } static void diff --git a/src/messages-service.c b/src/messages-service.c index e48e3f8..25a19b9 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> @@ -645,6 +646,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 */ |