aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2010-06-15 17:43:52 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2010-06-15 17:43:52 +0300
commited664236929a6e2ab4c188180c9e19de75684f09 (patch)
tree398aa254d9879e76c80be331efb86381203b8791
parenta839e9363a9099518d9fb046aae27d293a50de93 (diff)
Don't filter asynchronously when hildon_live_search_set_text() called
This is because calls to hildon_live_search_set_text() followed by a retrieval of the selection will then break, and at least addressbook assumes that this will happen synchronously. Since we only want to give better responsiveness in the case when the user is typing, no need to go fully asynchronously.
-rw-r--r--hildon/hildon-live-search.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/hildon/hildon-live-search.c b/hildon/hildon-live-search.c
index 922c5ad..f196e73 100644
--- a/hildon/hildon-live-search.c
+++ b/hildon/hildon-live-search.c
@@ -70,6 +70,7 @@ struct _HildonLiveSearchPrivate
gpointer visible_data;
GDestroyNotify visible_destroy;
gboolean visible_func_set;
+ gboolean run_async;
};
enum
@@ -440,8 +441,16 @@ on_entry_changed (GtkEntry *entry,
g_free (priv->prefix);
priv->prefix = g_strdup (text);
- if (priv->idle_filter_id == 0) {
- priv->idle_filter_id = gdk_threads_add_idle ((GSourceFunc) on_idle_refilter, livesearch);
+ if (priv->run_async) {
+ if (priv->idle_filter_id == 0) {
+ priv->idle_filter_id = gdk_threads_add_idle ((GSourceFunc) on_idle_refilter, livesearch);
+ }
+ } else {
+ if (priv->idle_filter_id != 0) {
+ g_source_remove (priv->idle_filter_id);
+ priv->idle_filter_id = 0;
+ }
+ on_idle_refilter (livesearch);
}
/* Show the livesearch only if there is text in it */
@@ -502,8 +511,10 @@ hildon_live_search_set_text (HildonLiveSearch *livesearch,
g_return_if_fail (HILDON_IS_LIVE_SEARCH (livesearch));
g_return_if_fail (NULL != text);
+ livesearch->priv->run_async = FALSE;
gtk_entry_set_text (GTK_ENTRY (livesearch->priv->entry),
text);
+ livesearch->priv->run_async = TRUE;
/* GObject::notify::text for HildonLiveSearch:text emitted in the
handler for GtkEntry::changed. */
@@ -791,6 +802,7 @@ hildon_live_search_init (HildonLiveSearch *self)
priv->idle_filter_id = 0;
priv->selection_map = NULL;
+ priv->run_async = TRUE;
priv->text_column = -1;