Commit d43dc879 authored by Milan Crha's avatar Milan Crha

I#702 - "Body contains" leaves the search term selected in the email

Closes GNOME/evolution#702
parent d9b67c30
......@@ -263,10 +263,12 @@ web_view_load_changed_cb (WebKitWebView *webkit_web_view,
if (gtk_widget_get_visible (GTK_WIDGET (search_bar))) {
if (search_bar->priv->active_search != NULL) {
search_bar_find (search_bar, TRUE);
e_web_view_disable_highlights (search_bar->priv->web_view);
search_bar_find (search_bar, TRUE);
}
} else
} else {
e_web_view_update_highlights (search_bar->priv->web_view);
}
}
static void
......@@ -459,6 +461,7 @@ search_bar_show (GtkWidget *widget)
webkit_find_controller_search_finish (search_bar->priv->find_controller);
e_web_view_disable_highlights (search_bar->priv->web_view);
search_bar_find (search_bar, TRUE);
}
......
......@@ -60,6 +60,7 @@ struct _EWebViewPrivate {
gchar *cursor_image_src;
GQueue highlights;
gboolean highlights_enabled;
GtkAction *open_proxy;
GtkAction *print_proxy;
......@@ -511,6 +512,8 @@ webkit_find_controller_found_text_cb (WebKitFindController *find_controller,
guint match_count,
EWebView *web_view)
{
if (web_view->priv->highlights_enabled && !g_queue_is_empty (&web_view->priv->highlights))
e_web_view_unselect_all (web_view);
}
static void
......@@ -2425,6 +2428,7 @@ e_web_view_init (EWebView *web_view)
web_view->priv = E_WEB_VIEW_GET_PRIVATE (web_view);
web_view->priv->highlights_enabled = TRUE;
web_view->priv->old_settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
g_signal_connect (
......@@ -3011,9 +3015,18 @@ e_web_view_update_highlights (EWebView *web_view)
{
g_return_if_fail (E_IS_WEB_VIEW (web_view));
web_view->priv->highlights_enabled = TRUE;
web_view_update_document_highlights (web_view);
}
void
e_web_view_disable_highlights (EWebView *web_view)
{
g_return_if_fail (E_IS_WEB_VIEW (web_view));
web_view->priv->highlights_enabled = FALSE;
}
GtkAction *
e_web_view_get_action (EWebView *web_view,
const gchar *action_name)
......@@ -3111,11 +3124,9 @@ e_web_view_select_all (EWebView *web_view)
void
e_web_view_unselect_all (EWebView *web_view)
{
#if 0 /* WEBKIT */
g_return_if_fail (E_IS_WEB_VIEW (web_view));
gtk_html_command (GTK_HTML (web_view), "unselect-all");
#endif
webkit_web_view_execute_editing_command (WEBKIT_WEB_VIEW (web_view), "Unselect");
}
void
......
......@@ -197,6 +197,7 @@ void e_web_view_add_highlight (EWebView *web_view,
const gchar *highlight);
void e_web_view_clear_highlights (EWebView *web_view);
void e_web_view_update_highlights (EWebView *web_view);
void e_web_view_disable_highlights (EWebView *web_view);
GtkAction * e_web_view_get_action (EWebView *web_view,
const gchar *action_name);
GtkActionGroup *e_web_view_get_action_group (EWebView *web_view,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment