[caribou] Scanning: Fix single column scanning and subkeys.
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [caribou] Scanning: Fix single column scanning and subkeys.
- Date: Wed, 1 Jun 2011 19:49:11 +0000 (UTC)
commit 10bf5510841dad0eadc6a492b0e7451c7b34ef60
Author: Eitan Isaacson <eitan monotonous org>
Date: Tue May 31 15:43:16 2011 -0700
Scanning: Fix single column scanning and subkeys.
libcaribou/column-model.vala | 2 +-
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]