From 2f0d83cf74b94d5e6272c07179df6e6c7a929789 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 4 Dec 2012 16:45:44 -0500 Subject: EMailFormatterContext: Keep a reference to EMailPartList. Replace the individual components of an EMailPartList with a reference on the EMailPartList itself in EMailFormatContext. Easier to manage. --- modules/itip-formatter/e-mail-formatter-itip.c | 22 ++++++++++++++-------- .../e-mail-formatter-text-highlight.c | 7 ++++++- .../vcard-inline/e-mail-formatter-vcard-inline.c | 15 ++++++++++----- 3 files changed, 30 insertions(+), 14 deletions(-) (limited to 'modules') diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c index ca6b2f64cd..15b7df42a6 100644 --- a/modules/itip-formatter/e-mail-formatter-itip.c +++ b/modules/itip-formatter/e-mail-formatter-itip.c @@ -90,25 +90,31 @@ emfe_itip_format (EMailFormatterExtension *extension, itip_view_write (formatter, buffer); } else { + CamelFolder *folder; + CamelMimeMessage *message; + const gchar *message_uid; gchar *uri; + folder = context->part_list->folder; + message = context->part_list->message; + message_uid = context->part_list->message_uid; + /* mark message as containing calendar, thus it will show the * icon in message list now on */ - if (context->message_uid && context->folder && + if (message_uid != NULL && folder != NULL && !camel_folder_get_message_user_flag ( - context->folder, context->message_uid, "$has_cal")) { + folder, message_uid, "$has_cal")) { camel_folder_set_message_user_flag ( - context->folder, context->message_uid, - "$has_cal", TRUE); + folder, message_uid, "$has_cal", TRUE); } - itip_part->folder = g_object_ref (context->folder); - itip_part->uid = g_strdup (context->message_uid); - itip_part->msg = g_object_ref (context->message); + itip_part->folder = g_object_ref (folder); + itip_part->uid = g_strdup (message_uid); + itip_part->msg = g_object_ref (message); uri = e_mail_part_build_uri ( - context->folder, context->message_uid, + folder, message_uid, "part_id", G_TYPE_STRING, part->id, "mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW, NULL); diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c index 18ef3d864b..d8907034db 100644 --- a/modules/text-highlight/e-mail-formatter-text-highlight.c +++ b/modules/text-highlight/e-mail-formatter-text-highlight.c @@ -319,13 +319,18 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, g_free ((gchar *) argv[3]); pango_font_description_free (fd); } else { + CamelFolder *folder; + const gchar *message_uid; gchar *uri, *str; gchar *syntax; + folder = context->part_list->folder; + message_uid = context->part_list->message_uid; + syntax = get_syntax (part, NULL); uri = e_mail_part_build_uri ( - context->folder, context->message_uid, + folder, message_uid, "part_id", G_TYPE_STRING, part->id, "mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW, "__formatas", G_TYPE_STRING, syntax, diff --git a/modules/vcard-inline/e-mail-formatter-vcard-inline.c b/modules/vcard-inline/e-mail-formatter-vcard-inline.c index 1abb4289cc..a0091e985f 100644 --- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c +++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c @@ -89,6 +89,8 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension, vcard_part->formatter, contact, stream, cancellable); } else { + CamelFolder *folder; + const gchar *message_uid; gchar *str, *uri; gint length; const gchar *label = NULL; @@ -100,14 +102,17 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension, if (length < 1) return FALSE; - if (!vcard_part->message_uid && context->message_uid) - vcard_part->message_uid = g_strdup (context->message_uid); + folder = context->part_list->folder; + message_uid = context->part_list->message_uid; - if (!vcard_part->folder && context->folder) - vcard_part->folder = g_object_ref (context->folder); + if (vcard_part->message_uid == NULL && message_uid != NULL) + vcard_part->message_uid = g_strdup (message_uid); + + if (vcard_part->folder == NULL && folder != NULL) + vcard_part->folder = g_object_ref (folder); uri = e_mail_part_build_uri ( - context->folder, context->message_uid, + folder, message_uid, "part_id", G_TYPE_STRING, part->id, "mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW, NULL); -- cgit v1.2.3