[gnome-contacts/wip/sorted] Add update_focus helper



commit 3ac7deb791f07f6683aa4f438f4dd03b9f5df5cc
Author: Alexander Larsson <alexl redhat com>
Date:   Fri May 11 10:12:50 2012 +0200

    Add update_focus helper

 src/contacts-sorted.vala |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/contacts-sorted.vala b/src/contacts-sorted.vala
index 35b2b13..cfeece5 100644
--- a/src/contacts-sorted.vala
+++ b/src/contacts-sorted.vala
@@ -102,17 +102,20 @@ public class Contacts.Sorted : Container {
     return child_info;
   }
 
+  private void update_focus (ChildInfo? child) {
+    focus_child = child;
+    this.grab_focus ();
+    this.queue_draw ();
+  }
+
   private void update_selected (ChildInfo? child) {
     if (child != selected_child) {
       selected_child = child;
       child_selected (selected_child != null ? selected_child.widget : null);
       queue_draw ();
     }
-    if (child != null) {
-      focus_child = child;
-      this.grab_focus ();
-      this.queue_draw ();
-    }
+    if (child != null)
+      update_focus (child);
   }
 
   private void update_prelight (ChildInfo? child) {
@@ -252,9 +255,7 @@ public class Contacts.Sorted : Container {
     if (next_focus_child == null)
       return false;
 
-    focus_child = next_focus_child;
-    this.grab_focus ();
-    this.queue_draw ();
+    update_focus (next_focus_child);
 
     return true;
   }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]