diff options
author | Eitan Isaacson <eitan@monotonous.org> | 2011-05-31 11:33:38 -0700 |
---|---|---|
committer | Eitan Isaacson <eitan@monotonous.org> | 2011-06-01 12:47:01 -0700 |
commit | 22ed36c74597159cf4866abee35bb898127dea5a (patch) | |
tree | 8d69b0934a709fdc033fc0e91212866c2b2ec254 /libcaribou/keyboard-model.vala | |
parent | 6e333d1e0ac6bf25b70b16341bf70d3adc17137d (diff) | |
download | caribou-22ed36c74597159cf4866abee35bb898127dea5a.tar.gz |
Have UI choose keyboard type.
Diffstat (limited to 'libcaribou/keyboard-model.vala')
-rw-r--r-- | libcaribou/keyboard-model.vala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libcaribou/keyboard-model.vala b/libcaribou/keyboard-model.vala index a1fa2fc..3b06c9f 100644 --- a/libcaribou/keyboard-model.vala +++ b/libcaribou/keyboard-model.vala @@ -3,6 +3,7 @@ using Bus; namespace Caribou { public class KeyboardModel : Object { public string active_group { get; private set; default = ""; } + public string keyboard_type { get; construct; } XAdapter xadapter; HashTable<string, GroupModel> groups; @@ -13,13 +14,15 @@ namespace Caribou { string[] grps, variants; int i; - groups = new HashTable<string, GroupModel> (str_hash, str_equal); + assert (keyboard_type != null); xadapter = XAdapter.get_default (); xadapter.group_changed.connect (on_group_changed); xadapter.get_groups (out grps, out variants); + groups = new HashTable<string, GroupModel> (str_hash, str_equal); + for (i=0;i<grps.length;i++) populate_group (grps[i], variants[i]); @@ -28,8 +31,9 @@ namespace Caribou { } private void populate_group (string group, string variant) { - GroupModel grp = new GroupModel (group, variant); - if (JsonDeserializer.load_group (grp)) + GroupModel grp = JsonDeserializer.load_group (keyboard_type, + group, variant); + if (grp != null) groups.insert (GroupModel.create_group_name (group, variant), grp); } |