diff options
author | Mike Ruprecht <mike.ruprecht@collabora.co.uk> | 2010-02-23 11:23:43 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2010-02-26 09:04:27 +0800 |
commit | 3403dfda538c4ff2d3eacfb3b148602d493033ea (patch) | |
tree | 399fb68193bf0bc2c2f5b8f29dcb9921b995b59d | |
parent | 9010489b970c479609c095ec6b15b1e893e8b548 (diff) | |
download | gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.tar gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.tar.gz gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.tar.bz2 gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.tar.lz gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.tar.xz gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.tar.zst gsoc2013-empathy-3403dfda538c4ff2d3eacfb3b148602d493033ea.zip |
Add the capability to search debug messages in the debug window.
-rw-r--r-- | src/empathy-debug-window.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/empathy-debug-window.c b/src/empathy-debug-window.c index f15bb3def..6c0c9c69e 100644 --- a/src/empathy-debug-window.c +++ b/src/empathy-debug-window.c @@ -1165,6 +1165,37 @@ debug_window_key_press_event_cb (GtkWidget *widget, return FALSE; } +static gboolean +tree_view_search_equal_func_cb (GtkTreeModel *model, + gint column, + const gchar *key, + GtkTreeIter *iter, + gpointer search_data) +{ + gchar *str; + gint key_len; + gint len; + gint i; + gboolean ret = TRUE; /* The return value is counter-intuitive */ + + gtk_tree_model_get (model, iter, column, &str, -1); + + key_len = strlen (key); + len = strlen (str) - key_len; + + for (i = 0; i <= len; ++i) + { + if (!g_ascii_strncasecmp (key, str + i, key_len)) + { + ret = FALSE; + break; + } + } + + g_free (str); + return ret; +} + static GObject * debug_window_constructor (GType type, guint n_construct_params, @@ -1373,6 +1404,11 @@ debug_window_constructor (GType type, gtk_tree_view_set_model (GTK_TREE_VIEW (priv->view), priv->store_filter); + gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->view), + COL_DEBUG_MESSAGE); + gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (priv->view), + tree_view_search_equal_func_cb, NULL, NULL); + /* Scrolled window */ priv->scrolled_win = g_object_ref (gtk_scrolled_window_new (NULL, NULL)); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_win), |