diff options
author | David Pellicer <davidpellicermartin@gmail.com> | 2010-12-07 09:13:16 -0800 |
---|---|---|
committer | Eitan Isaacson <eitan@monotonous.org> | 2010-12-07 09:20:22 -0800 |
commit | 051e4b2e629650eb5307daaebc17e2d5057754c6 (patch) | |
tree | bb4297dd865a13c746701a6b41183809ce3788be /caribou/ui/keyboard.py | |
parent | 25b75928256815c70064e2143c47627e11bcbd31 (diff) | |
download | caribou-051e4b2e629650eb5307daaebc17e2d5057754c6.tar.gz |
Fix to multiple instances of preferences window
Diffstat (limited to 'caribou/ui/keyboard.py')
-rw-r--r-- | caribou/ui/keyboard.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/caribou/ui/keyboard.py b/caribou/ui/keyboard.py index 5b92469..ec1aac4 100644 --- a/caribou/ui/keyboard.py +++ b/caribou/ui/keyboard.py @@ -51,11 +51,11 @@ class KeyboardPreferences: builder.add_from_file(os.path.join(const.DATA_DIR, "caribou-prefs.ui")) self.window = builder.get_object("dialog_prefs") - self.window.connect("destroy", self.destroy) - self.window.connect("delete_event", self.destroy) + self.window.connect("destroy", self.hide) + self.window.connect("delete_event", self.hide) close = builder.get_object("button_close") - close.connect("clicked", self.destroy) + close.connect("clicked", self.hide) client = gconf.client_get_default() client.add_dir(const.CARIBOU_GCONF, gconf.CLIENT_PRELOAD_NONE) @@ -131,7 +131,6 @@ class KeyboardPreferences: else: layout_combo.set_active(index) - self.window.show_all() def _on_default_font_toggled(self, default_colors_checkbox, gconf_client, key_font_button): @@ -153,6 +152,9 @@ class KeyboardPreferences: def destroy(self, widget, data = None): self.window.destroy() + def hide(self, widget, data = None): + self.window.hide() + def _fetch_keyboards(self): files = os.listdir(const.KEYBOARDS_DIR) kbds = [] @@ -429,6 +431,7 @@ class CaribouKeyboard(gtk.Notebook): self.connect('size-allocate', self._on_size_allocate) self.row_height = -1 + self.keyboard_preferences = KeyboardPreferences() def reset_row_height(self): for i in xrange(self.get_n_pages()): @@ -535,8 +538,15 @@ class CaribouKeyboard(gtk.Notebook): self.set_current_page(self.current_page) gtk.Notebook.show_all(self) + def is_preferences_open(self): + if self.keyboard_preferences.window.window and \ + self.keyboard_preferences.window.window.is_visible(): + return True + else: + return False + def _pressed_preferences_key(self, key): - KeyboardPreferences() + self.keyboard_preferences.window.show_all() def _switch_to_layout(self, name): n_pages = self.get_n_pages() |