Merge lp:~stolowski/unity-lens-applications/preview-installable-app-icon into lp:unity-lens-applications

Proposed by Paweł Stołowski
Status: Merged
Approved by: Michal Hruby
Approved revision: 299
Merged at revision: 298
Proposed branch: lp:~stolowski/unity-lens-applications/preview-installable-app-icon
Merge into: lp:unity-lens-applications
Diff against target: 58 lines (+13/-9)
1 file modified
src/daemon.vala (+13/-9)
To merge this branch: bzr merge lp:~stolowski/unity-lens-applications/preview-installable-app-icon
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+124210@code.launchpad.net

Commit message

When displaying a preview for installable app, look for icon in /usr/share/app-install/icons.

Description of the change

When displaying a preview for installable app, look for icon in /usr/share/app-install/icons.

To post a comment you must log in.
299. By Paweł Stołowski

Use FileIcon for installable apps, ThemedIcon for installed apps.

Revision history for this message
Michal Hruby (mhr3) wrote :

Cool, looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/daemon.vala'
2--- src/daemon.vala 2012-09-13 11:16:15 +0000
3+++ src/daemon.vala 2012-09-13 14:32:19 +0000
4@@ -730,13 +730,11 @@
5 }
6
7 /**
8- * Find app icon in DATADIR/app-install/icons based on preview_installable_icon_file
9- * obtained from S-C data provider.
10- * trying all supported image extensions.
11+ * Find app icon in DATADIR/app-install/icons trying all supported image extensions.
12 */
13- private string find_app_install_icon_path ()
14+ private string find_app_install_icon_path (string icon_name)
15 {
16- string icon = @"$ICON_APP_INSTALL_PATH/$preview_installable_icon_file.";
17+ string icon = @"$ICON_APP_INSTALL_PATH/$icon_name.";
18
19 foreach (string ext in image_extensions)
20 {
21@@ -1016,7 +1014,7 @@
22
23 launcherservice.connect_to_launcher ();
24 string desktop_file = preview_installable_desktop_file;
25- string icon = find_app_install_icon_path ();
26+ string icon = find_app_install_icon_path (preview_installable_icon_file);
27
28 launcherservice.add_launcher_item_from_position (appname, icon, 0, 0, 32, desktop_file, tid);
29 }
30@@ -1122,11 +1120,12 @@
31
32 string pkgname = "";
33 string appname = "";
34+ bool installed = uri.has_prefix ("application://");
35
36- if (uri.has_prefix ("application://") || uri.has_prefix ("unity-install://"))
37+ if (installed || uri.has_prefix ("unity-install://"))
38 {
39 string desktopfile = null;
40- if (uri.has_prefix ("application://"))
41+ if (installed)
42 {
43 desktopfile = uri.substring (14); //remove "application://" prefix
44
45@@ -1166,7 +1165,12 @@
46 debug ("Requesting pkg info: %s, %s\n", pkgname, appname);
47 sc_data_provider.get_app_details (appname, pkgname);
48
49- Icon icon = new GLib.ThemedIcon (sc_data_provider.icon);
50+ Icon icon;
51+ if (installed)
52+ icon = new GLib.ThemedIcon (sc_data_provider.icon);
53+ else
54+ icon = new GLib.FileIcon (File.new_for_path (find_app_install_icon_path (sc_data_provider.icon)));
55+
56 Icon? screenshot = null;
57
58 if (sc_data_provider.screenshot != null)

Subscribers

People subscribed via source and target branches