Merge lp:~charlesk/indicator-sync/lp-1054310 into lp:indicator-sync/12.10

Proposed by Charles Kerr
Status: Merged
Approved by: Lars Karlitski
Approved revision: 22
Merged at revision: 22
Proposed branch: lp:~charlesk/indicator-sync/lp-1054310
Merge into: lp:indicator-sync/12.10
Diff against target: 58 lines (+34/-2)
2 files modified
src/indicator/indicator-sync.c (+15/-2)
src/service/app-menu-item.c (+19/-0)
To merge this branch: bzr merge lp:~charlesk/indicator-sync/lp-1054310
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
Review via email: mp+127635@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lars Karlitski (larsu) wrote :

Looks good, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator/indicator-sync.c'
2--- src/indicator/indicator-sync.c 2012-09-24 19:43:12 +0000
3+++ src/indicator/indicator-sync.c 2012-10-03 05:50:26 +0000
4@@ -481,9 +481,22 @@
5 static void
6 app_update_icon (DbusmenuMenuitem * mi, struct AppWidgets * w)
7 {
8- const gchar * icon_name = dbusmenu_menuitem_property_get (mi, APPLICATION_MENUITEM_PROP_ICON);
9+ GIcon * icon;
10+ const gchar * str;
11+ GError * error = NULL;
12
13- gtk_image_set_from_icon_name (GTK_IMAGE(w->icon), icon_name, GTK_ICON_SIZE_MENU);
14+ str = dbusmenu_menuitem_property_get (mi, APPLICATION_MENUITEM_PROP_ICON);
15+ icon = g_icon_new_for_string (str, &error);
16+ if (error != NULL)
17+ {
18+ g_warning ("unable to load icon: %s", error->message);
19+ g_error_free (error);
20+ }
21+ else
22+ {
23+ gtk_image_set_from_gicon (GTK_IMAGE(w->icon), icon, GTK_ICON_SIZE_MENU);
24+ g_object_unref (icon);
25+ }
26 }
27
28 static void
29
30=== modified file 'src/service/app-menu-item.c'
31--- src/service/app-menu-item.c 2012-09-17 05:18:18 +0000
32+++ src/service/app-menu-item.c 2012-10-03 05:50:26 +0000
33@@ -331,6 +331,25 @@
34 {
35 GIcon * icon = g_app_info_get_icon (app_info);
36 iconstr = g_icon_to_string (icon);
37+
38+ /* if GAppInfo returned a themed but non-symbolic icon,
39+ let's add the symbolic option here */
40+ if (G_IS_THEMED_ICON(icon))
41+ {
42+ GThemedIcon * themed_icon = G_THEMED_ICON (icon);
43+ const gchar * const * names = g_themed_icon_get_names (themed_icon);
44+ if (g_strv_length((gchar**)names) == 1)
45+ {
46+ gchar * tmp = g_strdup_printf ("%s-symbolic", names[0]);
47+ g_clear_object (&icon);
48+ icon = g_themed_icon_new_with_default_fallbacks (tmp);
49+ g_free (tmp);
50+ g_free (iconstr);
51+ iconstr = g_icon_to_string (icon);
52+ }
53+ }
54+
55+ g_clear_object (&icon);
56 }
57
58 if (iconstr == NULL)

Subscribers

People subscribed via source and target branches

to all changes: