aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2014-09-25 14:40:50 +0000
committerCI bot <ps-jenkins@lists.canonical.com>2014-09-25 14:40:50 +0000
commit979eeee87fb9136f7dbbbe609752e62706443906 (patch)
tree700c61e049651e7001bec81f2a208cec32735345
parent1f6eec28e773160322a0ec5633cf4b48b75a1d2d (diff)
parent9857406201fa92d88e9b66650e43a2ea3cc6f52c (diff)
downloadayatana-indicator-messages-979eeee87fb9136f7dbbbe609752e62706443906.tar.gz
ayatana-indicator-messages-979eeee87fb9136f7dbbbe609752e62706443906.tar.bz2
ayatana-indicator-messages-979eeee87fb9136f7dbbbe609752e62706443906.zip
Support X-Ubuntu-SymbolicIcon in desktop files Fixes: 1365408
Approved by: Ted Gould, PS Jenkins bot, Renato Araujo Oliveira Filho
-rw-r--r--src/im-application-list.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c
index b926e77..15e661e 100644
--- a/src/im-application-list.c
+++ b/src/im-application-list.c
@@ -886,14 +886,40 @@ im_application_list_sources_listed (GObject *source_object,
}
static GIcon *
-get_symbolic_app_icon (GAppInfo *info)
+get_symbolic_app_icon (GDesktopAppInfo *info)
{
+ gchar *x_symbolic_icon;
GIcon *icon;
const gchar * const *names;
gchar *symbolic_name;
GIcon *symbolic_icon;
- icon = g_app_info_get_icon (info);
+ /* If X-Ubuntu-SymbolicIcon exists, use that. It is always interpreted
+ * as a filename.
+ *
+ * Simply appending -symbolic to the normal icon doesn't work for
+ * icons specified by file name, because the symbolic icon might be in
+ * a different format (symbolic icons tend to be svg and normal icons
+ * png). Also, icons specified by file names don't allow for fallbacks
+ * (without stating the file from this process), and we'd want to fall
+ * back to the normal app icon.
+ *
+ * See lp: #1365408
+ */
+ if ((x_symbolic_icon = g_desktop_app_info_get_string (info, "X-Ubuntu-SymbolicIcon")))
+ {
+ GFile *file;
+
+ file = g_file_new_for_path (x_symbolic_icon);
+ symbolic_icon = g_file_icon_new (file);
+
+ g_object_unref (file);
+ g_free (x_symbolic_icon);
+
+ return symbolic_icon;
+ }
+
+ icon = g_app_info_get_icon (G_APP_INFO (info));
if (icon == NULL)
return NULL;
@@ -1014,7 +1040,7 @@ im_application_list_message_added (Application *app,
im_application_list_update_root_action (app->list);
}
- app_icon = get_symbolic_app_icon (G_APP_INFO (app->info));
+ app_icon = get_symbolic_app_icon (app->info);
g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
app->id, app_icon, id, serialized_icon, title,