diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-10-24 10:12:41 +0200 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2012-10-24 10:12:41 +0200 |
commit | 583ceac5a302189c69d5def703987e5be7b28ba7 (patch) | |
tree | 98450354192a2523e40ed1cfe4a001757bec9995 | |
parent | e347088b9e4052a037239844e42255f516df305c (diff) | |
download | ayatana-indicator-messages-583ceac5a302189c69d5def703987e5be7b28ba7.tar.gz ayatana-indicator-messages-583ceac5a302189c69d5def703987e5be7b28ba7.tar.bz2 ayatana-indicator-messages-583ceac5a302189c69d5def703987e5be7b28ba7.zip |
messaging_menu_app_set_source_icon: unset x-canonical-icon if NULL is passed
-rw-r--r-- | libmessaging-menu/messaging-menu.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/libmessaging-menu/messaging-menu.c b/libmessaging-menu/messaging-menu.c index 59f93a2..cef5687 100644 --- a/libmessaging-menu/messaging-menu.c +++ b/libmessaging-menu/messaging-menu.c @@ -1033,7 +1033,7 @@ messaging_menu_app_set_source_label (MessagingMenuApp *app, * messaging_menu_app_set_source_icon: * @app: a #MessagingMenuApp * @source_id: a source id - * @icon: the new icon for the source + * @icon: (allow-none): the new icon for the source * * Changes the icon of @source_id to @icon. */ @@ -1044,7 +1044,6 @@ messaging_menu_app_set_source_icon (MessagingMenuApp *app, { gint pos; GMenuItem *item; - gchar *iconstr; g_return_if_fail (MESSAGING_MENU_IS_APP (app)); g_return_if_fail (source_id != NULL); @@ -1053,11 +1052,22 @@ messaging_menu_app_set_source_icon (MessagingMenuApp *app, if (item == NULL) return; - iconstr = icon ? g_icon_to_string (icon) : NULL; - g_menu_item_set_attribute (item, "x-canonical-icon", "s", iconstr); + if (icon) + { + gchar *iconstr; + + iconstr = g_icon_to_string (icon); + g_menu_item_set_attribute (item, "x-canonical-icon", "s", iconstr); + + g_free (iconstr); + } + else + { + g_menu_item_set_attribute_value (item, "x-canonical-icon", NULL); + } + g_menu_replace_item (app->menu, pos, item); - g_free (iconstr); g_object_unref (item); } |