[evolution] EWebView: Unset has-selection flag on content load start
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EWebView: Unset has-selection flag on content load start
- Date: Thu, 9 Jun 2022 06:12:58 +0000 (UTC)
commit 8cb5fbbcf4250b56f751536b57596198da343167
Author: Milan Crha <mcrha redhat com>
Date: Thu Jun 9 08:10:21 2022 +0200
EWebView: Unset has-selection flag on content load start
The flag could be left set from the previous content, thus
unset it, to stay consistent with the GUI. The outcome was
that the related actions in the context menu had been shown
even when they should not be.
src/e-util/e-web-view.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 68f86e8c59..d120236eb1 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -844,6 +844,20 @@ style_updated_cb (EWebView *web_view)
e_web_view_update_styles (web_view, "*");
}
+static void
+e_web_view_set_has_selection (EWebView *web_view,
+ gboolean has_selection)
+{
+ g_return_if_fail (E_IS_WEB_VIEW (web_view));
+
+ if ((!web_view->priv->has_selection) == (!has_selection))
+ return;
+
+ web_view->priv->has_selection = has_selection;
+
+ g_object_notify (G_OBJECT (web_view), "has-selection");
+}
+
static void
web_view_load_changed_cb (WebKitWebView *webkit_web_view,
WebKitLoadEvent load_event,
@@ -853,8 +867,10 @@ web_view_load_changed_cb (WebKitWebView *webkit_web_view,
web_view = E_WEB_VIEW (webkit_web_view);
- if (load_event == WEBKIT_LOAD_STARTED)
+ if (load_event == WEBKIT_LOAD_STARTED) {
g_hash_table_remove_all (web_view->priv->element_clicked_cbs);
+ e_web_view_set_has_selection (web_view, FALSE);
+ }
if (load_event != WEBKIT_LOAD_FINISHED)
return;
@@ -1482,21 +1498,6 @@ e_web_view_content_loaded_cb (WebKitUserContentManager *manager,
g_free (iframe_id);
}
-static void
-e_web_view_set_has_selection (EWebView *web_view,
- gboolean has_selection)
-{
- g_return_if_fail (E_IS_WEB_VIEW (web_view));
-
- if ((!web_view->priv->has_selection) == (!has_selection))
- return;
-
- web_view->priv->has_selection = has_selection;
-
- g_object_notify (G_OBJECT (web_view), "has-selection");
-}
-
-
static void
e_web_view_has_selection_cb (WebKitUserContentManager *manager,
WebKitJavascriptResult *js_result,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]