diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-09-30 22:57:27 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-09-30 22:57:27 +0200 |
commit | e669e2d3eac16c0c2f5510f1274f45afd2779d6c (patch) | |
tree | 73435f0ce13d325eff0171ffa30536cf30f9b560 | |
parent | ba84fd642cb93f5cd46fac00ccbddf33c7fe46cb (diff) | |
parent | bc49dd8e9acfd1069e99999fd573609a404de869 (diff) | |
download | libayatana-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
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | src/app-indicator.c | 46 |
2 files changed, 47 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog index c774a0a..220b86c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +libappindicator (0.4.1-0ubuntu2) UNRELEASED; urgency=low + + * src/app-indicator.c: + - fix fallback icon of the GtkStatusIcon (LP: #820080), cherry + pick of r221 from lp:libappindicator + + -- Michael Vogt <michael.vogt@ubuntu.com> Fri, 30 Sep 2011 21:26:40 +0200 + libappindicator (0.4.1-0ubuntu1) oneiric; urgency=low [ Ted Gould ] 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; }; |