diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-05-17 01:06:56 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-05-20 01:07:20 +0800 |
commit | cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9 (patch) | |
tree | 271b673b6e311d5cb44acdd0b6c1d1830aa6982e /modules | |
parent | f6f11a1da2dfa2c7616cd18b36a44fefd66f0c75 (diff) | |
download | gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.tar gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.tar.gz gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.tar.bz2 gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.tar.lz gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.tar.xz gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.tar.zst gsoc2013-evolution-cd5a55f9812643109be6c2b0ed5d8f8ce655a4a9.zip |
em-format cleanups.
Diffstat (limited to 'modules')
7 files changed, 52 insertions, 42 deletions
diff --git a/modules/audio-inline/evolution-module-audio-inline.c b/modules/audio-inline/evolution-module-audio-inline.c index b5dffb183e..297c5b6ffe 100644 --- a/modules/audio-inline/evolution-module-audio-inline.c +++ b/modules/audio-inline/evolution-module-audio-inline.c @@ -28,8 +28,6 @@ const gchar * g_module_check_init (GModule *module); G_MODULE_EXPORT void e_module_load (GTypeModule *type_module) { - /* Register dynamically loaded types. */ - e_mail_parser_audio_inline_type_register (type_module); e_mail_formatter_audio_inline_type_register (type_module); } diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c index a97e70d0bd..02ae152718 100644 --- a/modules/itip-formatter/e-mail-formatter-itip.c +++ b/modules/itip-formatter/e-mail-formatter-itip.c @@ -62,7 +62,8 @@ emfe_itip_format (EMailFormatterExtension *extension, GString *buffer; EMailPartItip *itip_part; - g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartItip), FALSE); + g_return_val_if_fail (E_IS_MAIL_PART_ITIP (part), FALSE); + itip_part = (EMailPartItip *) part; if (context->mode == E_MAIL_FORMATTER_MODE_PRINTING) { diff --git a/modules/itip-formatter/e-mail-part-itip.h b/modules/itip-formatter/e-mail-part-itip.h index ac56234f23..78004bca96 100644 --- a/modules/itip-formatter/e-mail-part-itip.h +++ b/modules/itip-formatter/e-mail-part-itip.h @@ -1,4 +1,6 @@ /* + * e-mail-part-itip.h + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -17,10 +19,6 @@ #ifndef E_MAIL_PART_ITIP_H #define E_MAIL_PART_ITIP_H -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <libecal/libecal.h> #include <libebackend/libebackend.h> @@ -28,7 +26,10 @@ #include "itip-view.h" -#define E_MAIL_PART_ITIP(p) ((EMailPartItip *) p) +#define E_MAIL_PART_ITIP(part) \ + ((EMailPartItip *) part) +#define E_IS_MAIL_PART_ITIP(part) \ + (E_MAIL_PART_IS (part, EMailPartItip)) G_BEGIN_DECLS diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c index d4ef3693f1..286e356c51 100644 --- a/modules/text-highlight/e-mail-formatter-text-highlight.c +++ b/modules/text-highlight/e-mail-formatter-text-highlight.c @@ -85,10 +85,12 @@ get_syntax (EMailPart *part, (ct != NULL && (camel_content_type_is (ct, "application", "octet-stream") || (camel_content_type_is (ct, "text", "plain"))))) { - const gchar *filename = camel_mime_part_get_filename (part->part); - if (filename) { + const gchar *filename; + + filename = camel_mime_part_get_filename (part->part); + if (filename != NULL) { gchar *ext = g_strrstr (filename, "."); - if (ext) { + if (ext != NULL) { syntax = (gchar *) get_syntax_for_ext (ext + 1); syntax = syntax ? g_strdup (syntax) : NULL; } @@ -111,26 +113,32 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, CamelStream *stream, GCancellable *cancellable) { + CamelContentType *ct; + gboolean success = FALSE; + + ct = camel_mime_part_get_content_type (part->part); + /* Don't format text/html unless it's an attachment */ - CamelContentType *ct = camel_mime_part_get_content_type (part->part); if (ct && camel_content_type_is (ct, "text", "html")) { const CamelContentDisposition *disp; + disp = camel_mime_part_get_content_disposition (part->part); - if (!disp || g_strcmp0 (disp->disposition, "attachment") != 0) - return FALSE; + if (disp == NULL) + goto exit; + + if (g_strcmp0 (disp->disposition, "attachment") != 0) + goto exit; } if (context->mode == E_MAIL_FORMATTER_MODE_PRINTING) { - CamelDataWrapper *dw; CamelStream *filter_stream; CamelMimeFilter *mime_filter; dw = camel_medium_get_content (CAMEL_MEDIUM (part->part)); - if (!dw) { - return FALSE; - } + if (dw == NULL) + goto exit; camel_stream_write_string ( stream, "<pre><div class=\"pre\">", cancellable, NULL); @@ -152,8 +160,6 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, camel_stream_write_string ( stream, "</div></pre>", cancellable, NULL); - return TRUE; - } else if (context->mode == E_MAIL_FORMATTER_MODE_RAW) { gint pipe_stdin, pipe_stdout; GPid pid; @@ -162,30 +168,29 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, PangoFontDescription *fd; GSettings *settings; gchar *font = NULL; - gboolean success; - - const gchar *argv[] = { HIGHLIGHT_COMMAND, - NULL, /* --font= */ - NULL, /* --font-size= */ - NULL, /* --syntax= */ - "--out-format=html", - "--include-style", - "--inline-css", - "--style=bclear", - "--failsafe", - NULL }; + + const gchar *argv[] = { + HIGHLIGHT_COMMAND, + NULL, /* --font= */ + NULL, /* --font-size= */ + NULL, /* --syntax= */ + "--out-format=html", + "--include-style", + "--inline-css", + "--style=bclear", + "--failsafe", + NULL }; dw = camel_medium_get_content (CAMEL_MEDIUM (part->part)); - if (!dw) { - return FALSE; - } + if (dw == NULL) + goto exit; syntax = get_syntax (part, context->uri); /* Use the traditional text/plain formatter for plain-text */ if (g_strcmp0 (syntax, "txt") == 0) { g_free (syntax); - return FALSE; + goto exit; } settings = g_settings_new ("org.gnome.evolution.mail"); @@ -267,8 +272,8 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, g_free (font_size); g_free ((gchar *) argv[3]); pango_font_description_free (fd); + goto exit; - return FALSE; } else { /* In case of any other content, force use of * text/plain formatter, because returning FALSE @@ -286,6 +291,7 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, g_free (font_size); g_free ((gchar *) argv[3]); pango_font_description_free (fd); + } else { CamelFolder *folder; const gchar *message_uid; @@ -336,10 +342,12 @@ emfe_text_highlight_format (EMailFormatterExtension *extension, g_free (str); g_free (uri); - } - return TRUE; + success = TRUE; + +exit: + return success; } static void diff --git a/modules/vcard-inline/e-mail-formatter-vcard-inline.c b/modules/vcard-inline/e-mail-formatter-vcard-inline.c index bcced23351..f2ab3cc179 100644 --- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c +++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c @@ -66,7 +66,8 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension, { EMailPartVCardInline *vcard_part; - g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartVCardInline), FALSE); + g_return_val_if_fail (E_IS_MAIL_PART_VCARD (part), FALSE); + vcard_part = (EMailPartVCardInline *) part; if (context->mode == E_MAIL_FORMATTER_MODE_RAW) { diff --git a/modules/vcard-inline/e-mail-part-vcard-inline.h b/modules/vcard-inline/e-mail-part-vcard-inline.h index 8272d2f672..b74dd76d1d 100644 --- a/modules/vcard-inline/e-mail-part-vcard-inline.h +++ b/modules/vcard-inline/e-mail-part-vcard-inline.h @@ -24,6 +24,9 @@ #include <addressbook/gui/widgets/eab-contact-formatter.h> #include <webkit/webkitdom.h> +#define E_IS_MAIL_PART_VCARD(part) \ + (E_MAIL_PART_IS (part, EMailPartVCardInline)) + G_BEGIN_DECLS typedef struct _EMailPartVCardInline EMailPartVCardInline; diff --git a/modules/vcard-inline/evolution-module-vcard-inline.c b/modules/vcard-inline/evolution-module-vcard-inline.c index 4e95aba312..bb1196e865 100644 --- a/modules/vcard-inline/evolution-module-vcard-inline.c +++ b/modules/vcard-inline/evolution-module-vcard-inline.c @@ -28,8 +28,6 @@ const gchar * g_module_check_init (GModule *module); G_MODULE_EXPORT void e_module_load (GTypeModule *type_module) { - /* Register dynamically loaded types. */ - e_mail_formatter_vcard_inline_type_register (type_module); e_mail_parser_vcard_inline_type_register (type_module); } |