summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-07-05 14:17:20 +0300
committermonsta <[email protected]>2017-08-10 17:55:09 +0300
commit88808d7e67b96d3874bb8d96f41335c0d7ff795e (patch)
treecc8e9bb65e966476259e5663f3fe4130cfd1ef8b
parent8b3ea9e0d81aa4563c00ebf9ba32626ef5d68414 (diff)
downloadmate-power-manager-88808d7e67b96d3874bb8d96f41335c0d7ff795e.tar.bz2
mate-power-manager-88808d7e67b96d3874bb8d96f41335c0d7ff795e.tar.xz
refresh tray icon on icon theme change
-rw-r--r--src/gpm-manager.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index ce2b695..0445fd0 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -1789,6 +1789,20 @@ gpm_manager_systemd_inhibit (GDBusProxy *proxy) {
return r;
}
+static void
+on_icon_theme_change (GtkSettings *settings,
+ GParamSpec *pspec,
+ GpmManager *manager)
+{
+ gchar *icon = gpm_engine_get_icon (manager->priv->engine);
+ if (icon == NULL) {
+ return;
+ }
+
+ gpm_tray_icon_set_icon (manager->priv->tray_icon, icon);
+ g_free (icon);
+}
+
/**
* gpm_manager_init:
* @manager: This class instance
@@ -1920,6 +1934,11 @@ gpm_manager_init (GpmManager *manager)
g_signal_connect (manager->priv->engine, "charge-action",
G_CALLBACK (gpm_manager_engine_charge_action_cb), manager);
+ g_signal_connect (gtk_settings_get_default (),
+ "notify::gtk-icon-theme-name",
+ G_CALLBACK (on_icon_theme_change),
+ manager);
+
/* update ac throttle */
gpm_manager_update_ac_throttle (manager);
}
@@ -1957,6 +1976,10 @@ gpm_manager_finalize (GObject *object)
manager->priv->critical_alert_timeout_id = 0;
}
+ g_signal_handlers_disconnect_by_func (gtk_settings_get_default (),
+ on_icon_theme_change,
+ manager);
+
g_object_unref (manager->priv->settings);
g_object_unref (manager->priv->dpms);
g_object_unref (manager->priv->idle);