diff options
author | Ted Gould <ted@gould.cx> | 2012-02-03 14:36:59 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-02-03 14:36:59 -0600 |
commit | 6516e720bded3ad85f051ebb8d6db926596a2ca6 (patch) | |
tree | b6a104b36d19793ec8a0e18732db37ffec0d3713 /src/app-indicator.c | |
parent | c93b59dcdd7d9e4fcfa3b6a4cdb2f06bb41d9156 (diff) | |
parent | 996677f97a04275f47fcc3c540ed7df5333677fe (diff) | |
download | libayatana-appindicator-6516e720bded3ad85f051ebb8d6db926596a2ca6.tar.gz libayatana-appindicator-6516e720bded3ad85f051ebb8d6db926596a2ca6.tar.bz2 libayatana-appindicator-6516e720bded3ad85f051ebb8d6db926596a2ca6.zip |
Sync with U. Desktop
Diffstat (limited to 'src/app-indicator.c')
-rw-r--r-- | src/app-indicator.c | 46 |
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; }; |