From 8f42c1dd8fd57e6cb1275e3322e10005466e9d15 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 26 Mar 2010 11:05:06 -0400 Subject: Minor EMailReader cleanup. Add a load_string() method to EWebView. Have EMailDisplay override load_string() and check that the formatter is not busy before loading the string. Have EMailReader call e_web_view_load_string() directly on the EMailDisplay instance, and eliminate update_webview_content(). --- mail/e-mail-reader.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) (limited to 'mail/e-mail-reader.c') diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index d63118868f..1f7dc7c2b2 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1786,28 +1786,6 @@ mail_reader_message_read_cb (EMailReader *reader) return FALSE; } -static void -update_webview_content (EMailReader *reader, const gchar *content) -{ - EMFormatHTMLDisplay *html_display; - EWebView *web_view; - - g_return_if_fail (reader != NULL); - g_return_if_fail (content != NULL); - - html_display = e_mail_reader_get_html_display (reader); - g_return_if_fail (html_display != NULL); - - /* skip the progress message when it's formatting something */ - if (em_format_busy (EM_FORMAT (html_display))) - return; - - web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); - g_return_if_fail (web_view != NULL); - - e_web_view_load_string (web_view, content); -} - static void mail_reader_message_loaded_cb (CamelFolder *folder, const gchar *message_uid, @@ -1822,6 +1800,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder, EShellBackend *shell_backend; EShellSettings *shell_settings; EShell *shell; + EWebView *web_view; EMEvent *event; EMEventTargetMessage *target; const gchar *cursor_uid; @@ -1839,6 +1818,8 @@ mail_reader_message_loaded_cb (CamelFolder *folder, cursor_uid = MESSAGE_LIST (message_list)->cursor_uid; + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); + /* If the user picked a different message in the time it took * to fetch this message, then don't bother rendering it. */ if (g_strcmp0 (cursor_uid, message_uid) != 0) @@ -1897,10 +1878,11 @@ mail_reader_message_loaded_cb (CamelFolder *folder, _("Unable to retrieve message"), ex->desc); } else { - string = g_strdup_printf (_("Retrieving message '%s'"), cursor_uid); + string = g_strdup_printf ( + _("Retrieving message '%s'"), cursor_uid); } - update_webview_content (reader, string); + e_web_view_load_string (web_view, string); g_free (string); camel_exception_clear (ex); @@ -1919,6 +1901,7 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) EMailReaderPrivate *priv; EMFormatHTMLDisplay *html_display; GtkWidget *message_list; + EWebView *web_view; CamelFolder *folder; const gchar *cursor_uid; const gchar *format_uid; @@ -1932,6 +1915,8 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) cursor_uid = MESSAGE_LIST (message_list)->cursor_uid; format_uid = EM_FORMAT (html_display)->uid; + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); + if (MESSAGE_LIST (message_list)->last_sel_single) { GtkWidget *widget; gboolean html_display_visible; @@ -1954,8 +1939,9 @@ mail_reader_message_selected_timeout_cb (EMailReader *reader) gboolean store_async; MailMsgDispatchFunc disp_func; - string = g_strdup_printf (_("Retrieving message '%s'"), cursor_uid); - update_webview_content (reader, string); + string = g_strdup_printf ( + _("Retrieving message '%s'"), cursor_uid); + e_web_view_load_string (web_view, string); g_free (string); store_async = folder->parent_store->flags & CAMEL_STORE_ASYNC; -- cgit