[evolution] Bug 733877 - Parse attachments on demand, not on message open



commit cecc70d507f5372cada2726a0bbd8cbd80b31492
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 25 16:22:01 2015 +0200

    Bug 733877 - Parse attachments on demand, not on message open

 em-format/e-mail-formatter-attachment.c |   11 ++++++-----
 mail/e-mail-display.c                   |   15 +++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c
index 0a92157..643b839 100644
--- a/em-format/e-mail-formatter-attachment.c
+++ b/em-format/e-mail-formatter-attachment.c
@@ -320,7 +320,7 @@ emfe_attachment_format (EMailFormatterExtension *extension,
                }
 
                if (success) {
-                       gchar *wrapper_element_id;
+                       gchar *wrapper_element_id, *inner_html_data;
                        gconstpointer data;
                        gsize size;
 
@@ -332,17 +332,18 @@ emfe_attachment_format (EMailFormatterExtension *extension,
                        size = g_memory_output_stream_get_data_size (
                                G_MEMORY_OUTPUT_STREAM (content_stream));
 
+                       inner_html_data = g_markup_escape_text (data, size);
+
                        g_string_append_printf (
                                buffer,
                                "<tr><td colspan=\"2\">"
-                               "<div class=\"attachment-wrapper\" id=\"%s\">",
-                               wrapper_element_id);
-
-                       g_string_append_len (buffer, data, size);
+                               "<div class=\"attachment-wrapper\" id=\"%s\" inner-html-data=\"%s\">",
+                               wrapper_element_id, inner_html_data);
 
                        g_string_append (buffer, "</div></td></tr>");
 
                        g_free (wrapper_element_id);
+                       g_free (inner_html_data);
                }
 
                g_object_unref (content_stream);
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 83087f8..4f70f5d 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -570,6 +570,21 @@ attachment_button_expanded (GObject *object,
                return;
        }
 
+       if (WEBKIT_DOM_IS_HTML_ELEMENT (element) && expanded &&
+           webkit_dom_element_get_child_element_count (element) == 0) {
+               gchar *inner_html_data;
+
+               inner_html_data = webkit_dom_element_get_attribute (element, "inner-html-data");
+               if (inner_html_data && *inner_html_data) {
+                       WebKitDOMHTMLElement *html_element;
+
+                       html_element = WEBKIT_DOM_HTML_ELEMENT (element);
+                       webkit_dom_html_element_set_inner_html (html_element, inner_html_data, NULL);
+               }
+
+               g_free (inner_html_data);
+       }
+
        /* Show or hide the DIV which contains
         * the attachment (iframe, image...). */
        css = webkit_dom_element_get_style (element);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]