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-04-25 22:24:37 +0800 |
commit | f860a6830e791eaf6d38602423a6a0cabab820d2 (patch) | |
tree | 014b7b2fedf41feba67daea12bcec4efc252d022 /libempathy-gtk | |
parent | 2b858f37d87af235a4188358dce1a5e06599a816 (diff) | |
download | gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.tar gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.tar.gz gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.tar.bz2 gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.tar.lz gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.tar.xz gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.tar.zst gsoc2013-empathy-f860a6830e791eaf6d38602423a6a0cabab820d2.zip |
LogWindow: Add live search support
Diffstat (limited to 'libempathy-gtk')
-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 663edf394..22eecf488 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -87,6 +87,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; @@ -523,6 +524,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); @@ -1358,7 +1362,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; @@ -1367,19 +1371,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 |