From aac27244f0afa012bdac7d5a89e72b59dbb84a76 Mon Sep 17 00:00:00 2001 From: Aleksey Lim Date: Fri, 18 Sep 2009 14:43:44 +0000 Subject: Sugar craches during undo for the first Keyboard component startup #1341 --- diff --git a/extensions/cpsection/keyboard/model.py b/extensions/cpsection/keyboard/model.py index a5721cd..11edb9b 100644 --- a/extensions/cpsection/keyboard/model.py +++ b/extensions/cpsection/keyboard/model.py @@ -87,7 +87,9 @@ class KeyboardManager(object): if model: return model else: - return self._configrec.get_model() + model = self._configrec.get_model() + self.set_model(model) + return model def get_current_layouts(self): """Return the enabled keyboard layouts with variants""" @@ -107,19 +109,22 @@ class KeyboardManager(object): layout_list.append('%s(%s)' % (layout, variants[i])) i += 1 + self.set_layouts(layout_list) + return layout_list def get_current_option_group(self): """Return the enabled option for switching keyboard group""" options = self._gconf_client.get_list(_OPTIONS_KEY, gconf.VALUE_STRING) - + if not options: options = self._configrec.get_options() + self.set_option_group(options) for option in options: if option.startswith(_GROUP_NAME): return option - + return None def get_max_layouts(self): @@ -135,6 +140,8 @@ class KeyboardManager(object): def set_option_group(self, option_group): """Sets the supplied option for switching keyboard group""" #XXX: Merge, not overwrite previous options + if option_group is None: + option_group = '' options = [option_group] self._gconf_client.set_list(_OPTIONS_KEY, gconf.VALUE_STRING, options) self._configrec.set_options(options) diff --git a/extensions/cpsection/keyboard/view.py b/extensions/cpsection/keyboard/view.py index 04edc4d..074d298 100644 --- a/extensions/cpsection/keyboard/view.py +++ b/extensions/cpsection/keyboard/view.py @@ -30,7 +30,7 @@ CLASS = 'Language' ICON = 'module-keyboard' TITLE = _('Keyboard') -_APPLY_TIMEOUT = 3000 +_APPLY_TIMEOUT = 500 #TODO: This cpsection adds checks for xklavier in bin/sugar-session and # src/jarabe/controlpanel/gui.py. We should get rid of these checks -- cgit v0.9.1