[evolution/gnome-3-34] I#702 - "Body contains" leaves the search term selected in the email
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-34] I#702 - "Body contains" leaves the search term selected in the email
- Date: Mon, 11 Nov 2019 15:57:22 +0000 (UTC)
commit aaf74ac8f871aa8ec807c84a953259cba72827db
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 11 16:58:02 2019 +0100
I#702 - "Body contains" leaves the search term selected in the email
Closes https://gitlab.gnome.org/GNOME/evolution/issues/702
src/e-util/e-search-bar.c | 7 +++++--
src/e-util/e-web-view.c | 17 ++++++++++++++---
src/e-util/e-web-view.h | 1 +
3 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/e-util/e-search-bar.c b/src/e-util/e-search-bar.c
index 7177031ee3..36a8432256 100644
--- a/src/e-util/e-search-bar.c
+++ b/src/e-util/e-search-bar.c
@@ -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);
}
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 79ac1ecfb3..486cef0109 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -63,6 +63,7 @@ struct _EWebViewPrivate {
gchar *cursor_image_src;
GQueue highlights;
+ gboolean highlights_enabled;
GtkAction *open_proxy;
GtkAction *print_proxy;
@@ -528,6 +529,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
@@ -2473,6 +2476,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->container = e_web_extension_container_new (E_WEB_EXTENSION_OBJECT_PATH,
E_WEB_EXTENSION_INTERFACE);
web_view->priv->old_settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
(GDestroyNotify) g_variant_unref);
@@ -3188,9 +3192,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)
@@ -3312,11 +3325,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
diff --git a/src/e-util/e-web-view.h b/src/e-util/e-web-view.h
index 474140dfb6..cb4480c7d4 100644
--- a/src/e-util/e-web-view.h
+++ b/src/e-util/e-web-view.h
@@ -201,6 +201,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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]