[gnome-contacts] Show the search field by default
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Show the search field by default
- Date: Wed, 5 Sep 2012 09:42:47 +0000 (UTC)
commit 1a60f45c6ba78f844e4e927ebb89ce3bd5f82c93
Author: Alexander Larsson <alexl redhat com>
Date: Wed Sep 5 11:41:44 2012 +0200
Show the search field by default
It was decided at the UX hackfest that we should always show
the search bar.
https://bugzilla.gnome.org/show_bug.cgi?id=672969
src/contacts-app.vala | 4 ++--
src/contacts-list-pane.vala | 37 +------------------------------------
2 files changed, 3 insertions(+), 38 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index cd7d3cf..3c6a362 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -43,7 +43,7 @@ public class Contacts.App : Gtk.Application {
} else if (((event.keyval == Gdk.Key.s) ||
(event.keyval == Gdk.Key.f)) &&
((event.state & Gdk.ModifierType.CONTROL_MASK) != 0)) {
- list_pane.set_search_visible (true);
+ Utils.grab_entry_focus_no_select (list_pane.filter_entry);
} else if (event.length >= 1 &&
Gdk.keyval_to_unicode (event.keyval) != 0 &&
(event.state & Gdk.ModifierType.CONTROL_MASK) == 0 &&
@@ -51,7 +51,7 @@ public class Contacts.App : Gtk.Application {
(event.keyval != Gdk.Key.Escape) &&
(event.keyval != Gdk.Key.Tab) &&
(event.keyval != Gdk.Key.BackSpace) ) {
- list_pane.set_search_visible (true);
+ Utils.grab_entry_focus_no_select (list_pane.filter_entry);
window.propagate_key_event (event);
}
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index eec5b04..7a98071 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -25,7 +25,6 @@ public class Contacts.ListPane : Frame {
public Entry filter_entry;
private uint filter_entry_changed_id;
private bool ignore_selection_change;
- private Revealer search_revealer;
private bool search_visible;
public signal void selection_changed (Contact? contact);
@@ -54,28 +53,6 @@ public class Contacts.ListPane : Frame {
return false;
}
- public void set_search_visible (bool visible) {
- search_visible = visible;
- if (visible) {
- search_revealer.reveal ();
- 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 ("");
- }
- }
-
private void filter_entry_changed (Editable editable) {
if (filter_entry_changed_id != 0)
Source.remove (filter_entry_changed_id);
@@ -102,9 +79,6 @@ public class Contacts.ListPane : Frame {
toolbar.set_vexpand (false);
toolbar.set_hexpand (true);
- search_revealer = new Revealer ();
- search_revealer.add (toolbar);
-
contacts_view.set_show_subset (View.Subset.MAIN);
filter_entry = new Entry ();
@@ -112,13 +86,6 @@ public class Contacts.ListPane : Frame {
filter_entry.changed.connect (filter_entry_changed);
filter_entry.icon_press.connect (filter_entry_clear);
- filter_entry.key_press_event.connect ( (key_event) => {
- if (key_event.keyval == Gdk.Key.Escape) {
- set_search_visible (false);
- }
- return false;
- });
-
var search_entry_item = new ToolItem ();
search_entry_item.is_important = false;
search_entry_item.set_expand (true);
@@ -147,12 +114,10 @@ public class Contacts.ListPane : Frame {
contacts_view.show_all ();
scrolled.set_no_show_all (true);
- grid.add (search_revealer);
+ grid.add (toolbar);
grid.add (scrolled);
this.show_all ();
- search_revealer.set_no_show_all (true);
- search_revealer.hide ();
scrolled.show ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]