diff options
author | Simon Schampijer <simon@laptop.org> | 2012-09-04 12:52:19 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-09-07 09:14:26 (GMT) |
commit | d1abfdcb6d7433225bff17202ea2e66e0e8eccf2 (patch) | |
tree | 4da7074e85bff58f4e52c62a2faf272257563131 /extensions | |
parent | b70a1488af339c119a130f64fada1509757f82e1 (diff) |
Keyboard layouts: workaround as gconf_client_get_list is not (yet) introspectable
client.get_list() is not introspectable, as the elements in the list returned do
not have a fixed type. However, we can use the more generic .get() and the
GConfValue methods to read the list.
Patch by Daniel: http://dev.laptop.org/git/users/dsd/sugar/commit/?h=gtk3port&id=5ebdc335a6ed33aa019093db27b25a874221fe4d
Signed-off-by: Simon Schampijer <simon@laptop.org>
Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/cpsection/keyboard/model.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/extensions/cpsection/keyboard/model.py b/extensions/cpsection/keyboard/model.py index b5bc53a..bfd7e31 100644 --- a/extensions/cpsection/keyboard/model.py +++ b/extensions/cpsection/keyboard/model.py @@ -94,9 +94,16 @@ class KeyboardManager(object): def get_current_layouts(self): """Return the enabled keyboard layouts with variants""" - layouts = self._gconf_client.get_list(_LAYOUTS_KEY, GConf.ValueType.STRING) - if layouts: - return layouts + # FIXME, gconf_client_get_list not introspectable #681433 + layouts_from_gconf = self._gconf_client.get( + '/desktop/sugar/peripherals/keyboard/layouts') + layouts = [] + if layouts_from_gconf: + for gval in layouts_from_gconf.get_list(): + layout = gval.get_string() + layouts.append(layout) + if layouts: + return layouts layouts = self._configrec.get_layouts() variants = self._configrec.get_variants() @@ -116,7 +123,14 @@ class KeyboardManager(object): def get_current_option_group(self): """Return the enabled option for switching keyboard group""" - options = self._gconf_client.get_list(_OPTIONS_KEY, GConf.ValueType.STRING) + options = [] + # FIXME, gconf_client_get_list not introspectable #681433 + options_from_gconf = gconf_client.get(\ + '/desktop/sugar/peripherals/keyboard/options') + if options_from_gconf: + for gval in options_from_gconf.get_list(): + option = gval.get_string() + options.append(option) if not options: options = self._configrec.get_options() |