diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-10-23 07:24:01 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-10-23 07:24:01 +0800 |
commit | 4807a4d7e75993aefc6860d2747403a7019c49e7 (patch) | |
tree | 75ee11bb941d832314eb18ad115687f91d9682f4 /mail/mail-display.c | |
parent | dcc5cbe678dace542549f17a3db99d26450a1ea4 (diff) | |
download | gsoc2013-evolution-4807a4d7e75993aefc6860d2747403a7019c49e7.tar.gz gsoc2013-evolution-4807a4d7e75993aefc6860d2747403a7019c49e7.tar.zst gsoc2013-evolution-4807a4d7e75993aefc6860d2747403a7019c49e7.zip |
New class that wraps writing to a GtkHTML stream so that we don't have to
2001-10-22 Jeffrey Stedfast <fejj@ximian.com>
* mail-stream-gtkhtml.c (mail_stream_gtkhtml_new): New class that
wraps writing to a GtkHTML stream so that we don't have to write
to an intermediate GByteArray.
* mail-display.c (on_url_requested): Use the new Camel->GtkHTML
stream - this means we don't have to chew up nearly as much
memory...yay!
svn path=/trunk/; revision=13911
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r-- | mail/mail-display.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c index ebe1a5147c..7e038d0b99 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -45,6 +45,7 @@ #include "e-searching-tokenizer.h" #include "folder-browser-factory.h" +#include "mail-stream-gtkhtml.h" #include "mail-display.h" #include "mail-config.h" #include "mail-ops.h" @@ -1043,7 +1044,6 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, if (medium) { CamelContentType *content_type; CamelDataWrapper *data; - CamelStream *stream_mem; g_return_if_fail (CAMEL_IS_MEDIUM (medium)); @@ -1055,18 +1055,17 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, if (header_content_type_is (content_type, "text", "*")) { ba = mail_format_get_data_wrapper_text (data, md); + if (ba) { + gtk_html_write (html, handle, ba->data, ba->len); + + g_byte_array_free (ba, TRUE); + } } else { - ba = g_byte_array_new (); - stream_mem = camel_stream_mem_new (); - camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream_mem), ba); - camel_data_wrapper_write_to_stream (data, stream_mem); - camel_object_unref (CAMEL_OBJECT (stream_mem)); - } - - if (ba) { - gtk_html_write (html, handle, ba->data, ba->len); + CamelStream *html_stream; - g_byte_array_free (ba, TRUE); + html_stream = mail_stream_gtkhtml_new (html, handle); + camel_data_wrapper_write_to_stream (data, html_stream); + camel_object_unref (CAMEL_OBJECT (html_stream)); } gtk_html_end (html, handle, GTK_HTML_STREAM_OK); @@ -1075,7 +1074,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle, urls = g_datalist_get_data (md->data, "data_urls"); g_return_if_fail (urls != NULL); - + /* See if it's some piece of cached data */ ba = g_hash_table_lookup (urls, url); if (ba) { |