aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-log-window.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-08-05 12:43:00 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-08-05 12:43:00 +0800
commite15b7f70a43898e4978836fdf8efbed0bebeaea4 (patch)
treed4410e2aa4174ba26a471507f29b82e25f9d6282 /libempathy-gtk/empathy-log-window.c
parent79de445e7b21747cbc7893737a5d6756da184274 (diff)
downloadgsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.tar
gsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.tar.gz
gsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.tar.bz2
gsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.tar.lz
gsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.tar.xz
gsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.tar.zst
gsoc2013-empathy-e15b7f70a43898e4978836fdf8efbed0bebeaea4.zip
Replace highlighting of search strings
Diffstat (limited to 'libempathy-gtk/empathy-log-window.c')
-rw-r--r--libempathy-gtk/empathy-log-window.c47
1 files changed, 6 insertions, 41 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 8869d4acd..b5c2e48cf 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -1254,47 +1254,6 @@ log_window_append_chat_message (TplEvent *event,
alias = g_markup_escape_text (
tpl_entity_get_alias (tpl_event_get_sender (event)), -1);
- // /* If the user is searching, highlight the matched text */
- // if (!EMP_STR_EMPTY (log_window->priv->last_find))
- // {
- // gchar *str = g_regex_escape_string (log_window->priv->last_find, -1);
- // gchar *replacement = g_markup_printf_escaped (
- // "<span background=\"yellow\">%s</span>",
- // log_window->priv->last_find);
- // GError *error = NULL;
- // GRegex *regex = g_regex_new (str, 0, 0, &error);
-
- // if (regex == NULL)
- // {
- // DEBUG ("Could not create regex: %s", error->message);
- // g_error_free (error);
- // }
- // else
- // {
- // gchar *new_msg = g_regex_replace_literal (regex,
- // empathy_message_get_body (message), -1, 0, replacement,
- // 0, &error);
-
- // if (new_msg != NULL)
- // {
- // /* We pass ownership of new_msg to msg, which is freed later */
- // g_free (msg);
- // msg = new_msg;
- // }
- // else
- // {
- // DEBUG ("Error while performing string substitution: %s",
- // error->message);
- // g_error_free (error);
- // }
- // }
-
- // g_free (str);
- // g_free (replacement);
-
- // tp_clear_pointer (&regex, g_regex_unref);
- // }
-
/* escape the text */
parsers = empathy_webkit_get_string_parser (
g_settings_get_boolean (log_window->priv->gsettings_chat,
@@ -1977,6 +1936,8 @@ log_window_find_populate (EmpathyLogWindow *self,
if (EMP_STR_EMPTY (search_criteria))
{
tp_clear_pointer (&self->priv->hits, tpl_log_manager_search_free);
+ webkit_web_view_set_highlight_text_matches (
+ WEBKIT_WEB_VIEW (self->priv->webview), FALSE);
log_window_who_populate (self);
return;
}
@@ -1985,6 +1946,10 @@ log_window_find_populate (EmpathyLogWindow *self,
log_window_when_changed_cb,
self);
+ /* highlight the search text */
+ webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW (self->priv->webview),
+ search_criteria, FALSE, 0);
+
tpl_log_manager_search_async (self->priv->log_manager,
search_criteria, TPL_EVENT_MASK_ANY,
log_manager_searched_new_cb, NULL);