summaryrefslogtreecommitdiff
path: root/gtk/gtksearchentry.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-05-21 18:31:10 +0200
committerBastien Nocera <hadess@hadess.net>2013-05-23 20:53:30 +0200
commit536fc22de4f4dfe9f1962e8f825c097ba81282c1 (patch)
treeac4dae1f7763f906b8951741f0bdc2dfbb32d6e4 /gtk/gtksearchentry.c
parent1bfbfbc50c6aad5f3dc578d87174fc9942e5e249 (diff)
downloadgtk+-536fc22de4f4dfe9f1962e8f825c097ba81282c1.tar.gz
GtkSearchEntry: Don't wait for timeout when emptying
When the text entry gets cleared, emit the "changed" signal straight away. This avoids a lag when dismissing a search. https://bugzilla.gnome.org/show_bug.cgi?id=700787
Diffstat (limited to 'gtk/gtksearchentry.c')
-rw-r--r--gtk/gtksearchentry.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtksearchentry.c b/gtk/gtksearchentry.c
index b79705b3ee..c29faab000 100644
--- a/gtk/gtksearchentry.c
+++ b/gtk/gtksearchentry.c
@@ -124,6 +124,7 @@ search_entry_changed_cb (GtkSearchEntry *entry,
GtkSearchEntryPrivate *priv = GET_PRIV (entry);
const char *str, *icon_name;
gboolean active;
+ gboolean cleared = FALSE;
/* Update the icons first */
str = gtk_entry_get_text (GTK_ENTRY (entry));
@@ -132,6 +133,7 @@ search_entry_changed_cb (GtkSearchEntry *entry,
{
icon_name = NULL;
active = FALSE;
+ cleared = TRUE;
}
else
{
@@ -153,6 +155,11 @@ search_entry_changed_cb (GtkSearchEntry *entry,
if (priv->in_timeout)
return;
+ /* Don't emit the signal in a timeout if we've cleared
+ * the entry, we don't want a delay */
+ if (cleared)
+ return;
+
/* Queue up the timeout */
reset_timeout (entry);
g_signal_stop_emission_by_name (entry, "changed");