diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-07 23:11:00 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-08 03:01:05 +0800 |
commit | 7885426c2bfc410838e9c49bfd350b04e0535435 (patch) | |
tree | de1e21b46f4cd0edda4ccf0341ec64e8117297a3 /em-format | |
parent | 00b211b0f515d6b6d9147c1ca568d0c4b42af699 (diff) | |
download | gsoc2013-evolution-7885426c2bfc410838e9c49bfd350b04e0535435.tar.gz gsoc2013-evolution-7885426c2bfc410838e9c49bfd350b04e0535435.tar.zst gsoc2013-evolution-7885426c2bfc410838e9c49bfd350b04e0535435.zip |
EMailFormatterExtension: Convert get_display_name() to a string field.
Of the formatter extensions that provide a display name, they all use a
static string. So we don't need an instance of the extension to obtain
its display name. Just make it a string field in the class structure.
Diffstat (limited to 'em-format')
20 files changed, 13 insertions, 152 deletions
diff --git a/em-format/e-mail-formatter-attachment-bar.c b/em-format/e-mail-formatter-attachment-bar.c index 57e6a72d8f..c9c9ef1233 100644 --- a/em-format/e-mail-formatter-attachment-bar.c +++ b/em-format/e-mail-formatter-attachment-bar.c @@ -99,12 +99,6 @@ emfe_attachment_bar_get_widget (EMailFormatterExtension *extension, } static const gchar * -emfe_attachment_bar_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfe_attachment_bar_get_description (EMailFormatterExtension *extension) { return NULL; @@ -116,7 +110,6 @@ e_mail_formatter_attachment_bar_class_init (EMailFormatterExtensionClass *class) class->mime_types = formatter_mime_types; class->format = emfe_attachment_bar_format; class->get_widget = emfe_attachment_bar_get_widget; - class->get_display_name = emfe_attachment_bar_get_display_name; class->get_description = emfe_attachment_bar_get_description; } diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c index 1e9565d611..5fedf950d2 100644 --- a/em-format/e-mail-formatter-attachment.c +++ b/em-format/e-mail-formatter-attachment.c @@ -363,12 +363,6 @@ emfe_attachment_get_widget (EMailFormatterExtension *extension, } static const gchar * -emfe_attachment_get_display_name (EMailFormatterExtension *extension) -{ - return _("Attachment"); -} - -static const gchar * emfe_attachment_get_description (EMailFormatterExtension *extension) { return _("Display as attachment"); @@ -377,10 +371,10 @@ emfe_attachment_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_attachment_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Attachment"); class->mime_types = formatter_mime_types; class->format = emfe_attachment_format; class->get_widget = emfe_attachment_get_widget; - class->get_display_name = emfe_attachment_get_display_name; class->get_description = emfe_attachment_get_description; } diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c index 441a86c9d8..22f661b845 100644 --- a/em-format/e-mail-formatter-error.c +++ b/em-format/e-mail-formatter-error.c @@ -105,12 +105,6 @@ emfe_error_format (EMailFormatterExtension *extension, } static const gchar * -emfe_error_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfe_error_get_description (EMailFormatterExtension *extension) { return NULL; @@ -121,7 +115,6 @@ e_mail_formatter_error_class_init (EMailFormatterExtensionClass *class) { class->mime_types = formatter_mime_types; class->format = emfe_error_format; - class->get_display_name = emfe_error_get_display_name; class->get_description = emfe_error_get_description; } diff --git a/em-format/e-mail-formatter-extension.c b/em-format/e-mail-formatter-extension.c index beee63841b..01764a796f 100644 --- a/em-format/e-mail-formatter-extension.c +++ b/em-format/e-mail-formatter-extension.c @@ -139,28 +139,6 @@ e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension, } /** - * e_mail_formatter_extension_get_display_name: - * @extension: an #EMailFormatterExtension - * - * A virtual function reimplemented in all formatter extensions. It returns a - * short name of the extension that can be displayed in user class. - * - * Returns: A (localized) string with name of the extension - */ -const gchar * -e_mail_formatter_extension_get_display_name (EMailFormatterExtension *extension) -{ - EMailFormatterExtensionClass *class; - - g_return_val_if_fail (E_IS_MAIL_FORMATTER_EXTENSION (extension), NULL); - - class = E_MAIL_FORMATTER_EXTENSION_GET_CLASS (extension); - g_return_val_if_fail (class->get_display_name != NULL, NULL); - - return class->get_display_name (extension); -} - -/** * e_mail_formatter_extension_get_description: * @extension: an #EMailFormatterExtension * diff --git a/em-format/e-mail-formatter-extension.h b/em-format/e-mail-formatter-extension.h index 9111ad85f3..e03932b5d1 100644 --- a/em-format/e-mail-formatter-extension.h +++ b/em-format/e-mail-formatter-extension.h @@ -66,6 +66,9 @@ struct _EMailFormatterExtension { struct _EMailFormatterExtensionClass { GObjectClass parent_class; + /* This is a short name for the extension (optional). */ + const gchar *display_name; + /* This is a NULL-terminated array of supported MIME types. * The MIME types can be exact (e.g. "text/plain") or use a * wildcard (e.g. "text/ *"). */ @@ -81,8 +84,6 @@ struct _EMailFormatterExtensionClass { EMailPartList *context, EMailPart *part, GHashTable *params); - const gchar * (*get_display_name) - (EMailFormatterExtension *extension); const gchar * (*get_description) (EMailFormatterExtension *extension); @@ -104,8 +105,6 @@ GtkWidget * e_mail_formatter_extension_get_widget EMailPartList *context, EMailPart *part, GHashTable *params); -const gchar * e_mail_formatter_extension_get_display_name - (EMailFormatterExtension *extension); const gchar * e_mail_formatter_extension_get_description (EMailFormatterExtension *extension); diff --git a/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c index 135b24f586..8c1a46a5de 100644 --- a/em-format/e-mail-formatter-headers.c +++ b/em-format/e-mail-formatter-headers.c @@ -560,12 +560,6 @@ emfe_headers_format (EMailFormatterExtension *extension, } static const gchar * -emfe_headers_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfe_headers_get_description (EMailFormatterExtension *extension) { return NULL; @@ -576,7 +570,6 @@ e_mail_formatter_headers_class_init (EMailFormatterExtensionClass *class) { class->mime_types = formatter_mime_types; class->format = emfe_headers_format; - class->get_display_name = emfe_headers_get_display_name; class->get_description = emfe_headers_get_description; } diff --git a/em-format/e-mail-formatter-image.c b/em-format/e-mail-formatter-image.c index 2dbccf50df..63f17b0711 100644 --- a/em-format/e-mail-formatter-image.c +++ b/em-format/e-mail-formatter-image.c @@ -140,12 +140,6 @@ emfe_image_format (EMailFormatterExtension *extension, } static const gchar * -emfe_image_get_display_name (EMailFormatterExtension *extension) -{ - return _("Regular Image"); -} - -static const gchar * emfe_image_get_description (EMailFormatterExtension *extension) { return _("Display part as an image"); @@ -154,9 +148,9 @@ emfe_image_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_image_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Regular Image"); class->mime_types = formatter_mime_types; class->format = emfe_image_format; - class->get_display_name = emfe_image_get_display_name; class->get_description = emfe_image_get_description; } diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c index 1d243f0308..893344e083 100644 --- a/em-format/e-mail-formatter-message-rfc822.c +++ b/em-format/e-mail-formatter-message-rfc822.c @@ -231,12 +231,6 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension, } static const gchar * -emfe_message_rfc822_get_display_name (EMailFormatterExtension *extension) -{ - return _("RFC822 message"); -} - -static const gchar * emfe_message_rfc822_get_description (EMailFormatterExtension *extension) { return _("Format part as an RFC822 message"); @@ -245,9 +239,9 @@ emfe_message_rfc822_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_message_rfc822_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("RFC822 message"); class->mime_types = formatter_mime_types; class->format = emfe_message_rfc822_format; - class->get_display_name = emfe_message_rfc822_get_display_name; class->get_description = emfe_message_rfc822_get_description; } diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c index 9ab407937b..956338f382 100644 --- a/em-format/e-mail-formatter-print-headers.c +++ b/em-format/e-mail-formatter-print-headers.c @@ -207,12 +207,6 @@ emfpe_headers_format (EMailFormatterExtension *extension, } static const gchar * -emfpe_headers_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfpe_headers_get_description (EMailFormatterExtension *extension) { return NULL; @@ -223,7 +217,6 @@ e_mail_formatter_print_headers_class_init (EMailFormatterExtensionClass *class) { class->mime_types = formatter_mime_types; class->format = emfpe_headers_format; - class->get_display_name = emfpe_headers_get_display_name; class->get_description = emfpe_headers_get_description; } diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c index 4a48a84dc0..03a2961f57 100644 --- a/em-format/e-mail-formatter-quote-attachment.c +++ b/em-format/e-mail-formatter-quote-attachment.c @@ -108,12 +108,6 @@ emfqe_attachment_format (EMailFormatterExtension *extension, } static const gchar * -emfqe_attachment_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfqe_attachment_get_description (EMailFormatterExtension *extension) { return NULL; @@ -124,7 +118,6 @@ e_mail_formatter_quote_attachment_class_init (EMailFormatterExtensionClass *clas { class->mime_types = formatter_mime_types; class->format = emfqe_attachment_format; - class->get_display_name = emfqe_attachment_get_display_name; class->get_description = emfqe_attachment_get_description; } diff --git a/em-format/e-mail-formatter-quote-headers.c b/em-format/e-mail-formatter-quote-headers.c index 4e13cab255..3b1a74b02c 100644 --- a/em-format/e-mail-formatter-quote-headers.c +++ b/em-format/e-mail-formatter-quote-headers.c @@ -233,12 +233,6 @@ emqfe_headers_format (EMailFormatterExtension *extension, } static const gchar * -emqfe_headers_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emqfe_headers_get_description (EMailFormatterExtension *extension) { return NULL; @@ -249,7 +243,6 @@ e_mail_formatter_quote_headers_class_init (EMailFormatterExtensionClass *class) { class->mime_types = formatter_mime_types; class->format = emqfe_headers_format; - class->get_display_name = emqfe_headers_get_display_name; class->get_description = emqfe_headers_get_description; } diff --git a/em-format/e-mail-formatter-quote-message-rfc822.c b/em-format/e-mail-formatter-quote-message-rfc822.c index 93e4caac9b..a26b735a8b 100644 --- a/em-format/e-mail-formatter-quote-message-rfc822.c +++ b/em-format/e-mail-formatter-quote-message-rfc822.c @@ -137,12 +137,6 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension, } static const gchar * -emfqe_message_rfc822_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfqe_message_rfc822_get_description (EMailFormatterExtension *extension) { return NULL; @@ -153,7 +147,6 @@ e_mail_formatter_quote_message_rfc822_class_init (EMailFormatterExtensionClass * { class->mime_types = formatter_mime_types; class->format = emfqe_message_rfc822_format; - class->get_display_name = emfqe_message_rfc822_get_display_name; class->get_description = emfqe_message_rfc822_get_description; } diff --git a/em-format/e-mail-formatter-quote-text-enriched.c b/em-format/e-mail-formatter-quote-text-enriched.c index fc7febb09a..b397b18809 100644 --- a/em-format/e-mail-formatter-quote-text-enriched.c +++ b/em-format/e-mail-formatter-quote-text-enriched.c @@ -82,12 +82,6 @@ emqfe_text_enriched_format (EMailFormatterExtension *extension, } static const gchar * -emqfe_text_enriched_get_display_name (EMailFormatterExtension *extension) -{ - return _("Richtext"); -} - -static const gchar * emqfe_text_enriched_get_description (EMailFormatterExtension *extension) { return _("Display part as enriched text"); @@ -96,9 +90,9 @@ emqfe_text_enriched_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_quote_text_enriched_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Richtext"); class->mime_types = formatter_mime_types; class->format = emqfe_text_enriched_format; - class->get_display_name = emqfe_text_enriched_get_display_name; class->get_description = emqfe_text_enriched_get_description; } diff --git a/em-format/e-mail-formatter-quote-text-html.c b/em-format/e-mail-formatter-quote-text-html.c index 84425ac8d3..0031507360 100644 --- a/em-format/e-mail-formatter-quote-text-html.c +++ b/em-format/e-mail-formatter-quote-text-html.c @@ -85,12 +85,6 @@ emqfe_text_html_format (EMailFormatterExtension *extension, } static const gchar * -emqfe_text_html_get_display_name (EMailFormatterExtension *extension) -{ - return _("HTML"); -} - -static const gchar * emqfe_text_html_get_description (EMailFormatterExtension *extension) { return _("Format part as HTML"); @@ -99,9 +93,9 @@ emqfe_text_html_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_quote_text_html_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("HTML"); class->mime_types = formatter_mime_types; class->format = emqfe_text_html_format; - class->get_display_name = emqfe_text_html_get_display_name; class->get_description = emqfe_text_html_get_description; } diff --git a/em-format/e-mail-formatter-quote-text-plain.c b/em-format/e-mail-formatter-quote-text-plain.c index 62715ff708..9ac12b33a0 100644 --- a/em-format/e-mail-formatter-quote-text-plain.c +++ b/em-format/e-mail-formatter-quote-text-plain.c @@ -104,12 +104,6 @@ emqfe_text_plain_format (EMailFormatterExtension *extension, } static const gchar * -emqfe_text_plain_get_display_name (EMailFormatterExtension *extension) -{ - return _("Plain Text"); -} - -static const gchar * emqfe_text_plain_get_description (EMailFormatterExtension *extension) { return _("Format part as plain text"); @@ -118,9 +112,9 @@ emqfe_text_plain_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_quote_text_plain_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Plain Text"); class->mime_types = formatter_mime_types; class->format = emqfe_text_plain_format; - class->get_display_name = emqfe_text_plain_get_display_name; class->get_description = emqfe_text_plain_get_description; } diff --git a/em-format/e-mail-formatter-secure-button.c b/em-format/e-mail-formatter-secure-button.c index be1331ae00..a900fc92a8 100644 --- a/em-format/e-mail-formatter-secure-button.c +++ b/em-format/e-mail-formatter-secure-button.c @@ -460,12 +460,6 @@ emfe_secure_button_get_widget (EMailFormatterExtension *extension, } static const gchar * -emfe_secure_button_get_display_name (EMailFormatterExtension *extension) -{ - return NULL; -} - -static const gchar * emfe_secure_button_get_description (EMailFormatterExtension *extension) { return NULL; @@ -477,7 +471,6 @@ e_mail_formatter_secure_button_class_init (EMailFormatterExtensionClass *class) class->mime_types = formatter_mime_types; class->format = emfe_secure_button_format; class->get_widget = emfe_secure_button_get_widget; - class->get_display_name = emfe_secure_button_get_display_name; class->get_description = emfe_secure_button_get_description; } diff --git a/em-format/e-mail-formatter-source.c b/em-format/e-mail-formatter-source.c index 8c5242c0b6..aec6ea29c9 100644 --- a/em-format/e-mail-formatter-source.c +++ b/em-format/e-mail-formatter-source.c @@ -122,12 +122,6 @@ emfe_source_format (EMailFormatterExtension *extension, } static const gchar * -emfe_source_get_display_name (EMailFormatterExtension *extension) -{ - return _("Source"); -} - -static const gchar * emfe_source_get_description (EMailFormatterExtension *extension) { return _("Display source of a MIME part"); @@ -136,9 +130,9 @@ emfe_source_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_source_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Source"); class->mime_types = formatter_mime_types; class->format = emfe_source_format; - class->get_display_name = emfe_source_get_display_name; class->get_description = emfe_source_get_description; } diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c index 342228d956..e88d96b049 100644 --- a/em-format/e-mail-formatter-text-enriched.c +++ b/em-format/e-mail-formatter-text-enriched.c @@ -98,12 +98,6 @@ emfe_text_enriched_format (EMailFormatterExtension *extension, } static const gchar * -emfe_text_enriched_get_display_name (EMailFormatterExtension *extension) -{ - return _("Richtext"); -} - -static const gchar * emfe_text_enriched_get_description (EMailFormatterExtension *extension) { return _("Display part as enriched text"); @@ -112,9 +106,9 @@ emfe_text_enriched_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_text_enriched_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Richtext"); class->mime_types = formatter_mime_types; class->format = emfe_text_enriched_format; - class->get_display_name = emfe_text_enriched_get_display_name; class->get_description = emfe_text_enriched_get_description; } diff --git a/em-format/e-mail-formatter-text-html.c b/em-format/e-mail-formatter-text-html.c index 9a1883eb5c..8b7453f36c 100644 --- a/em-format/e-mail-formatter-text-html.c +++ b/em-format/e-mail-formatter-text-html.c @@ -337,12 +337,6 @@ emfe_text_html_format (EMailFormatterExtension *extension, } static const gchar * -emfe_text_html_get_display_name (EMailFormatterExtension *extension) -{ - return _("HTML"); -} - -static const gchar * emfe_text_html_get_description (EMailFormatterExtension *extension) { return _("Format part as HTML"); @@ -351,9 +345,9 @@ emfe_text_html_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_text_html_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("HTML"); class->mime_types = formatter_mime_types; class->format = emfe_text_html_format; - class->get_display_name = emfe_text_html_get_display_name; class->get_description = emfe_text_html_get_description; } diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c index 8a29a90d2a..922a7c4675 100644 --- a/em-format/e-mail-formatter-text-plain.c +++ b/em-format/e-mail-formatter-text-plain.c @@ -172,12 +172,6 @@ emfe_text_plain_format (EMailFormatterExtension *extension, } static const gchar * -emfe_text_plain_get_display_name (EMailFormatterExtension *extension) -{ - return _("Plain Text"); -} - -static const gchar * emfe_text_plain_get_description (EMailFormatterExtension *extension) { return _("Format part as plain text"); @@ -186,9 +180,9 @@ emfe_text_plain_get_description (EMailFormatterExtension *extension) static void e_mail_formatter_text_plain_class_init (EMailFormatterExtensionClass *class) { + class->display_name = _("Plain Text"); class->mime_types = formatter_mime_types; class->format = emfe_text_plain_format; - class->get_display_name = emfe_text_plain_get_display_name; class->get_description = emfe_text_plain_get_description; } |