Commit 7885426c authored by Matthew Barnes's avatar Matthew Barnes
Browse files

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.
parent 00b211b0
......@@ -98,12 +98,6 @@ emfe_attachment_bar_get_widget (EMailFormatterExtension *extension,
return widget;
}
static const gchar *
emfe_attachment_bar_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfe_attachment_bar_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -362,12 +362,6 @@ emfe_attachment_get_widget (EMailFormatterExtension *extension,
return widget;
}
static const gchar *
emfe_attachment_get_display_name (EMailFormatterExtension *extension)
{
return _("Attachment");
}
static const gchar *
emfe_attachment_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -104,12 +104,6 @@ emfe_error_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_error_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfe_error_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -138,28 +138,6 @@ e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension,
return widget;
}
/**
* 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
......
......@@ -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);
......
......@@ -559,12 +559,6 @@ emfe_headers_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_headers_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfe_headers_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -139,12 +139,6 @@ emfe_image_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_image_get_display_name (EMailFormatterExtension *extension)
{
return _("Regular Image");
}
static const gchar *
emfe_image_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -230,12 +230,6 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_message_rfc822_get_display_name (EMailFormatterExtension *extension)
{
return _("RFC822 message");
}
static const gchar *
emfe_message_rfc822_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -206,12 +206,6 @@ emfpe_headers_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfpe_headers_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfpe_headers_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -107,12 +107,6 @@ emfqe_attachment_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfqe_attachment_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfqe_attachment_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -232,12 +232,6 @@ emqfe_headers_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_headers_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emqfe_headers_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -136,12 +136,6 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfqe_message_rfc822_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfqe_message_rfc822_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -81,12 +81,6 @@ emqfe_text_enriched_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_text_enriched_get_display_name (EMailFormatterExtension *extension)
{
return _("Richtext");
}
static const gchar *
emqfe_text_enriched_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -84,12 +84,6 @@ emqfe_text_html_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_text_html_get_display_name (EMailFormatterExtension *extension)
{
return _("HTML");
}
static const gchar *
emqfe_text_html_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -103,12 +103,6 @@ emqfe_text_plain_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_text_plain_get_display_name (EMailFormatterExtension *extension)
{
return _("Plain Text");
}
static const gchar *
emqfe_text_plain_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -459,12 +459,6 @@ emfe_secure_button_get_widget (EMailFormatterExtension *extension,
return grid;
}
static const gchar *
emfe_secure_button_get_display_name (EMailFormatterExtension *extension)
{
return NULL;
}
static const gchar *
emfe_secure_button_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -121,12 +121,6 @@ emfe_source_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_source_get_display_name (EMailFormatterExtension *extension)
{
return _("Source");
}
static const gchar *
emfe_source_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -97,12 +97,6 @@ emfe_text_enriched_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_text_enriched_get_display_name (EMailFormatterExtension *extension)
{
return _("Richtext");
}
static const gchar *
emfe_text_enriched_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -336,12 +336,6 @@ emfe_text_html_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_text_html_get_display_name (EMailFormatterExtension *extension)
{
return _("HTML");
}
static const gchar *
emfe_text_html_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
......@@ -171,12 +171,6 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_text_plain_get_display_name (EMailFormatterExtension *extension)
{
return _("Plain Text");
}
static const gchar *
emfe_text_plain_get_description (EMailFormatterExtension *extension)
{
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment