From 156418b432ed3d7f07fd0faae67ce5054defe94a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 22 Jan 2013 14:23:57 -0600 Subject: remove g_type_init() calls, bump glib requirement to 2.35.4 --- src/messages-service.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/messages-service.c b/src/messages-service.c index b36a0a2..48c830e 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -619,11 +619,8 @@ got_bus (GObject *object, int main (int argc, char ** argv) { - GMainLoop * mainloop = NULL; - IndicatorService * service = NULL; - - /* Glib init */ - g_type_init(); + GMainLoop * mainloop; + IndicatorService * service; mainloop = g_main_loop_new (NULL, FALSE); -- cgit v1.2.3 From 8249e264e0f426d6702d21a690477be495045f90 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Tue, 19 Feb 2013 19:21:43 -0500 Subject: Notify the service when an app unrefs its MessagingMenuApp Prior to this patch, the messaging menu only marked apps as "not running" when they quit (i.e. disappeared from the bus). This was okay, since most applications only ever release the ref to their MessagingMenuApp when they quit, or after calling _unregister explicitely (which removes them from the menu entirely). However, this is according to libmessagingmenu's documentation, and at least indicator-telepathy relies on it. --- src/messages-service.c | 25 +++++++++++++++++++++++++ src/messages-service.xml | 4 ++++ 2 files changed, 29 insertions(+) (limited to 'src') diff --git a/src/messages-service.c b/src/messages-service.c index 48c830e..e48e3f8 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -472,6 +472,29 @@ unregister_application (IndicatorMessagesService *service, indicator_messages_service_complete_unregister_application (service, invocation); } +static void +application_stopped_running (IndicatorMessagesService *service, + GDBusMethodInvocation *invocation, + const gchar *desktop_id, + gpointer user_data) +{ + GDesktopAppInfo *appinfo; + gchar *id; + AppSection *section; + + indicator_messages_service_complete_application_stopped_running (service, invocation); + + if (!(appinfo = g_desktop_app_info_new (desktop_id))) + return; + + id = g_app_info_get_simple_id (G_APP_INFO (appinfo)); + section = g_hash_table_lookup (applications, id); + app_section_unset_object_path (section); + + g_free (id); + g_object_unref (appinfo); +} + static void set_status (IndicatorMessagesService *service, GDBusMethodInvocation *invocation, @@ -648,6 +671,8 @@ main (int argc, char ** argv) G_CALLBACK (register_application), NULL); g_signal_connect (messages_service, "handle-unregister-application", G_CALLBACK (unregister_application), NULL); + g_signal_connect (messages_service, "handle-application-stopped-running", + G_CALLBACK (application_stopped_running), NULL); g_signal_connect (messages_service, "handle-set-status", G_CALLBACK (set_status), NULL); diff --git a/src/messages-service.xml b/src/messages-service.xml index 00ae154..3c3c779 100644 --- a/src/messages-service.xml +++ b/src/messages-service.xml @@ -11,6 +11,10 @@ + + + + -- cgit v1.2.3 From 39fc49c52e23b9bb0964fc90716e63a3a4129c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 3 Apr 2013 17:38:07 +0200 Subject: ImAppMenu: pass the event timestamp when activating the item --- src/im-app-menu-item.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/im-app-menu-item.c b/src/im-app-menu-item.c index a204631..afd21be 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 -- cgit v1.2.3 From 23d93b9cf3dceac06f26bf741f9128d556244cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 3 Apr 2013 17:40:56 +0200 Subject: AppSection: use the GAppLaunchContext with event timestamp when launching an app --- src/app-section.c | 11 +++++++++-- src/messages-service.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') 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 . #include "config.h" #endif +#include #include #include #include @@ -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 . #include #include #include +#include #include #include #include @@ -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 */ -- cgit v1.2.3 From 35bf2c9320e7c62a574e80b3ed463c110dce7060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=27sil2100=27=20Zemczak?= Date: Mon, 22 Apr 2013 10:45:52 +0200 Subject: indicator_desktop_shortcuts_nick_exec() is deprecated, use indicator_desktop_shortcuts_nick_exec_with_context() with a NULL context instead - fixes the FTBFS --- src/app-section.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/app-section.c b/src/app-section.c index 93f59a2..474e700 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -303,7 +303,7 @@ nick_activate_cb (GSimpleAction *action, g_return_if_fail(priv->ids != NULL); - if (!indicator_desktop_shortcuts_nick_exec(priv->ids, nick)) { + if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, NULL)) { g_warning("Unable to execute nick '%s' for desktop file '%s'", nick, g_desktop_app_info_get_filename (priv->appinfo)); } -- cgit v1.2.3 From 3cabcaefd84a4ff980d0d2160df099c573d467b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 22 Apr 2013 17:26:08 +0200 Subject: IdoMenuItem: pass event timestamp to the action if we have no status change --- src/ido-menu-item.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3 From 6a3dad7dbe2004c8b3c92f914b01e181b5adb646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 22 Apr 2013 17:26:51 +0200 Subject: AppSection: use LaunchContext to exec shortcut nicks --- src/app-section.c | 26 +++++++++++++++++++------- src/im-app-menu-item.c | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/app-section.c b/src/app-section.c index 474e700..1106c62 100644 --- a/src/app-section.c +++ b/src/app-section.c @@ -291,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, @@ -303,10 +314,14 @@ nick_activate_cb (GSimpleAction *action, g_return_if_fail(priv->ids != NULL); - if (!indicator_desktop_shortcuts_nick_exec_with_context(priv->ids, nick, NULL)) { + 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 @@ -416,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); @@ -507,12 +522,9 @@ 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); - - gdk_app_launch_context_set_timestamp (launch_context, g_variant_get_uint32 (param)); + GAppLaunchContext *launch_context = get_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)) { + 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); diff --git a/src/im-app-menu-item.c b/src/im-app-menu-item.c index afd21be..03b11c2 100644 --- a/src/im-app-menu-item.c +++ b/src/im-app-menu-item.c @@ -240,7 +240,7 @@ im_app_menu_item_activate (GtkMenuItem *item) if (priv->action && priv->action_group) { guint32 event_time = gtk_get_current_event_time (); - g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32(event_time)); + g_action_group_activate_action (priv->action_group, priv->action, g_variant_new_uint32 (event_time)); } } -- cgit v1.2.3 From bc3c2d1d5b6cf8ad2c6b4a64f41361a248f89d90 Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Tue, 28 May 2013 19:05:11 +0200 Subject: use gtk_style_context_get instead of deprecated gtk_style_context_get_font --- src/ido-detail-label.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ido-detail-label.c b/src/ido-detail-label.c index 780a2dd..9a163b7 100644 --- a/src/ido-detail-label.c +++ b/src/ido-detail-label.c @@ -140,8 +140,9 @@ gtk_widget_get_font_metrics (GtkWidget *widget, { const PangoFontDescription *font; - font = gtk_style_context_get_font (gtk_widget_get_style_context (widget), - gtk_widget_get_state_flags (widget)); + gtk_style_context_get (gtk_widget_get_style_context (widget), + gtk_widget_get_state_flags (widget), + "font", &font, NULL); return pango_context_get_metrics (context, font, -- cgit v1.2.3 From ebcad53cbfe52dc19462cd6021fe676b493b7a83 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Wed, 29 May 2013 09:55:39 -0400 Subject: ido-detail-label.c: free font desc --- src/ido-detail-label.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ido-detail-label.c b/src/ido-detail-label.c index 9a163b7..8b7ef90 100644 --- a/src/ido-detail-label.c +++ b/src/ido-detail-label.c @@ -138,15 +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); - return pango_context_get_metrics (context, - font, - pango_context_get_language (context)); + metrics = pango_context_get_metrics (context, + font, + pango_context_get_language (context)); + + pango_font_description_free (font); + return metrics; } static gint -- cgit v1.2.3 From 8c3a1e90bf6453b7917bd4aad9e2136f0b30edeb Mon Sep 17 00:00:00 2001 From: Mathias Dietrich Date: Fri, 28 Jun 2013 12:41:38 +0200 Subject: Change abbreviation for minutes from m to min --- src/im-source-menu-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/im-source-menu-item.c b/src/im-source-menu-item.c index 775fa91..2577c30 100644 --- a/src/im-source-menu-item.c +++ b/src/im-source-menu-item.c @@ -95,7 +95,7 @@ im_source_menu_item_time_span_string (gint64 timestamp) if (hours == 0) { /* TRANSLATORS: number of minutes that have passed */ - str = g_strdup_printf (ngettext ("%d m", "%d m", minutes), minutes); + str = g_strdup_printf (ngettext ("%d min", "%d min", minutes), minutes); } else { -- cgit v1.2.3