[gnome-contacts] Work around issue with lost grab when displaying the search first time



commit 51809486c38ec60e767fcef7e95749cd3d5b4f43
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Jan 20 12:16:26 2012 +0100

    Work around issue with lost grab when displaying the search first time

 src/contacts-list-pane.vala |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index eb3238b..0fa2249 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -61,7 +61,18 @@ public class Contacts.ListPane : Frame {
     search_visible = visible;
     if (visible) {
       search_revealer.reveal ();
-      filter_entry.grab_focus ();
+      Utils.grab_entry_focus_no_select (filter_entry);
+      if (!filter_entry.get_visible ()) {
+	/* When the toolbar size_allocate happens we initially allocate it too small
+	 * for some reason, which makes the toolbar set the child as invisible
+	 * (as its outside the toolbar size), which causes it to lose focus, so we re-set it
+	 */
+	ulong tag = 0;
+	tag = filter_entry.size_allocate.connect ( (allocation) => {
+	    Utils.grab_entry_focus_no_select (filter_entry);
+	    filter_entry.disconnect (tag);
+	  });
+      }
     } else {
       search_revealer.unreveal ();
       filter_entry.set_text ("");



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