[evolution/wip/webkit2] Make the SVG images display again
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Make the SVG images display again
- Date: Mon, 30 May 2016 12:56:06 +0000 (UTC)
commit c45bbdb83b4aac722ab9fe41c9bfde43c38a8f3e
Author: Tomas Popela <tpopela redhat com>
Date: Mon May 30 14:53:51 2016 +0200
Make the SVG images display again
In case of the CID part, we need to take the mime type from the data wrapper
and only if it's empty we will the one from the part. Also remove some of the
now unused code.
em-format/e-mail-formatter-enums.h | 1 -
mail/e-cid-request.c | 12 +++++++++---
mail/e-mail-request.c | 32 +++++++-------------------------
3 files changed, 16 insertions(+), 29 deletions(-)
---
diff --git a/em-format/e-mail-formatter-enums.h b/em-format/e-mail-formatter-enums.h
index e7b1868..de64568 100644
--- a/em-format/e-mail-formatter-enums.h
+++ b/em-format/e-mail-formatter-enums.h
@@ -49,7 +49,6 @@ typedef enum {
E_MAIL_FORMATTER_MODE_NORMAL = 0,
E_MAIL_FORMATTER_MODE_SOURCE,
E_MAIL_FORMATTER_MODE_RAW,
- E_MAIL_FORMATTER_MODE_CID,
E_MAIL_FORMATTER_MODE_PRINTING,
E_MAIL_FORMATTER_MODE_ALL_HEADERS
} EMailFormatterMode;
diff --git a/mail/e-cid-request.c b/mail/e-cid-request.c
index 9d82398..e7529f7 100644
--- a/mail/e-cid-request.c
+++ b/mail/e-cid-request.c
@@ -56,7 +56,6 @@ e_cid_request_process_sync (EContentRequest *request,
EMailDisplay *display;
EMailPartList *part_list;
EMailPart *part;
- const gchar *mime_type;
GByteArray *byte_array;
CamelStream *output_stream;
CamelDataWrapper *dw;
@@ -82,7 +81,6 @@ e_cid_request_process_sync (EContentRequest *request,
if (!part)
return FALSE;
- mime_type = e_mail_part_get_mime_type (part);
mime_part = e_mail_part_ref_mime_part (part);
dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
@@ -96,6 +94,7 @@ e_cid_request_process_sync (EContentRequest *request,
if (camel_data_wrapper_decode_to_stream_sync (dw, output_stream, cancellable, error)) {
GBytes *bytes;
+ gchar *mime_type;
bytes = g_byte_array_free_to_bytes (byte_array);
@@ -103,7 +102,14 @@ e_cid_request_process_sync (EContentRequest *request,
*out_stream = g_memory_input_stream_new_from_bytes (bytes);
*out_stream_length = g_bytes_get_size (bytes);
- *out_mime_type = g_strdup (mime_type);
+
+ mime_type = camel_data_wrapper_get_mime_type (dw);
+ if (mime_type && *mime_type)
+ *out_mime_type = mime_type;
+ else {
+ g_free (mime_type);
+ *out_mime_type = g_strdup (e_mail_part_get_mime_type (part));
+ }
g_bytes_unref (bytes);
}
diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c
index 399bbef..ce890e8 100644
--- a/mail/e-mail-request.c
+++ b/mail/e-mail-request.c
@@ -154,33 +154,15 @@ mail_request_process_mail_sync (EContentRequest *request,
if (context.mode == E_MAIL_FORMATTER_MODE_SOURCE)
mime_type = "application/vnd.evolution.source";
- if (context.mode == E_MAIL_FORMATTER_MODE_CID) {
- CamelDataWrapper *dw;
- CamelMimePart *mime_part;
+ if (mime_type == NULL)
+ mime_type = e_mail_part_get_mime_type (part);
- mime_part = e_mail_part_ref_mime_part (part);
- dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
- g_return_val_if_fail (dw != NULL, FALSE);
+ e_mail_formatter_format_as (
+ formatter, &context, part,
+ output_stream, mime_type,
+ cancellable);
- if (!mime_type) {
- use_mime_type = camel_data_wrapper_get_mime_type (dw);
- }
-
- camel_data_wrapper_decode_to_output_stream_sync (
- dw, output_stream, cancellable, NULL);
-
- g_object_unref (mime_part);
- } else {
- if (mime_type == NULL)
- mime_type = e_mail_part_get_mime_type (part);
-
- e_mail_formatter_format_as (
- formatter, &context, part,
- output_stream, mime_type,
- cancellable);
-
- part_converted_to_utf8 = e_mail_part_get_converted_to_utf8 (part);
- }
+ part_converted_to_utf8 = e_mail_part_get_converted_to_utf8 (part);
g_object_unref (part);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]