diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-07 01:57:33 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-08 03:01:04 +0800 |
commit | 9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79 (patch) | |
tree | 8849353e617afe5207095fb6100a33e79989c9bc /modules | |
parent | 3924dc759dbf38df0f9ff6941990dcf242478617 (diff) | |
download | gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.tar gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.tar.gz gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.tar.bz2 gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.tar.lz gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.tar.xz gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.tar.zst gsoc2013-evolution-9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79.zip |
EMailExtension: Replace mime_types() method with a string array.
In all implementations for EMailExtension, the MIME type list is a
static string array -- with the single exception of the text-highlight
module, where the MIME type list is dynamically assembled once.
Replace the mime_types() method with a "mime_types" string array in the
EMailExtensionInterface struct. Then the list of MIME types supported
by the class implementing the EMailExtensionInterface can be obtained
without requiring an instance of the class.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/audio-inline/e-mail-formatter-audio-inline.c | 44 | ||||
-rw-r--r-- | modules/audio-inline/e-mail-parser-audio-inline.c | 42 | ||||
-rw-r--r-- | modules/itip-formatter/e-mail-formatter-itip.c | 16 | ||||
-rw-r--r-- | modules/itip-formatter/e-mail-parser-itip.c | 16 | ||||
-rw-r--r-- | modules/prefer-plain/e-mail-parser-prefer-plain.c | 16 | ||||
-rw-r--r-- | modules/text-highlight/e-mail-formatter-text-highlight.c | 8 | ||||
-rw-r--r-- | modules/text-highlight/e-mail-parser-text-highlight.c | 8 | ||||
-rw-r--r-- | modules/tnef-attachment/e-mail-parser-tnef-attachment.c | 16 | ||||
-rw-r--r-- | modules/vcard-inline/e-mail-formatter-vcard-inline.c | 16 | ||||
-rw-r--r-- | modules/vcard-inline/e-mail-parser-vcard-inline.c | 16 |
10 files changed, 89 insertions, 109 deletions
diff --git a/modules/audio-inline/e-mail-formatter-audio-inline.c b/modules/audio-inline/e-mail-formatter-audio-inline.c index 76c70eb5cc..51d250067f 100644 --- a/modules/audio-inline/e-mail-formatter-audio-inline.c +++ b/modules/audio-inline/e-mail-formatter-audio-inline.c @@ -62,18 +62,30 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_FORMATTER_EXTENSION, e_mail_formatter_formatter_extension_interface_init)); -static const gchar * formatter_mime_types[] = { "application/vnd.evolution.widget.audio-inline", - "audio/ac3", "audio/x-ac3", - "audio/basic", "audio/mpeg", - "audio/x-mpeg", "audio/mpeg3", - "audio/x-mpeg3", "audio/mp3", - "audio/x-mp3", "audio/mp4", - "audio/flac", "audio/x-flac", - "audio/mod", "audio/x-mod", - "audio/x-wav", "audio/microsoft-wav", - "audio/x-wma", "audio/x-ms-wma", - "application/ogg", "application/x-ogg", - NULL }; +static const gchar *formatter_mime_types[] = { + "application/vnd.evolution.widget.audio-inline", + "audio/ac3", + "audio/x-ac3", + "audio/basic", + "audio/mpeg", + "audio/x-mpeg", + "audio/mpeg3", + "audio/x-mpeg3", + "audio/mp3", + "audio/x-mp3", + "audio/mp4", + "audio/flac", + "audio/x-flac", + "audio/mod", + "audio/x-mod", + "audio/x-wav", + "audio/microsoft-wav", + "audio/x-wma", + "audio/x-ms-wma", + "application/ogg", + "application/x-ogg", + NULL +}; static void pause_clicked (GtkWidget *button, @@ -316,12 +328,6 @@ emfe_audio_inline_get_description (EMailFormatterExtension *extension) return _("Play the attachment in embedded audio player"); } -static const gchar ** -emfe_audio_inline_mime_types (EMailExtension *extension) -{ - return formatter_mime_types; -} - static void e_mail_formatter_audio_inline_constructed (GObject *object) { @@ -359,7 +365,7 @@ e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInte static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = emfe_audio_inline_mime_types; + iface->mime_types = formatter_mime_types; } static void diff --git a/modules/audio-inline/e-mail-parser-audio-inline.c b/modules/audio-inline/e-mail-parser-audio-inline.c index ca87693fe4..5fa4611a97 100644 --- a/modules/audio-inline/e-mail-parser-audio-inline.c +++ b/modules/audio-inline/e-mail-parser-audio-inline.c @@ -62,17 +62,29 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_PARSER_EXTENSION, e_mail_parser_parser_extension_interface_init)); -static const gchar * parser_mime_types[] = { "audio/ac3", "audio/x-ac3", - "audio/basic", "audio/mpeg", - "audio/x-mpeg", "audio/mpeg3", - "audio/x-mpeg3", "audio/mp3", - "audio/x-mp3", "audio/mp4", - "audio/flac", "audio/x-flac", - "audio/mod", "audio/x-mod", - "audio/x-wav", "audio/microsoft-wav", - "audio/x-wma", "audio/x-ms-wma", - "application/ogg", "application/x-ogg", - NULL }; +static const gchar *parser_mime_types[] = { + "audio/ac3", + "audio/x-ac3", + "audio/basic", + "audio/mpeg", + "audio/x-mpeg", + "audio/mpeg3", + "audio/x-mpeg3", + "audio/mp3", + "audio/x-mp3", + "audio/mp4", + "audio/flac", + "audio/x-flac", + "audio/mod", + "audio/x-mod", + "audio/x-wav", + "audio/microsoft-wav", + "audio/x-wma", + "audio/x-ms-wma", + "application/ogg", + "application/x-ogg", + NULL +}; static void mail_part_audio_inline_free (EMailPart *mail_part) @@ -144,12 +156,6 @@ empe_audio_inline_get_flags (EMailParserExtension *extension) return E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION; } -static const gchar ** -empe_mime_types (EMailExtension *extension) -{ - return parser_mime_types; -} - void e_mail_parser_audio_inline_type_register (GTypeModule *type_module) { @@ -159,7 +165,7 @@ e_mail_parser_audio_inline_type_register (GTypeModule *type_module) static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = empe_mime_types; + iface->mime_types = parser_mime_types; } static void diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c index 54cb096292..9e2afc4459 100644 --- a/modules/itip-formatter/e-mail-formatter-itip.c +++ b/modules/itip-formatter/e-mail-formatter-itip.c @@ -58,9 +58,11 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_FORMATTER_EXTENSION, e_mail_formatter_formatter_extension_interface_init)); -static const gchar * formatter_mime_types[] = { "text/calendar", - "application/ics", - NULL }; +static const gchar *formatter_mime_types[] = { + "text/calendar", + "application/ics", + NULL +}; static gboolean emfe_itip_format (EMailFormatterExtension *extension, @@ -151,12 +153,6 @@ emfe_itip_get_description (EMailFormatterExtension *extension) return _("Display part as an invitation"); } -static const gchar ** -emfe_itip_mime_types (EMailExtension *extension) -{ - return formatter_mime_types; -} - static void e_mail_formatter_itip_constructed (GObject *object) { @@ -206,7 +202,7 @@ e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInte static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = emfe_itip_mime_types; + iface->mime_types = formatter_mime_types; } static void diff --git a/modules/itip-formatter/e-mail-parser-itip.c b/modules/itip-formatter/e-mail-parser-itip.c index 505842807a..f8fb4f68fb 100644 --- a/modules/itip-formatter/e-mail-parser-itip.c +++ b/modules/itip-formatter/e-mail-parser-itip.c @@ -68,9 +68,11 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_PARSER_EXTENSION, e_mail_parser_parser_extension_interface_init)); -static const gchar * parser_mime_types[] = { "text/calendar", - "application/ics", - NULL }; +static const gchar *parser_mime_types[] = { + "text/calendar", + "application/ics", + NULL +}; static void mail_part_itip_free (EMailPart *mail_part) @@ -257,12 +259,6 @@ empe_itip_get_flags (EMailParserExtension *extension) return E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION; } -static const gchar ** -empe_mime_types (EMailExtension *extension) -{ - return parser_mime_types; -} - void e_mail_parser_itip_type_register (GTypeModule *type_module) { @@ -272,7 +268,7 @@ e_mail_parser_itip_type_register (GTypeModule *type_module) static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = empe_mime_types; + iface->mime_types = parser_mime_types; } static void diff --git a/modules/prefer-plain/e-mail-parser-prefer-plain.c b/modules/prefer-plain/e-mail-parser-prefer-plain.c index 296369ed32..aad1ea6277 100644 --- a/modules/prefer-plain/e-mail-parser-prefer-plain.c +++ b/modules/prefer-plain/e-mail-parser-prefer-plain.c @@ -69,9 +69,11 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_PARSER_EXTENSION, e_mail_parser_parser_extension_interface_init)); -static const gchar * parser_mime_types[] = { "multipart/alternative", - "text/html", - NULL }; +static const gchar *parser_mime_types[] = { + "multipart/alternative", + "text/html", + NULL +}; static struct { const gchar *key; @@ -324,12 +326,6 @@ empe_prefer_plain_parse (EMailParserExtension *extension, return TRUE; } -static const gchar ** -empe_mime_types (EMailExtension *extension) -{ - return parser_mime_types; -} - void e_mail_parser_prefer_plain_type_register (GTypeModule *type_module) { @@ -339,7 +335,7 @@ e_mail_parser_prefer_plain_type_register (GTypeModule *type_module) static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = empe_mime_types; + iface->mime_types = parser_mime_types; } static void diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c index 43c3a139c5..1400c9488d 100644 --- a/modules/text-highlight/e-mail-formatter-text-highlight.c +++ b/modules/text-highlight/e-mail-formatter-text-highlight.c @@ -376,12 +376,6 @@ emfe_text_highlight_get_description (EMailFormatterExtension *extension) return _("Syntax highlighting of mail parts"); } -static const gchar ** -emfe_text_highlight_mime_types (EMailExtension *extension) -{ - return get_mime_types (); -} - static void emfe_text_highlight_constructed (GObject *object) { @@ -434,5 +428,5 @@ e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInte static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = emfe_text_highlight_mime_types; + iface->mime_types = get_mime_types (); } diff --git a/modules/text-highlight/e-mail-parser-text-highlight.c b/modules/text-highlight/e-mail-parser-text-highlight.c index eb56162a3d..a8c17fd812 100644 --- a/modules/text-highlight/e-mail-parser-text-highlight.c +++ b/modules/text-highlight/e-mail-parser-text-highlight.c @@ -98,12 +98,6 @@ empe_text_highlight_parse (EMailParserExtension *extension, return TRUE; } -static const gchar ** -empe_mime_types (EMailExtension *extension) -{ - return get_mime_types (); -} - void e_mail_parser_text_highlight_type_register (GTypeModule *type_module) { @@ -113,7 +107,7 @@ e_mail_parser_text_highlight_type_register (GTypeModule *type_module) static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = empe_mime_types; + iface->mime_types = get_mime_types (); } static void diff --git a/modules/tnef-attachment/e-mail-parser-tnef-attachment.c b/modules/tnef-attachment/e-mail-parser-tnef-attachment.c index a0342aaa37..dda02e23b1 100644 --- a/modules/tnef-attachment/e-mail-parser-tnef-attachment.c +++ b/modules/tnef-attachment/e-mail-parser-tnef-attachment.c @@ -77,9 +77,11 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_PARSER_EXTENSION, e_mail_parser_parser_extension_interface_init)); -static const gchar * parser_mime_types[] = { "application/vnd.ms-tnef", - "application/ms-tnefl", - NULL }; +static const gchar *parser_mime_types[] = { + "application/vnd.ms-tnef", + "application/ms-tnefl", + NULL +}; gint verbose = 0; gint saveRTF = 0; @@ -259,12 +261,6 @@ empe_tnef_attachment_parse (EMailParserExtension *extension, return TRUE; } -static const gchar ** -empe_mime_types (EMailExtension *extension) -{ - return parser_mime_types; -} - void e_mail_parser_tnef_attachment_type_register (GTypeModule *type_module) { @@ -274,7 +270,7 @@ e_mail_parser_tnef_attachment_type_register (GTypeModule *type_module) static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = empe_mime_types; + iface->mime_types = parser_mime_types; } 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 13e87139ac..7d2abfc626 100644 --- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c +++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c @@ -60,8 +60,12 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_FORMATTER_EXTENSION, e_mail_formatter_formatter_extension_interface_init)); -static const gchar * formatter_mime_types[] = { "text/vcard", "text/x-vcard", - "text/directory", NULL }; +static const gchar *formatter_mime_types[] = { + "text/vcard", + "text/x-vcard", + "text/directory", + NULL +}; static gboolean emfe_vcard_inline_format (EMailFormatterExtension *extension, @@ -207,12 +211,6 @@ emfe_vcard_inline_get_description (EMailFormatterExtension *extension) return _("Display the part as an addressbook contact"); } -static const gchar ** -emfe_vcard_inline_mime_types (EMailExtension *extension) -{ - return formatter_mime_types; -} - static void e_mail_formatter_vcard_inline_constructed (GObject *object) { @@ -249,7 +247,7 @@ e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInte static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = emfe_vcard_inline_mime_types; + iface->mime_types = formatter_mime_types; } static void diff --git a/modules/vcard-inline/e-mail-parser-vcard-inline.c b/modules/vcard-inline/e-mail-parser-vcard-inline.c index 84f4f2f538..0f0014265b 100644 --- a/modules/vcard-inline/e-mail-parser-vcard-inline.c +++ b/modules/vcard-inline/e-mail-parser-vcard-inline.c @@ -72,8 +72,12 @@ G_DEFINE_DYNAMIC_TYPE_EXTENDED ( E_TYPE_MAIL_PARSER_EXTENSION, e_mail_parser_parser_extension_interface_init)); -static const gchar * parser_mime_types[] = { "text/vcard", "text/x-vcard", - "text/directory", NULL }; +static const gchar *parser_mime_types[] = { + "text/vcard", + "text/x-vcard", + "text/directory", + NULL +}; static void mail_part_vcard_inline_free (EMailPart *mail_part) @@ -376,12 +380,6 @@ empe_vcard_inline_get_flags (EMailParserExtension *extension) return E_MAIL_PARSER_EXTENSION_INLINE_DISPOSITION; } -static const gchar ** -empe_mime_types (EMailExtension *extension) -{ - return parser_mime_types; -} - void e_mail_parser_vcard_inline_type_register (GTypeModule *type_module) { @@ -391,7 +389,7 @@ e_mail_parser_vcard_inline_type_register (GTypeModule *type_module) static void e_mail_parser_mail_extension_interface_init (EMailExtensionInterface *iface) { - iface->mime_types = empe_mime_types; + iface->mime_types = parser_mime_types; } static void |