[gnome-contacts/wip/sorted] Fix up ctrl up/down inside scrolled window
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/wip/sorted] Fix up ctrl up/down inside scrolled window
- Date: Mon, 14 May 2012 13:12:45 +0000 (UTC)
commit 01df16164a138d13ec7ae8bbe20d1c84221c550a
Author: Alexander Larsson <alexl redhat com>
Date: Mon May 14 12:18:40 2012 +0200
Fix up ctrl up/down inside scrolled window
src/contacts-sorted.vala | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/src/contacts-sorted.vala b/src/contacts-sorted.vala
index fa2b83c..3d5e25e 100644
--- a/src/contacts-sorted.vala
+++ b/src/contacts-sorted.vala
@@ -126,12 +126,32 @@ public class Contacts.Sorted : Container {
child = get_last_visible ();
break;
case MovementStep.DISPLAY_LINES:
+ if (cursor_child != null) {
+ SequenceIter<ChildInfo?>? iter = cursor_child.iter;
+
+ while (count < 0 && iter != null) {
+ iter = get_previous_visible (iter);
+ count++;
+ }
+ while (count > 0 && iter != null) {
+ iter = get_next_visible (iter);
+ count--;
+ }
+ if (iter != null && !iter.is_end ()) {
+ child = iter.get ();
+ }
+ }
break;
default:
return;
}
+ if (child == null) {
+ error_bell ();
+ return;
+ }
+
update_cursor (child);
if (!modify_selection_pressed)
update_selected (child);
@@ -168,6 +188,16 @@ public class Contacts.Sorted : Container {
add_move_binding (binding_set, Gdk.Key.KP_End, 0,
MovementStep.BUFFER_ENDS, 1);
+ add_move_binding (binding_set, Gdk.Key.Up, Gdk.ModifierType.CONTROL_MASK,
+ MovementStep.DISPLAY_LINES, -1);
+ add_move_binding (binding_set, Gdk.Key.KP_Up, Gdk.ModifierType.CONTROL_MASK,
+ MovementStep.DISPLAY_LINES, -1);
+
+ add_move_binding (binding_set, Gdk.Key.Down, Gdk.ModifierType.CONTROL_MASK,
+ MovementStep.DISPLAY_LINES, 1);
+ add_move_binding (binding_set, Gdk.Key.KP_Down, Gdk.ModifierType.CONTROL_MASK,
+ MovementStep.DISPLAY_LINES, 1);
+
/* TODO: Add PgUp/PgDown */
BindingEntry.add_signal (binding_set, Gdk.Key.space, Gdk.ModifierType.CONTROL_MASK,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]