aboutsummaryrefslogtreecommitdiff
path: root/src/app-indicator.c
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-09-30 22:57:27 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-09-30 22:57:27 +0200
commite669e2d3eac16c0c2f5510f1274f45afd2779d6c (patch)
tree73435f0ce13d325eff0171ffa30536cf30f9b560 /src/app-indicator.c
parentba84fd642cb93f5cd46fac00ccbddf33c7fe46cb (diff)
parentbc49dd8e9acfd1069e99999fd573609a404de869 (diff)
downloadlibayatana-appindicator-e669e2d3eac16c0c2f5510f1274f45afd2779d6c.tar.gz
libayatana-appindicator-e669e2d3eac16c0c2f5510f1274f45afd2779d6c.tar.bz2
libayatana-appindicator-e669e2d3eac16c0c2f5510f1274f45afd2779d6c.zip
* src/app-indicator.c:
- fix fallback icon of the GtkStatusIcon (LP: #820080), cherry pick of r221 from lp:libappindicator
Diffstat (limited to 'src/app-indicator.c')
-rw-r--r--src/app-indicator.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c
index c2f0f69..f885cc7 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -1523,20 +1523,52 @@ status_icon_changes (AppIndicator * self, gpointer data)
GtkStatusIcon * icon = GTK_STATUS_ICON(data);
gchar *longname = NULL;
+ /* add the icon_theme_path once if needed */
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
+ if (self->priv->icon_theme_path != NULL)
+ {
+ gchar **path;
+ gint n_elements, i;
+ gboolean found=FALSE;
+ gtk_icon_theme_get_search_path(icon_theme, &path, &n_elements);
+ for (i=0; i< n_elements || path[i] == NULL; i++)
+ {
+ if(g_strcmp0(path[i], self->priv->icon_theme_path) == 0)
+ {
+ found=TRUE;
+ break;
+ }
+ }
+ if(!found)
+ gtk_icon_theme_append_search_path(icon_theme, self->priv->icon_theme_path);
+ g_strfreev (path);
+ }
+
switch (app_indicator_get_status(self)) {
case APP_INDICATOR_STATUS_PASSIVE:
- longname = append_panel_icon_suffix(app_indicator_get_icon(self));
- gtk_status_icon_set_visible(icon, FALSE);
- gtk_status_icon_set_from_icon_name(icon, longname);
+ /* hide first to avoid that the change is visible to the user */
+ gtk_status_icon_set_visible(icon, FALSE);
+ longname = append_panel_icon_suffix(app_indicator_get_icon(self));
+ if (gtk_icon_theme_has_icon (icon_theme, longname))
+ gtk_status_icon_set_from_icon_name(icon, longname);
+ else
+ gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
break;
case APP_INDICATOR_STATUS_ACTIVE:
- longname = append_panel_icon_suffix(app_indicator_get_icon(self));
- gtk_status_icon_set_from_icon_name(icon, longname);
+ longname = append_panel_icon_suffix(app_indicator_get_icon(self));
+ if (gtk_icon_theme_has_icon (icon_theme, longname))
+ gtk_status_icon_set_from_icon_name(icon, longname);
+ else
+ gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
gtk_status_icon_set_visible(icon, TRUE);
break;
case APP_INDICATOR_STATUS_ATTENTION:
- longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
- gtk_status_icon_set_from_icon_name(icon, longname);
+ /* get the _attention_ icon here */
+ longname = append_panel_icon_suffix(app_indicator_get_attention_icon(self));
+ if (gtk_icon_theme_has_icon (icon_theme, longname))
+ gtk_status_icon_set_from_icon_name(icon, longname);
+ else
+ gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self));
gtk_status_icon_set_visible(icon, TRUE);
break;
};