[kupfer] asciiunicodeiconset: Clear cache upon theme change



commit 44235f25d6456337cc7409c0557ce1403f61cb4b
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sun Apr 3 17:03:50 2011 +0200

    asciiunicodeiconset: Clear cache upon theme change

 kupfer/plugin/asciiunicodeiconset.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/asciiunicodeiconset.py b/kupfer/plugin/asciiunicodeiconset.py
index 18caa57..1a71bf6 100644
--- a/kupfer/plugin/asciiunicodeiconset.py
+++ b/kupfer/plugin/asciiunicodeiconset.py
@@ -64,6 +64,14 @@ class AsciiIconRenderer (object):
 
 class UnicodeIconRenderer (object):
 	glyph_pixbuf_cache = weakref.WeakValueDictionary()
+	def __init__(self):
+		settings = gtk.settings_get_default()
+		settings.connect("notify::gtk-color-scheme", self._theme_change)
+
+	@classmethod
+	def _theme_change(cls, *ignored):
+		cls.glyph_pixbuf_cache.clear()
+
 	@classmethod
 	def pixbuf_for_name(cls, icon_name, size):
 		"""Return pixbuf at @size or None"""



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