diff options
author | Eitan Isaacson <eitan@monotonous.org> | 2011-05-31 15:43:16 -0700 |
---|---|---|
committer | Eitan Isaacson <eitan@monotonous.org> | 2011-06-01 12:47:02 -0700 |
commit | 10bf5510841dad0eadc6a492b0e7451c7b34ef60 (patch) | |
tree | 076add6118a92a1fc39ec254c1c3cdce15b42708 | |
parent | 73c6ac5d81e607a88c1bad2fd20b4085571c77cd (diff) | |
download | caribou-10bf5510841dad0eadc6a492b0e7451c7b34ef60.tar.gz |
Scanning: Fix single column scanning and subkeys.
-rw-r--r-- | libcaribou/column-model.vala | 2 | ||||
-rw-r--r-- | libcaribou/scannable-group.vala | 30 |
2 files changed, 27 insertions, 5 deletions
diff --git a/libcaribou/column-model.vala b/libcaribou/column-model.vala index 98fc52e..b1db3cb 100644 --- a/libcaribou/column-model.vala +++ b/libcaribou/column-model.vala @@ -23,7 +23,7 @@ namespace Caribou { } public override IScannableItem[] get_scan_children () { - return (IScannableItem[]) get_keys (); + return (IScannableItem[]) keys.to_array (); } public IKeyboardObject[] get_children () { diff --git a/libcaribou/scannable-group.vala b/libcaribou/scannable-group.vala index c60d8ce..994dbec 100644 --- a/libcaribou/scannable-group.vala +++ b/libcaribou/scannable-group.vala @@ -46,23 +46,44 @@ namespace Caribou { selected_item_changed (_selected_path.peek_tail ()); } - private IScannableItem? get_steping_child () { + private IScannableItem? get_stepping_child () { if (scan_child_index < 0) return null; + return get_scan_children ()[scan_child_index]; } + private IScannableItem? get_single_child (IScannableItem item) { + if (item is ScannableGroup) { + IScannableItem[] children = + (item as ScannableGroup).get_scan_children(); + if (children.length == 1) { + return children[0]; + } + } + + return null; + } + public virtual IScannableItem? child_select () { - IScannableItem step_child = get_steping_child (); + IScannableItem step_child = get_stepping_child (); IScannableItem selected_leaf = _selected_path.peek_tail (); + if (selected_leaf != null) { assert (selected_leaf is IScannableGroup); add_to_selected_path ( ((IScannableGroup) selected_leaf).child_select ()); } else if (step_child != null) { - step_child.scan_selected = true;; + step_child.scan_selected = true; add_to_selected_path (step_child); scan_child_index = -1; + + for (IScannableItem child = get_single_child (step_child); + child != null; + child = get_single_child (child)) { + child.scan_selected = true; + add_to_selected_path (child); + } } return _selected_path.peek_tail (); @@ -84,8 +105,9 @@ namespace Caribou { } public IScannableItem? child_step (int cycles) { - IScannableItem step_child = get_steping_child (); + IScannableItem step_child = get_stepping_child (); IScannableItem selected_leaf = _selected_path.peek_tail (); + if (selected_leaf != null) { assert (step_child == null); if (selected_leaf is IScannableGroup) |