Commit d9699159 authored by Matthew Barnes's avatar Matthew Barnes
Browse files

EMailFormatterExtension: Convert get_description() to a string field.

Of the formatter extensions that provide a description, they all use a
static string.  So we don't need an instance of the extension to obtain
its description.  Just make it a string field in the class structure.
parent 7885426c
......@@ -98,19 +98,12 @@ emfe_attachment_bar_get_widget (EMailFormatterExtension *extension,
return widget;
}
static const gchar *
emfe_attachment_bar_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
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_description = emfe_attachment_bar_get_description;
}
static void
......
......@@ -362,20 +362,14 @@ emfe_attachment_get_widget (EMailFormatterExtension *extension,
return widget;
}
static const gchar *
emfe_attachment_get_description (EMailFormatterExtension *extension)
{
return _("Display as attachment");
}
static void
e_mail_formatter_attachment_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Attachment");
class->description = _("Display as attachment");
class->mime_types = formatter_mime_types;
class->format = emfe_attachment_format;
class->get_widget = emfe_attachment_get_widget;
class->get_description = emfe_attachment_get_description;
}
static void
......
......@@ -104,18 +104,11 @@ emfe_error_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_error_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
e_mail_formatter_error_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emfe_error_format;
class->get_description = emfe_error_get_description;
}
static void
......
......@@ -138,24 +138,3 @@ e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension,
return widget;
}
/**
* e_mail_formatter_extension_get_description:
* @extension: an #EMailFormatterExtension
*
* A virtual function reimplemented in all formatter extensions. It returns a
* longer description of capabilities of the extension.
*
* Returns: A (localized) string with description of the extension.
*/
const gchar *
e_mail_formatter_extension_get_description (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_description != NULL, NULL);
return class->get_description (extension);
}
......@@ -69,6 +69,9 @@ struct _EMailFormatterExtensionClass {
/* This is a short name for the extension (optional). */
const gchar *display_name;
/* This is a longer description of the extension (optional). */
const gchar *description;
/* 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/ *"). */
......@@ -84,9 +87,6 @@ struct _EMailFormatterExtensionClass {
EMailPartList *context,
EMailPart *part,
GHashTable *params);
const gchar * (*get_description)
(EMailFormatterExtension *extension);
};
GType e_mail_formatter_extension_get_type
......@@ -105,8 +105,6 @@ GtkWidget * e_mail_formatter_extension_get_widget
EMailPartList *context,
EMailPart *part,
GHashTable *params);
const gchar * e_mail_formatter_extension_get_description
(EMailFormatterExtension *extension);
G_END_DECLS
......
......@@ -559,18 +559,11 @@ emfe_headers_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_headers_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
e_mail_formatter_headers_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emfe_headers_format;
class->get_description = emfe_headers_get_description;
}
static void
......
......@@ -139,19 +139,13 @@ emfe_image_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_image_get_description (EMailFormatterExtension *extension)
{
return _("Display part as an image");
}
static void
e_mail_formatter_image_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Regular Image");
class->description = _("Display part as an image");
class->mime_types = formatter_mime_types;
class->format = emfe_image_format;
class->get_description = emfe_image_get_description;
}
static void
......
......@@ -230,19 +230,13 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_message_rfc822_get_description (EMailFormatterExtension *extension)
{
return _("Format part as an RFC822 message");
}
static void
e_mail_formatter_message_rfc822_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("RFC822 message");
class->description = _("Format part as an RFC822 message");
class->mime_types = formatter_mime_types;
class->format = emfe_message_rfc822_format;
class->get_description = emfe_message_rfc822_get_description;
}
static void
......
......@@ -206,18 +206,11 @@ emfpe_headers_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfpe_headers_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
e_mail_formatter_print_headers_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emfpe_headers_format;
class->get_description = emfpe_headers_get_description;
}
static void
......
......@@ -107,18 +107,11 @@ emfqe_attachment_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfqe_attachment_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
e_mail_formatter_quote_attachment_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emfqe_attachment_format;
class->get_description = emfqe_attachment_get_description;
}
static void
......
......@@ -232,18 +232,11 @@ emqfe_headers_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_headers_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
e_mail_formatter_quote_headers_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emqfe_headers_format;
class->get_description = emqfe_headers_get_description;
}
static void
......
......@@ -136,18 +136,11 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfqe_message_rfc822_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
e_mail_formatter_quote_message_rfc822_class_init (EMailFormatterExtensionClass *class)
{
class->mime_types = formatter_mime_types;
class->format = emfqe_message_rfc822_format;
class->get_description = emfqe_message_rfc822_get_description;
}
static void
......
......@@ -81,19 +81,13 @@ emqfe_text_enriched_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_text_enriched_get_description (EMailFormatterExtension *extension)
{
return _("Display part as enriched text");
}
static void
e_mail_formatter_quote_text_enriched_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Richtext");
class->description = _("Display part as enriched text");
class->mime_types = formatter_mime_types;
class->format = emqfe_text_enriched_format;
class->get_description = emqfe_text_enriched_get_description;
}
static void
......
......@@ -84,19 +84,13 @@ emqfe_text_html_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_text_html_get_description (EMailFormatterExtension *extension)
{
return _("Format part as HTML");
}
static void
e_mail_formatter_quote_text_html_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("HTML");
class->description = _("Format part as HTML");
class->mime_types = formatter_mime_types;
class->format = emqfe_text_html_format;
class->get_description = emqfe_text_html_get_description;
}
static void
......
......@@ -103,19 +103,13 @@ emqfe_text_plain_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emqfe_text_plain_get_description (EMailFormatterExtension *extension)
{
return _("Format part as plain text");
}
static void
e_mail_formatter_quote_text_plain_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Plain Text");
class->description = _("Format part as plain text");
class->mime_types = formatter_mime_types;
class->format = emqfe_text_plain_format;
class->get_description = emqfe_text_plain_get_description;
}
static void
......
......@@ -459,19 +459,12 @@ emfe_secure_button_get_widget (EMailFormatterExtension *extension,
return grid;
}
static const gchar *
emfe_secure_button_get_description (EMailFormatterExtension *extension)
{
return NULL;
}
static void
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_description = emfe_secure_button_get_description;
}
static void
......
......@@ -121,19 +121,13 @@ emfe_source_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_source_get_description (EMailFormatterExtension *extension)
{
return _("Display source of a MIME part");
}
static void
e_mail_formatter_source_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Source");
class->description = _("Display source of a MIME part");
class->mime_types = formatter_mime_types;
class->format = emfe_source_format;
class->get_description = emfe_source_get_description;
}
static void
......
......@@ -97,19 +97,13 @@ emfe_text_enriched_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_text_enriched_get_description (EMailFormatterExtension *extension)
{
return _("Display part as enriched text");
}
static void
e_mail_formatter_text_enriched_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Richtext");
class->description = _("Display part as enriched text");
class->mime_types = formatter_mime_types;
class->format = emfe_text_enriched_format;
class->get_description = emfe_text_enriched_get_description;
}
static void
......
......@@ -336,19 +336,13 @@ emfe_text_html_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_text_html_get_description (EMailFormatterExtension *extension)
{
return _("Format part as HTML");
}
static void
e_mail_formatter_text_html_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("HTML");
class->description = _("Format part as HTML");
class->mime_types = formatter_mime_types;
class->format = emfe_text_html_format;
class->get_description = emfe_text_html_get_description;
}
static void
......
......@@ -171,19 +171,13 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
return TRUE;
}
static const gchar *
emfe_text_plain_get_description (EMailFormatterExtension *extension)
{
return _("Format part as plain text");
}
static void
e_mail_formatter_text_plain_class_init (EMailFormatterExtensionClass *class)
{
class->display_name = _("Plain Text");
class->description = _("Format part as plain text");
class->mime_types = formatter_mime_types;
class->format = emfe_text_plain_format;
class->get_description = emfe_text_plain_get_description;
}
static void
......
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