updated on Mon Jan 16 20:00:43 UTC 2012
[aur-mirror.git] / libappindicator / fix-fallback-icons.patch
blobbdbb6c9086e9b5f0b0b0e2fb2bf8205b83ee9469
1 === modified file 'src/app-indicator.c'
2 --- src/app-indicator.c 2011-07-22 19:04:23 +0000
3 +++ src/app-indicator.c 2011-09-30 16:14:52 +0000
4 @@ -1523,20 +1523,52 @@
5 GtkStatusIcon * icon = GTK_STATUS_ICON(data);
6 gchar *longname = NULL;
8 + /* add the icon_theme_path once if needed */
9 + GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
10 + if (self->priv->icon_theme_path != NULL)
11 + {
12 + gchar **path;
13 + gint n_elements, i;
14 + gboolean found=FALSE;
15 + gtk_icon_theme_get_search_path(icon_theme, &path, &n_elements);
16 + for (i=0; i< n_elements || path[i] == NULL; i++)
17 + {
18 + if(g_strcmp0(path[i], self->priv->icon_theme_path) == 0)
19 + {
20 + found=TRUE;
21 + break;
22 + }
23 + }
24 + if(!found)
25 + gtk_icon_theme_append_search_path(icon_theme, self->priv->icon_theme_path);
26 + g_strfreev (path);
27 + }
29 switch (app_indicator_get_status(self)) {
30 case APP_INDICATOR_STATUS_PASSIVE:
31 - longname = append_panel_icon_suffix(app_indicator_get_icon(self));
32 - gtk_status_icon_set_visible(icon, FALSE);
33 - gtk_status_icon_set_from_icon_name(icon, longname);
34 + /* hide first to avoid that the change is visible to the user */
35 + gtk_status_icon_set_visible(icon, FALSE);
36 + longname = append_panel_icon_suffix(app_indicator_get_icon(self));
37 + if (gtk_icon_theme_has_icon (icon_theme, longname))
38 + gtk_status_icon_set_from_icon_name(icon, longname);
39 + else
40 + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
41 break;
42 case APP_INDICATOR_STATUS_ACTIVE:
43 - longname = append_panel_icon_suffix(app_indicator_get_icon(self));
44 - gtk_status_icon_set_from_icon_name(icon, longname);
45 + longname = append_panel_icon_suffix(app_indicator_get_icon(self));
46 + if (gtk_icon_theme_has_icon (icon_theme, longname))
47 + gtk_status_icon_set_from_icon_name(icon, longname);
48 + else
49 + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
50 gtk_status_icon_set_visible(icon, TRUE);
51 break;
52 case APP_INDICATOR_STATUS_ATTENTION:
53 - longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
54 - gtk_status_icon_set_from_icon_name(icon, longname);
55 + /* get the _attention_ icon here */
56 + longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
57 + if (gtk_icon_theme_has_icon (icon_theme, longname))
58 + gtk_status_icon_set_from_icon_name(icon, longname);
59 + else
60 + gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
61 gtk_status_icon_set_visible(icon, TRUE);
62 break;