[tracker] TrackerSearchBar: Do not trigger window popup on every key press.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] TrackerSearchBar: Do not trigger window popup on every key press.
- Date: Tue, 23 Mar 2010 13:09:39 +0000 (UTC)
commit 19369e6ce91551147dcec7f6be092d987e838f1a
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Mar 23 11:50:23 2010 +0100
TrackerSearchBar: Do not trigger window popup on every key press.
We now obey GtkEditable::changed, which will only be triggered on
user-visible input.
src/tracker-search-bar/tracker-applet.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/tracker-search-bar/tracker-applet.c b/src/tracker-search-bar/tracker-applet.c
index 8389fa0..9204aea 100644
--- a/src/tracker-search-bar/tracker-applet.c
+++ b/src/tracker-search-bar/tracker-applet.c
@@ -132,6 +132,20 @@ applet_entry_button_press_event_cb (GtkWidget *widget,
return FALSE;
}
+static void
+applet_entry_editable_changed_cb (GtkWidget *widget,
+ TrackerApplet *applet)
+{
+ if (applet->new_search_id) {
+ g_source_remove (applet->new_search_id);
+ }
+
+ applet->new_search_id =
+ g_timeout_add (300,
+ applet_entry_start_search_cb,
+ applet);
+}
+
static gboolean
applet_entry_key_press_event_cb (GtkWidget *widget,
GdkEventKey *event,
@@ -150,15 +164,6 @@ applet_entry_key_press_event_cb (GtkWidget *widget,
}
gtk_widget_grab_focus (applet->results);
- } else {
- if (applet->new_search_id) {
- g_source_remove (applet->new_search_id);
- }
-
- applet->new_search_id =
- g_timeout_add (300,
- applet_entry_start_search_cb,
- applet);
}
return FALSE;
@@ -215,6 +220,9 @@ applet_draw (gpointer user_data)
g_signal_connect (applet->entry,
"button_press_event",
G_CALLBACK (applet_entry_button_press_event_cb), applet);
+ g_signal_connect (applet->entry,
+ "changed",
+ G_CALLBACK (applet_entry_editable_changed_cb), applet);
g_signal_connect (applet->entry,
"key_press_event",
G_CALLBACK (applet_entry_key_press_event_cb), applet);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]