[evolution] EWebView/EMailDisplay: Setup custom CSS styles to DOM right after document loads
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] EWebView/EMailDisplay: Setup custom CSS styles to DOM right after document loads
- Date: Thu, 13 Mar 2014 14:39:56 +0000 (UTC)
commit 7749f1a1c6035e87c2f5b8620d08954e70af2e6d
Author: Milan Crha <mcrha redhat com>
Date: Thu Mar 13 15:31:36 2014 +0100
EWebView/EMailDisplay: Setup custom CSS styles to DOM right after document loads
The custom styles, those which are added on-the-fly directly to DOM, were
added only after whole document was completely loaded, which included also
sub-frames content, thus when these were slow to download for any reason,
the main frame content, like the top header bar, was shown with a default
style, which is white background and black text color. The WebKitWebView's
document-load-finished signal is emitted whenever the actual HTML content
is loaded, and the DOM is available as well, for each frame, including
the main frame of the WebView, thus updating/setting custom CSS styles
in this signal handler makes the loaded frames look as expected, without
waiting for other frames in the document to finish their load.
e-util/e-web-view.c | 4 ++++
mail/e-mail-display.c | 3 +++
2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index 2578590..511f17e 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -1634,6 +1634,10 @@ e_web_view_init (EWebView *web_view)
NULL);
g_signal_connect (
+ web_view, "document-load-finished",
+ G_CALLBACK (style_updated_cb), NULL);
+
+ g_signal_connect (
web_view, "notify::load-status",
G_CALLBACK (web_view_load_status_changed_cb), NULL);
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index f063fd2..82dd8e9 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1547,6 +1547,9 @@ e_mail_display_init (EMailDisplay *display)
g_signal_connect (
main_frame, "notify::load-status",
G_CALLBACK (mail_parts_bind_dom), NULL);
+ g_signal_connect (
+ display, "document-load-finished",
+ G_CALLBACK (initialize_web_view_colors), NULL);
actions = e_web_view_get_action_group (E_WEB_VIEW (display), "mailto");
gtk_action_group_add_actions (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]