diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2014-02-25 23:23:11 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2014-03-01 03:38:11 +0800 |
commit | f4bb7d7748f3c407858e9c844d365411c586d861 (patch) | |
tree | 5946af137b2439857433fd9729ba758e9cd3c05d /composer | |
parent | c3f8c95322ca7e461444820c7469d5527c239b05 (diff) | |
download | gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.tar gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.tar.gz gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.tar.bz2 gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.tar.lz gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.tar.xz gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.tar.zst gsoc2013-evolution-f4bb7d7748f3c407858e9c844d365411c586d861.zip |
EMailFormatter: Use GOutputStream instead of CamelStream.
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-msg-composer.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 0ac90e67f5..dddd59a89c 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -187,8 +187,7 @@ emcu_part_to_html (EMsgComposer *composer, GCancellable *cancellable) { CamelSession *session; - CamelStreamMem *mem; - GByteArray *buf; + GOutputStream *stream; gchar *text; EMailParser *parser; EMailFormatter *formatter; @@ -227,9 +226,7 @@ emcu_part_to_html (EMsgComposer *composer, return NULL; } - buf = g_byte_array_new (); - mem = (CamelStreamMem *) camel_stream_mem_new (); - camel_stream_mem_set_byte_array (mem, buf); + stream = g_memory_output_stream_new_resizable (); formatter = e_mail_formatter_quote_new ( NULL, keep_signature ? E_MAIL_FORMATTER_QUOTE_FLAG_KEEP_SIG : 0); @@ -238,19 +235,23 @@ emcu_part_to_html (EMsgComposer *composer, gtk_widget_get_state_flags (GTK_WIDGET (window))); e_mail_formatter_format_sync ( - formatter, part_list, (CamelStream *) mem, + formatter, part_list, stream, 0, E_MAIL_FORMATTER_MODE_PRINTING, cancellable); + g_object_unref (formatter); g_object_unref (part_list); - camel_stream_write ((CamelStream *) mem, "", 1, cancellable, NULL); - g_object_unref (mem); + g_output_stream_write (stream, "", 1, NULL, NULL); + + g_output_stream_close (stream, NULL, NULL); - text = (gchar *) buf->data; - if (len) - *len = buf->len - 1; + text = g_memory_output_stream_steal_data ( + G_MEMORY_OUTPUT_STREAM (stream)); - g_byte_array_free (buf, FALSE); + if (len != NULL) + *len = strlen (text); + + g_object_unref (stream); return text; } |