summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-07-05 14:17:20 +0300
committermonsta <[email protected]>2017-07-05 14:17:20 +0300
commit064454a83e47339a3e9c837f81ba30e3ba75e3ce (patch)
tree920c770578411ee250d30f797829d1c6422d3349 /src
parent84e9b553300132506c36097c6fc95216dfdc1569 (diff)
downloadmate-power-manager-064454a83e47339a3e9c837f81ba30e3ba75e3ce.tar.bz2
mate-power-manager-064454a83e47339a3e9c837f81ba30e3ba75e3ce.tar.xz
refresh tray icon on icon theme change
Diffstat (limited to 'src')
-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);