aboutsummaryrefslogtreecommitdiffstats
path: root/em-format/e-mail-formatter-text-enriched.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2014-02-25 23:23:11 +0800
committerMatthew Barnes <mbarnes@redhat.com>2014-03-01 03:38:11 +0800
commitf4bb7d7748f3c407858e9c844d365411c586d861 (patch)
tree5946af137b2439857433fd9729ba758e9cd3c05d /em-format/e-mail-formatter-text-enriched.c
parentc3f8c95322ca7e461444820c7469d5527c239b05 (diff)
downloadgsoc2013-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 'em-format/e-mail-formatter-text-enriched.c')
-rw-r--r--em-format/e-mail-formatter-text-enriched.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c
index 038f44567d..8e522236a2 100644
--- a/em-format/e-mail-formatter-text-enriched.c
+++ b/em-format/e-mail-formatter-text-enriched.c
@@ -47,14 +47,14 @@ emfe_text_enriched_format (EMailFormatterExtension *extension,
EMailFormatter *formatter,
EMailFormatterContext *context,
EMailPart *part,
- CamelStream *stream,
+ GOutputStream *stream,
GCancellable *cancellable)
{
- CamelStream *filtered_stream;
- CamelMimeFilter *enriched;
+ GOutputStream *filtered_stream;
+ CamelMimeFilter *filter;
const gchar *mime_type;
+ const gchar *string;
guint32 filter_flags = 0;
- GString *buffer;
if (g_cancellable_is_cancelled (cancellable))
return FALSE;
@@ -64,29 +64,28 @@ emfe_text_enriched_format (EMailFormatterExtension *extension,
if (g_strcmp0 (mime_type, "text/richtext") == 0)
filter_flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT;
- enriched = camel_mime_filter_enriched_new (filter_flags);
- filtered_stream = camel_stream_filter_new (stream);
- camel_stream_filter_add (
- CAMEL_STREAM_FILTER (filtered_stream), enriched);
- g_object_unref (enriched);
+ filter = camel_mime_filter_enriched_new (filter_flags);
+ filtered_stream = camel_filter_output_stream_new (stream, filter);
+ g_object_unref (filter);
- buffer = g_string_new ("");
-
- g_string_append (
- buffer,
+ string =
"<div class=\"part-container -e-mail-formatter-frame-color "
"-e-web-view-background-color -e-web-view-text-color\">"
- "<div class=\"part-container-inner-margin\">\n");
+ "<div class=\"part-container-inner-margin\">\n";
- camel_stream_write_string (stream, buffer->str, cancellable, NULL);
- g_string_free (buffer, TRUE);
+ g_output_stream_write_all (
+ stream, string, strlen (string), NULL, cancellable, NULL);
e_mail_formatter_format_text (
formatter, part, filtered_stream, cancellable);
- camel_stream_flush (filtered_stream, cancellable, NULL);
+ g_output_stream_flush (filtered_stream, cancellable, NULL);
+
g_object_unref (filtered_stream);
- camel_stream_write_string (stream, "</div></div>", cancellable, NULL);
+ string = "</div></div>";
+
+ g_output_stream_write_all (
+ stream, string, strlen (string), NULL, cancellable, NULL);
return TRUE;
}