Merge lp:~larsu/indicator-messages/lp1365408 into lp:indicator-messages/13.10

Proposed by Lars Karlitski
Status: Merged
Approved by: Renato Araujo Oliveira Filho
Approved revision: 420
Merged at revision: 420
Proposed branch: lp:~larsu/indicator-messages/lp1365408
Merge into: lp:indicator-messages/13.10
Diff against target: 55 lines (+29/-3)
1 file modified
src/im-application-list.c (+29/-3)
To merge this branch: bzr merge lp:~larsu/indicator-messages/lp1365408
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Renato Araujo Oliveira Filho (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+234830@code.launchpad.net

Commit message

Support X-Ubuntu-SymbolicIcon in desktop files

Description of the change

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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Renato Araujo Oliveira Filho (renatofilho) wrote :

Works nice.

review: Approve
Revision history for this message
Ted Gould (ted) :
review: Needs Information
Revision history for this message
Lars Karlitski (larsu) wrote :

Sorry I replied inline a couple of days ago but apparently didn't hit "Save Comment" up here.

Revision history for this message
Ted Gould (ted) wrote :

On Fri, 2014-09-19 at 07:10 +0000, Lars Uebernickel wrote:

> I've tried to keep it semantically similar to the 'Icon' key, which
> takes an absolute path and doesn't look at 'Path'. Icons are also
> something that is definitely part of the installed app, not its
> runtime directory. What benefit would we get from adding 'Path'?

I see what you're saying there, in thinking of Path as the runtime
directory. The way that we're building the desktop files for click
packages is that Path is the directory of the package. So path would be
the appropriate place to look for any relative icon locations. But,
that's overloading the key in that case.

So I guess that means we can think of this a couple ways:

Long term: We really need the messaging menu to get proper Click package
support. We've used the legacy FD.o dirs to limp through, but we should
do the work to do this right. It should be able to read the symbolic
icon name and figure out how to resolve that properly. That's not going
to happen for 14.10.

Short term: Perhaps we should add special handling for the generated
desktop files for the symbolic icon that resolves the directories and
provides absolute paths. Work arounds on top of work arounds, but that
would resolve the directory issue of the symbolic icon today.

I'll go ahead and add a UAL task to the bug and handle that in the
desktop hook, as I think that makes sense for the short term, but we
should definitely look at how to make messaging menu more click aware
sooner rather than later.

Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/im-application-list.c'
2--- src/im-application-list.c 2014-07-30 22:33:13 +0000
3+++ src/im-application-list.c 2014-09-16 15:02:35 +0000
4@@ -886,14 +886,40 @@
5 }
6
7 static GIcon *
8-get_symbolic_app_icon (GAppInfo *info)
9+get_symbolic_app_icon (GDesktopAppInfo *info)
10 {
11+ gchar *x_symbolic_icon;
12 GIcon *icon;
13 const gchar * const *names;
14 gchar *symbolic_name;
15 GIcon *symbolic_icon;
16
17- icon = g_app_info_get_icon (info);
18+ /* If X-Ubuntu-SymbolicIcon exists, use that. It is always interpreted
19+ * as a filename.
20+ *
21+ * Simply appending -symbolic to the normal icon doesn't work for
22+ * icons specified by file name, because the symbolic icon might be in
23+ * a different format (symbolic icons tend to be svg and normal icons
24+ * png). Also, icons specified by file names don't allow for fallbacks
25+ * (without stating the file from this process), and we'd want to fall
26+ * back to the normal app icon.
27+ *
28+ * See lp: #1365408
29+ */
30+ if ((x_symbolic_icon = g_desktop_app_info_get_string (info, "X-Ubuntu-SymbolicIcon")))
31+ {
32+ GFile *file;
33+
34+ file = g_file_new_for_path (x_symbolic_icon);
35+ symbolic_icon = g_file_icon_new (file);
36+
37+ g_object_unref (file);
38+ g_free (x_symbolic_icon);
39+
40+ return symbolic_icon;
41+ }
42+
43+ icon = g_app_info_get_icon (G_APP_INFO (info));
44 if (icon == NULL)
45 return NULL;
46
47@@ -1014,7 +1040,7 @@
48 im_application_list_update_root_action (app->list);
49 }
50
51- app_icon = get_symbolic_app_icon (G_APP_INFO (app->info));
52+ app_icon = get_symbolic_app_icon (app->info);
53
54 g_signal_emit (app->list, signals[MESSAGE_ADDED], 0,
55 app->id, app_icon, id, serialized_icon, title,

Subscribers

People subscribed via source and target branches