[kupfer: 56/67] icons: Listen for signal when icon set alternatives change



commit 65becafdb2974500c6a1c4f6f749d543dd8ff4cb
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Mar 19 01:53:39 2011 +0100

    icons: Listen for signal when icon set alternatives change

 kupfer/icons.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/icons.py b/kupfer/icons.py
index d65a88b..a65d0c2 100644
--- a/kupfer/icons.py
+++ b/kupfer/icons.py
@@ -234,17 +234,24 @@ def _get_icon_for_standard_gicon(gicon, icon_size):
 
 
 def _setup_icon_renderer(sched):
-	global _IconRenderer
 	from kupfer.core import settings
 	setctl = settings.GetSettingsController()
+	setctl.connect("alternatives-changed", _icon_render_change)
+	_icon_render_change(setctl, 'icon_renderer')
+
+def _icon_render_change(setctl, category_key):
+	global _IconRenderer
+	print "_icon_render_change"
+	if category_key != 'icon_renderer':
+		return
 	renderer_dict = setctl.get_preferred_alternative('icon_renderer')
 	renderer = renderer_dict.get("renderer")
 	if not renderer:
 		return
 	pretty.print_debug(__name__, "Using", renderer)
+	_icon_theme_changed(None)
 	_IconRenderer = renderer
 
-
 scheduler.GetScheduler().connect("loaded", _setup_icon_renderer)
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]