diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-25 22:24:37 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-06-09 19:34:55 +0800 |
commit | f1f313b03bb414cebfae33e34b7f7c3cc05253ee (patch) | |
tree | 4bdeba2adff3734b0cddacbde58373d222095fcb | |
parent | ce498170c595f9b6acec3a8a89f9f0fcb93f195d (diff) | |
download | gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.tar gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.tar.gz gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.tar.bz2 gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.tar.lz gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.tar.xz gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.tar.zst gsoc2013-empathy-f1f313b03bb414cebfae33e34b7f7c3cc05253ee.zip |
LogWindow: Add live search support
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index e20e1dd7f..aeb097c8e 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -88,6 +88,7 @@ typedef struct /* List of owned TplLogSearchHits, free with tpl_log_search_hit_free */ GList *hits; + guint source; /* Only used while waiting for the account chooser to be ready */ TpAccount *selected_account; @@ -524,6 +525,9 @@ static void log_window_destroy_cb (GtkWidget *widget, EmpathyLogWindow *window) { + if (window->source != 0) + g_source_remove (window->source); + g_free (window->last_find); _tpl_action_chain_free (window->chain); g_object_unref (window->log_manager); @@ -1362,7 +1366,7 @@ log_window_find_populate (EmpathyLogWindow *window, log_manager_searched_new_cb, NULL); } -static void +static gboolean start_find_search (EmpathyLogWindow *window) { const gchar *str; @@ -1371,19 +1375,24 @@ start_find_search (EmpathyLogWindow *window) /* Don't find the same crap again */ if (window->last_find && !tp_strdiff (window->last_find, str)) - return; + return FALSE; g_free (window->last_find); window->last_find = g_strdup (str); log_window_find_populate (window, str); + + return FALSE; } static void log_window_search_entry_changed_cb (GtkWidget *entry, EmpathyLogWindow *window) { - /* FIXME: live search ? */ + if (window->source != 0) + g_source_remove (window->source); + window->source = g_timeout_add (500, (GSourceFunc) start_find_search, + window); } static void |