aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2014-09-16 16:58:47 +0200
committerLars Uebernickel <lars.uebernickel@canonical.com>2014-09-16 16:58:47 +0200
commit9857406201fa92d88e9b66650e43a2ea3cc6f52c (patch)
tree700c61e049651e7001bec81f2a208cec32735345 /src
parent1f6eec28e773160322a0ec5633cf4b48b75a1d2d (diff)
downloadayatana-indicator-messages-9857406201fa92d88e9b66650e43a2ea3cc6f52c.tar.gz
ayatana-indicator-messages-9857406201fa92d88e9b66650e43a2ea3cc6f52c.tar.bz2
ayatana-indicator-messages-9857406201fa92d88e9b66650e43a2ea3cc6f52c.zip
Support X-Ubuntu-SymbolicIcon in desktop files
As a way for applications to supply symbolic icons which are not in the theme but specified by file name.
Diffstat (limited to 'src')
-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,