aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-05-18 23:24:40 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-05-20 01:07:20 +0800
commitf19058ea7a002e8ebf8351c55a86d3bb17a46cbc (patch)
tree0fdbb2c62ba31e92094ef7da2956f7caedd4840d /modules
parent5ad0b6d8f7ee9244eb328b5951b98f8945e7b3cf (diff)
downloadgsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.tar
gsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.tar.gz
gsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.tar.bz2
gsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.tar.lz
gsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.tar.xz
gsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.tar.zst
gsoc2013-evolution-f19058ea7a002e8ebf8351c55a86d3bb17a46cbc.zip
Add e_mail_part_ref_mime_part().
Diffstat (limited to 'modules')
-rw-r--r--modules/audio-inline/e-mail-formatter-audio-inline.c5
-rw-r--r--modules/text-highlight/e-mail-formatter-text-highlight.c21
2 files changed, 19 insertions, 7 deletions
diff --git a/modules/audio-inline/e-mail-formatter-audio-inline.c b/modules/audio-inline/e-mail-formatter-audio-inline.c
index 9c477bd2c8..3545efd3d4 100644
--- a/modules/audio-inline/e-mail-formatter-audio-inline.c
+++ b/modules/audio-inline/e-mail-formatter-audio-inline.c
@@ -176,6 +176,7 @@ play_clicked (GtkWidget *button,
if (!part->filename) {
CamelStream *stream;
CamelDataWrapper *data;
+ CamelMimePart *mime_part;
GError *error = NULL;
gint argc = 1;
const gchar *argv[] = { "org_gnome_audio_inline", NULL };
@@ -187,9 +188,11 @@ play_clicked (GtkWidget *button,
stream = camel_stream_fs_new_with_name (
part->filename, O_RDWR | O_CREAT | O_TRUNC, 0600, NULL);
- data = camel_medium_get_content (CAMEL_MEDIUM (part->parent.part));
+ mime_part = e_mail_part_ref_mime_part (E_MAIL_PART (part));
+ data = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
camel_data_wrapper_decode_to_stream_sync (data, stream, NULL, NULL);
camel_stream_flush (stream, NULL, NULL);
+ g_object_unref (mime_part);
g_object_unref (stream);
d (printf ("audio inline formatter: init gst playbin\n"));
diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c
index 11fc546d74..de1d89b8e2 100644
--- a/modules/text-highlight/e-mail-formatter-text-highlight.c
+++ b/modules/text-highlight/e-mail-formatter-text-highlight.c
@@ -54,6 +54,9 @@ get_syntax (EMailPart *part,
{
gchar *syntax = NULL;
CamelContentType *ct = NULL;
+ CamelMimePart *mime_part;
+
+ mime_part = e_mail_part_ref_mime_part (part);
if (uri) {
SoupURI *soup_uri = soup_uri_new (uri);
@@ -69,7 +72,7 @@ get_syntax (EMailPart *part,
/* Try to detect syntax by content-type first */
if (syntax == NULL) {
- ct = camel_mime_part_get_content_type (part->part);
+ ct = camel_mime_part_get_content_type (mime_part);
if (ct) {
gchar *mime_type = camel_content_type_simple (ct);
@@ -87,7 +90,7 @@ get_syntax (EMailPart *part,
(camel_content_type_is (ct, "text", "plain"))))) {
const gchar *filename;
- filename = camel_mime_part_get_filename (part->part);
+ filename = camel_mime_part_get_filename (mime_part);
if (filename != NULL) {
gchar *ext = g_strrstr (filename, ".");
if (ext != NULL) {
@@ -102,6 +105,8 @@ get_syntax (EMailPart *part,
syntax = g_strdup ("txt");
}
+ g_object_unref (mime_part);
+
return syntax;
}
@@ -113,16 +118,18 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
CamelStream *stream,
GCancellable *cancellable)
{
+ CamelMimePart *mime_part;
CamelContentType *ct;
gboolean success = FALSE;
- ct = camel_mime_part_get_content_type (part->part);
+ mime_part = e_mail_part_ref_mime_part (part);
+ ct = camel_mime_part_get_content_type (mime_part);
/* Don't format text/html unless it's an attachment */
if (ct && camel_content_type_is (ct, "text", "html")) {
const CamelContentDisposition *disp;
- disp = camel_mime_part_get_content_disposition (part->part);
+ disp = camel_mime_part_get_content_disposition (mime_part);
if (disp == NULL)
goto exit;
@@ -136,7 +143,7 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
CamelStream *filter_stream;
CamelMimeFilter *mime_filter;
- dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
+ dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
if (dw == NULL)
goto exit;
@@ -181,7 +188,7 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
"--failsafe",
NULL };
- dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
+ dw = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
if (dw == NULL)
goto exit;
@@ -349,6 +356,8 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
success = TRUE;
exit:
+ g_object_unref (mime_part);
+
return success;
}