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 /bin | |
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 'bin')
-rwxr-xr-x | bin/sugar-session | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/bin/sugar-session b/bin/sugar-session index 055704d..56e9ca6 100755 --- a/bin/sugar-session +++ b/bin/sugar-session @@ -141,18 +141,21 @@ def setup_keyboard_cb(): configrec = Xkl.ConfigRec() configrec.get_from_server(engine) - layouts = gconf_client.get_list(\ - '/desktop/sugar/peripherals/keyboard/layouts', GConf.ValueType.STRING) + # FIXME, gconf_client_get_list not introspectable #681433 + layouts_from_gconf = gconf_client.get( + '/desktop/sugar/peripherals/keyboard/layouts') layouts_list = [] variants_list = [] - for layout in layouts: - layouts_list.append(layout.split('(')[0]) - variants_list.append(layout.split('(')[1][:-1]) + if layouts_from_gconf: + for gval in layouts_from_gconf.get_list(): + layout = gval.get_string() + layouts_list.append(layout.split('(')[0]) + variants_list.append(layout.split('(')[1][:-1]) - if layouts_list and variants_list: - have_config = True - configrec.set_layouts(layouts_list) - configrec.set_variants(variants_list) + if layouts_list and variants_list: + have_config = True + configrec.set_layouts(layouts_list) + configrec.set_variants(variants_list) model = gconf_client.get_string(\ '/desktop/sugar/peripherals/keyboard/model') @@ -160,11 +163,17 @@ def setup_keyboard_cb(): have_config = True configrec.set_model(model) - options = gconf_client.get_list(\ - '/desktop/sugar/peripherals/keyboard/options', GConf.ValueType.STRING) - if options: - have_config = True - configrec.set_options(options) + 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 options: + have_config = True + configrec.set_options(options) if have_config: configrec.activate(engine) |