From 7ee1fca30ddb23e619429fd8cbfe2c936ace6f35 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 5 Jul 2017 12:52:39 +0300 Subject: refresh tray icon on icon theme change --- mate-volume-control/gvc-stream-status-icon.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c index c5f0115..e80d4fe 100644 --- a/mate-volume-control/gvc-stream-status-icon.c +++ b/mate-volume-control/gvc-stream-status-icon.c @@ -665,6 +665,15 @@ on_status_icon_visible_notify (GvcStreamStatusIcon *icon) gtk_widget_hide (icon->priv->dock); } +static void +on_icon_theme_change (GtkSettings *settings, + GParamSpec *pspec, + GvcStreamStatusIcon *icon) +{ + gtk_status_icon_set_from_icon_name (GTK_STATUS_ICON (icon), + icon->priv->icon_names[icon->priv->current_icon]); +} + static void gvc_stream_status_icon_init (GvcStreamStatusIcon *icon) { @@ -745,6 +754,11 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon) gtk_container_add (GTK_CONTAINER (frame), box); gtk_box_pack_start (GTK_BOX (box), icon->priv->bar, TRUE, FALSE, 0); + + g_signal_connect (gtk_settings_get_default (), + "notify::gtk-icon-theme-name", + G_CALLBACK (on_icon_theme_change), + icon); } static void @@ -756,6 +770,10 @@ gvc_stream_status_icon_finalize (GObject *object) g_strfreev (icon->priv->icon_names); + g_signal_handlers_disconnect_by_func (gtk_settings_get_default (), + on_icon_theme_change, + icon); + G_OBJECT_CLASS (gvc_stream_status_icon_parent_class)->finalize (object); } -- cgit v1.2.1