[gnome-contacts] Don't immediately search, wait 300msec first
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Don't immediately search, wait 300msec first
- Date: Fri, 17 Jun 2011 14:08:07 +0000 (UTC)
commit 530df97e9c52638113647fd265bc5770fec4de11
Author: Alexander Larsson <alexl redhat com>
Date: Fri Jun 17 13:37:45 2011 +0200
Don't immediately search, wait 300msec first
src/contacts-list-pane.vala | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index e1ffa1b..b81090b 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -24,6 +24,7 @@ public class Contacts.ListPane : Frame {
private Store contacts_store;
private TreeView contacts_tree_view;
public Entry filter_entry;
+ private uint filter_entry_changed_id;
public IndividualAggregator aggregator { get; private set; }
public BackendStore backend_store { get; private set; }
@@ -106,9 +107,9 @@ public class Contacts.ListPane : Frame {
tree_view.append_column (column);
}
- private void filter_entry_changed (Editable editable) {
+ private void refilter () {
string []? values;
- string str = (editable as Entry).get_text ();
+ string str = filter_entry.get_text ();
if (str.length == 0)
values = null;
@@ -120,6 +121,19 @@ public class Contacts.ListPane : Frame {
contacts_store.set_filter_values (values);
}
+ private bool filter_entry_changed_timeout () {
+ filter_entry_changed_id = 0;
+ refilter ();
+ return false;
+ }
+
+ private void filter_entry_changed (Editable editable) {
+ if (filter_entry_changed_id != 0)
+ Source.remove (filter_entry_changed_id);
+
+ filter_entry_changed_id = Timeout.add (300, filter_entry_changed_timeout);
+ }
+
private void contacts_selection_changed (TreeSelection selection) {
TreeIter iter;
TreeModel model;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]