diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-05-21 01:41:57 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-05-21 03:34:32 +0800 |
commit | badc0e6156777c65885bad6858a6f44f7cbf037e (patch) | |
tree | 1154558584d4ef39c9e9350507063114458d7f54 /modules/vcard-inline | |
parent | 3df09670afb44ecf2d39fb71a228f0fa7ebbdb73 (diff) | |
download | gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.tar gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.tar.gz gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.tar.bz2 gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.tar.lz gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.tar.xz gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.tar.zst gsoc2013-evolution-badc0e6156777c65885bad6858a6f44f7cbf037e.zip |
Simplify EABContactFormatter.
Simplify the EABContactFormatter API as follows:
* Drop all constructor arguments from eab_contact_formatter_new()
since get/set functions exist for all of them.
* Remove eab_contact_formatter_format_contact_async() since
EABContactFormatter does not block.
* Replace eab_contact_formatter_format_contact_sync() with
eab_contact_formatter_format_contact() which drops the CamelStream
and GCancellable arguments and takes a GString as an output buffer.
* Remove the "state" and "style" properties, and always use a white
background when rendering the full contact.
This is particularly important since render_normal() dereferenced
the GtkStyle without checking for NULL, which would crash on mails
with a vCard MIME part when "Show Full vCard" was clicked, because
the "vcard-inline" module never set a GtkStyle.
Diffstat (limited to 'modules/vcard-inline')
-rw-r--r-- | modules/vcard-inline/e-mail-formatter-vcard.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/vcard-inline/e-mail-formatter-vcard.c b/modules/vcard-inline/e-mail-formatter-vcard.c index 01d015f754..75c1d2ec44 100644 --- a/modules/vcard-inline/e-mail-formatter-vcard.c +++ b/modules/vcard-inline/e-mail-formatter-vcard.c @@ -69,18 +69,22 @@ mail_formatter_vcard_format (EMailFormatterExtension *extension, g_return_val_if_fail (E_IS_MAIL_PART_VCARD (part), FALSE); vcard_part = (EMailPartVCard *) part; + g_return_val_if_fail (vcard_part->contact_list != NULL, FALSE); if (context->mode == E_MAIL_FORMATTER_MODE_RAW) { - EContact *contact; + GString *buffer; + + contact = E_CONTACT (vcard_part->contact_list->data); + + buffer = g_string_sized_new (1024); - if (vcard_part->contact_list != NULL) - contact = E_CONTACT (vcard_part->contact_list->data); - else - contact = NULL; + eab_contact_formatter_format_contact ( + vcard_part->formatter, contact, buffer); + camel_stream_write_string ( + stream, buffer->str, cancellable, NULL); - eab_contact_formatter_format_contact_sync ( - vcard_part->formatter, contact, stream, cancellable); + g_string_free (buffer, TRUE); } else { CamelFolder *folder; @@ -94,8 +98,6 @@ mail_formatter_vcard_format (EMailFormatterExtension *extension, gchar *html_label, *access_key; length = g_slist_length (vcard_part->contact_list); - if (length < 1) - return FALSE; folder = e_mail_part_list_get_folder (context->part_list); message_uid = e_mail_part_list_get_message_uid (context->part_list); |