diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/indicator-application.c | 7 | ||||
-rw-r--r-- | src/libappindicator/app-indicator.c | 28 |
2 files changed, 31 insertions, 4 deletions
diff --git a/src/indicator-application.c b/src/indicator-application.c index b681a24..16c3a9f 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -447,7 +447,12 @@ application_added (DBusGProxy * proxy, const gchar * iconname, gint position, co /* We make a long name using the suffix, and if that icon is available we want to use it. Otherwise we'll just use the name we were given. */ - gchar * longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + gchar * longname = NULL; + if (!g_str_has_suffix(iconname, PANEL_ICON_SUFFIX)) { + longname = g_strdup_printf("%s-%s", iconname, PANEL_ICON_SUFFIX); + } else { + longname = g_strdup(iconname); + } app->entry.image = indicator_image_helper(longname); g_free(longname); diff --git a/src/libappindicator/app-indicator.c b/src/libappindicator/app-indicator.c index c3a2d7f..4076334 100644 --- a/src/libappindicator/app-indicator.c +++ b/src/libappindicator/app-indicator.c @@ -147,6 +147,8 @@ static void watcher_proxy_destroyed (GObject * object, gpointer data); static void client_menu_changed (GtkWidget *widget, GtkWidget *child, AppIndicator *indicator); static void submenu_changed (GtkWidget *widget, GtkWidget *child, gpointer data); +static void theme_changed_cb (GtkIconTheme * theme, gpointer user_data); + /* GObject type */ G_DEFINE_TYPE (AppIndicator, app_indicator, G_TYPE_OBJECT); @@ -338,6 +340,9 @@ app_indicator_init (AppIndicator *self) } dbus_g_connection_ref(priv->connection); + g_signal_connect(G_OBJECT(gtk_icon_theme_get_default()), + "changed", G_CALLBACK(theme_changed_cb), self); + self->priv = priv; return; @@ -817,6 +822,13 @@ fallback_timer_expire (gpointer data) return FALSE; } +/* emit a NEW_ICON signal in response for the theme change */ +static void +theme_changed_cb (GtkIconTheme * theme, gpointer user_data) +{ + g_signal_emit (user_data, signals[NEW_ICON], 0, TRUE); +} + /* Creates a StatusIcon that can be used when the application indicator area isn't available. */ static GtkStatusIcon * @@ -854,22 +866,32 @@ static void status_icon_changes (AppIndicator * self, gpointer data) { GtkStatusIcon * icon = GTK_STATUS_ICON(data); + GIcon *themed_icon = NULL; switch (app_indicator_get_status(self)) { case APP_INDICATOR_STATUS_PASSIVE: + themed_icon = + g_themed_icon_new_with_default_fallbacks (app_indicator_get_icon (self)); gtk_status_icon_set_visible(icon, FALSE); - gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self)); + gtk_status_icon_set_from_gicon(icon, themed_icon); break; case APP_INDICATOR_STATUS_ACTIVE: - gtk_status_icon_set_from_icon_name(icon, app_indicator_get_icon(self)); + themed_icon = + g_themed_icon_new_with_default_fallbacks (app_indicator_get_icon (self)); + gtk_status_icon_set_from_gicon(icon, themed_icon); gtk_status_icon_set_visible(icon, TRUE); break; case APP_INDICATOR_STATUS_ATTENTION: - gtk_status_icon_set_from_icon_name(icon, app_indicator_get_attention_icon(self)); + themed_icon = + g_themed_icon_new_with_default_fallbacks (app_indicator_get_attention_icon (self)); + gtk_status_icon_set_from_gicon(icon, themed_icon); gtk_status_icon_set_visible(icon, TRUE); break; }; + if (themed_icon) + g_object_unref (themed_icon); + return; } |