summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbkma <[email protected]>2021-06-04 13:49:26 +0200
committerraveit65 <[email protected]>2021-07-10 13:51:42 +0200
commit88e8547e92c3694326c25417ea813942a7b24862 (patch)
tree01f9a7160ad32f609a6f0b42295523589ce44ec2
parent50d0b23c608020dd1da3fb3e13883941182ec89e (diff)
downloadatril-88e8547e92c3694326c25417ea813942a7b24862.tar.bz2
atril-88e8547e92c3694326c25417ea813942a7b24862.tar.xz
ev-window.c: only create a EvWebView if needed
A WebKit processes should only be created when the user actually requests to open a file type requiring WebKit to be processed.
-rw-r--r--shell/ev-window.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 348e62b9..79afaa37 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -1787,6 +1787,14 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document)
ev_view_disconnect_handlers(EV_VIEW(ev_window->priv->view));
g_object_unref(ev_window->priv->view);
ev_window->priv->view = NULL;
+
+ if (ev_window->priv->webview == NULL)
+ {
+ ev_window->priv->webview = ev_web_view_new();
+ ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model);
+ ev_web_view_reload(EV_WEB_VIEW(ev_window->priv->webview));
+ }
+
gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
ev_window->priv->webview);
gtk_widget_show(ev_window->priv->webview);
@@ -8089,9 +8097,8 @@ ev_window_init (EvWindow *ev_window)
ev_window->priv->view = ev_view_new ();
-#if ENABLE_EPUB /*The webview, we won't add it now but it will replace the atril-view if a web(epub) document is encountered.*/
- ev_window->priv->webview = ev_web_view_new();
- ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model);
+#if ENABLE_EPUB /* The webview is created in ev_window_set_document only if the document is a webdocument. */
+ ev_window->priv->webview = NULL;
#endif
page_cache_mb = g_settings_get_uint (ev_window_ensure_settings (ev_window),
GS_PAGE_CACHE_SIZE);