From d0e1bf194504adc68a87423c74b8dbb3896be87a Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Tue, 21 Aug 2012 17:23:15 +0200 Subject: libmessaging-menu: fix export-symbols-regex --- libmessaging-menu/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/Makefile.am b/libmessaging-menu/Makefile.am index 187e6dc..d0f941f 100644 --- a/libmessaging-menu/Makefile.am +++ b/libmessaging-menu/Makefile.am @@ -18,7 +18,7 @@ libmessaging_menu_la_CFLAGS = \ $(GIO_CFLAGS) \ -Wall -libmessaging_menu_la_LDFLAGS = -export-symbols-regex="^messaging_menu_.*" +libmessaging_menu_la_LDFLAGS = -export-symbols-regex "^messaging_menu_.*" BUILT_SOURCES = \ indicator-messages-service.c \ -- cgit v1.2.3 From 52875e80b988a7f0c5af3d4ebe720917f93c873d Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 23 Aug 2012 10:37:04 +0200 Subject: libmessaging-menu: warn when desktop_id is NULL (instead of crashing) --- libmessaging-menu/messaging-menu.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index 336e89c..b8aaf20 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -74,6 +74,21 @@ static void global_status_changed (IndicatorMessagesService *service, const gchar *status_str, gpointer user_data); +static void +messaging_menu_app_set_desktop_id (MessagingMenuApp *app, + const gchar *desktop_id) +{ + g_return_if_fail (desktop_id != NULL); + + /* no need to clean up, it's construct only */ + app->appinfo = g_desktop_app_info_new (desktop_id); + if (app->appinfo == NULL) + { + g_warning ("could not find the desktop file for '%s'", + desktop_id); + } +} + static void messaging_menu_app_set_property (GObject *object, guint prop_id, @@ -85,12 +100,7 @@ messaging_menu_app_set_property (GObject *object, switch (prop_id) { case PROP_DESKTOP_ID: - app->appinfo = g_desktop_app_info_new (g_value_get_string (value)); - if (app->appinfo == NULL) - { - g_warning ("could not find the desktop file for '%s'", - g_value_get_string (value)); - } + messaging_menu_app_set_desktop_id (app, g_value_get_string (value)); break; default: -- cgit v1.2.3 From dd134484da92096b4116cdfb88c36756bf234722 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 23 Aug 2012 10:41:15 +0200 Subject: libmessaging-menu: annotate icon parameters with allow-none --- libmessaging-menu/messaging-menu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index b8aaf20..78fff20 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -511,7 +511,7 @@ messaging_menu_app_insert_source (MessagingMenuApp *app, * messaging_menu_app_append_source: * @app: a #MessagingMenuApp * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * * Appends a new message source to the end of the section representing @app. @@ -535,7 +535,7 @@ messaging_menu_app_append_source (MessagingMenuApp *app, * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @count: the count for the source * @@ -563,7 +563,7 @@ messaging_menu_app_insert_source_with_count (MessagingMenuApp *app, * messaging_menu_app_append_source_with_count: * @app: a #MessagingMenuApp * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @count: the count for the source * @@ -589,7 +589,7 @@ void messaging_menu_app_append_source_with_count (MessagingMenuApp *app, * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @time: the time when the source was created * @@ -618,7 +618,7 @@ messaging_menu_app_insert_source_with_time (MessagingMenuApp *app, * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @time: the time when the source was created * @@ -645,7 +645,7 @@ messaging_menu_app_append_source_with_time (MessagingMenuApp *app, * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @str: a string associated with the source * @@ -674,7 +674,7 @@ messaging_menu_app_insert_source_with_string (MessagingMenuApp *app, * @app: a #MessagingMenuApp * @position: the position at which to insert the source * @id: a unique identifier for the source to be added - * @icon: the icon associated with the source + * @icon: (allow-none): the icon associated with the source * @label: a user-visible string best describing the source * @str: a string associated with the source * -- cgit v1.2.3 From d519ebfb52d69765f4e1ec0aa3f115f2c04c9bb4 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 23 Aug 2012 12:20:21 +0200 Subject: libmessaging-menu: remove sources when they are activated Applications shouldn't leave message sources that the user clicked on in the messaging menu. This patch spares apps from having to call remove_source in all of their handlers. --- libmessaging-menu/messaging-menu.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index 78fff20..daeaeb5 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -419,6 +419,8 @@ source_action_activated (GTupleAction *action, const gchar *name = g_action_get_name (G_ACTION (action)); GQuark q = g_quark_from_string (name); + messaging_menu_app_remove_source (app, name); + g_signal_emit (app, signals[ACTIVATE_SOURCE], q, name); } -- cgit v1.2.3 From 95aa2195c3e7e5873a1508e77b8305cf92e2215b Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Thu, 23 Aug 2012 12:23:24 +0200 Subject: libmessaging-menu: don't warn when removing a non-existant source --- libmessaging-menu/messaging-menu.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'libmessaging-menu') diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index daeaeb5..69fb3b7 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -716,10 +716,7 @@ messaging_menu_app_remove_source (MessagingMenuApp *app, g_return_if_fail (source_id != NULL); if (g_simple_action_group_lookup (app->source_actions, source_id) == NULL) - { - g_warning ("%s: a source with id '%s' doesn't exist", G_STRFUNC, source_id); return; - } n_items = g_menu_model_get_n_items (G_MENU_MODEL (app->menu)); for (i = 0; i < n_items; i++) -- cgit v1.2.3