summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Pellicer <davidpellicermartin@gmail.com>2010-12-07 09:16:48 -0800
committerEitan Isaacson <eitan@monotonous.org>2010-12-07 09:20:23 -0800
commit856bda2463660e6cdb6b0f004cf75dddc1f4d6a9 (patch)
treeecd78663b949d513f091d39eabf1e13803b35141
parent051e4b2e629650eb5307daaebc17e2d5057754c6 (diff)
downloadcaribou-856bda2463660e6cdb6b0f004cf75dddc1f4d6a9.tar.gz
Deregister of gconf listeners when object is destroyed
-rw-r--r--caribou/ui/keyboard.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/caribou/ui/keyboard.py b/caribou/ui/keyboard.py
index ec1aac4..ace93b0 100644
--- a/caribou/ui/keyboard.py
+++ b/caribou/ui/keyboard.py
@@ -415,18 +415,24 @@ class CaribouKeyboard(gtk.Notebook):
self.key_size = 30
self.current_mask = 0
self.current_page = 0
+ self._gconf_connections = []
self.client = gconf.client_get_default()
- self.client.notify_add(const.CARIBOU_GCONF + "/normal_color",
- self._colors_changed)
- self.client.notify_add(const.CARIBOU_GCONF + "/mouse_over_color",
- self._colors_changed)
- self.client.notify_add(const.CARIBOU_GCONF + "/default_colors",
- self._colors_changed)
- self.client.notify_add(const.CARIBOU_GCONF + "/default_font",
- self._key_font_changed)
- self.client.notify_add(const.CARIBOU_GCONF + "/key_font",
- self._key_font_changed)
+ self._gconf_connections.append(self.client.notify_add(
+ const.CARIBOU_GCONF + "/normal_color",
+ self._colors_changed))
+ self._gconf_connections.append(self.client.notify_add(
+ const.CARIBOU_GCONF + "/mouse_over_color",
+ self._colors_changed))
+ self._gconf_connections.append(self.client.notify_add(
+ const.CARIBOU_GCONF + "/default_colors",
+ self._colors_changed))
+ self._gconf_connections.append(self.client.notify_add(
+ const.CARIBOU_GCONF + "/default_font",
+ self._key_font_changed))
+ self._gconf_connections.append(self.client.notify_add(
+ const.CARIBOU_GCONF + "/key_font",
+ self._key_font_changed))
self.connect('size-allocate', self._on_size_allocate)
@@ -548,6 +554,11 @@ class CaribouKeyboard(gtk.Notebook):
def _pressed_preferences_key(self, key):
self.keyboard_preferences.window.show_all()
+ def destroy(self):
+ for id in self._gconf_connections:
+ self.client.notify_remove(id)
+ super(gtk.Notebook, self).destroy()
+
def _switch_to_layout(self, name):
n_pages = self.get_n_pages()
for i in range(n_pages):