aboutsummaryrefslogtreecommitdiffstats
path: root/em-format
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-12-07 23:31:18 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-12-08 03:01:05 +0800
commitd9699159f010c612deca650c6ee336763d908954 (patch)
tree4839a8707065a7213d407b6124c3d9c486e456c8 /em-format
parent7885426c2bfc410838e9c49bfd350b04e0535435 (diff)
downloadgsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.tar
gsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.tar.gz
gsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.tar.bz2
gsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.tar.lz
gsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.tar.xz
gsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.tar.zst
gsoc2013-evolution-d9699159f010c612deca650c6ee336763d908954.zip
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.
Diffstat (limited to 'em-format')
-rw-r--r--em-format/e-mail-formatter-attachment-bar.c7
-rw-r--r--em-format/e-mail-formatter-attachment.c8
-rw-r--r--em-format/e-mail-formatter-error.c7
-rw-r--r--em-format/e-mail-formatter-extension.c21
-rw-r--r--em-format/e-mail-formatter-extension.h8
-rw-r--r--em-format/e-mail-formatter-headers.c7
-rw-r--r--em-format/e-mail-formatter-image.c8
-rw-r--r--em-format/e-mail-formatter-message-rfc822.c8
-rw-r--r--em-format/e-mail-formatter-print-headers.c7
-rw-r--r--em-format/e-mail-formatter-quote-attachment.c7
-rw-r--r--em-format/e-mail-formatter-quote-headers.c7
-rw-r--r--em-format/e-mail-formatter-quote-message-rfc822.c7
-rw-r--r--em-format/e-mail-formatter-quote-text-enriched.c8
-rw-r--r--em-format/e-mail-formatter-quote-text-html.c8
-rw-r--r--em-format/e-mail-formatter-quote-text-plain.c8
-rw-r--r--em-format/e-mail-formatter-secure-button.c7
-rw-r--r--em-format/e-mail-formatter-source.c8
-rw-r--r--em-format/e-mail-formatter-text-enriched.c8
-rw-r--r--em-format/e-mail-formatter-text-html.c8
-rw-r--r--em-format/e-mail-formatter-text-plain.c8
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 c9c9ef1233..0404d9cfe5 100644
--- a/em-format/e-mail-formatter-attachment-bar.c
+++ b/em-format/e-mail-formatter-attachment-bar.c
@@ -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
diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c
index 5fedf950d2..fa0e585a14 100644
--- a/em-format/e-mail-formatter-attachment.c
+++ b/em-format/e-mail-formatter-attachment.c
@@ -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
diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c
index 22f661b845..f3bf6f6a86 100644
--- a/em-format/e-mail-formatter-error.c
+++ b/em-format/e-mail-formatter-error.c
@@ -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
diff --git a/em-format/e-mail-formatter-extension.c b/em-format/e-mail-formatter-extension.c
index 01764a796f..9390d77a15 100644
--- a/em-format/e-mail-formatter-extension.c
+++ b/em-format/e-mail-formatter-extension.c
@@ -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);
-}
diff --git a/em-format/e-mail-formatter-extension.h b/em-format/e-mail-formatter-extension.h
index e03932b5d1..bdae859970 100644
--- a/em-format/e-mail-formatter-extension.h
+++ b/em-format/e-mail-formatter-extension.h
@@ -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
diff --git a/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c
index 8c1a46a5de..8759ece199 100644
--- a/em-format/e-mail-formatter-headers.c
+++ b/em-format/e-mail-formatter-headers.c
@@ -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
diff --git a/em-format/e-mail-formatter-image.c b/em-format/e-mail-formatter-image.c
index 63f17b0711..f06bff1897 100644
--- a/em-format/e-mail-formatter-image.c
+++ b/em-format/e-mail-formatter-image.c
@@ -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
diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c
index 893344e083..41b89f461b 100644
--- a/em-format/e-mail-formatter-message-rfc822.c
+++ b/em-format/e-mail-formatter-message-rfc822.c
@@ -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
diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c
index 956338f382..8f1745b05e 100644
--- a/em-format/e-mail-formatter-print-headers.c
+++ b/em-format/e-mail-formatter-print-headers.c
@@ -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
diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c
index 03a2961f57..d442236709 100644
--- a/em-format/e-mail-formatter-quote-attachment.c
+++ b/em-format/e-mail-formatter-quote-attachment.c
@@ -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
diff --git a/em-format/e-mail-formatter-quote-headers.c b/em-format/e-mail-formatter-quote-headers.c
index 3b1a74b02c..b98f17940d 100644
--- a/em-format/e-mail-formatter-quote-headers.c
+++ b/em-format/e-mail-formatter-quote-headers.c
@@ -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
diff --git a/em-format/e-mail-formatter-quote-message-rfc822.c b/em-format/e-mail-formatter-quote-message-rfc822.c
index a26b735a8b..d235788b3e 100644
--- a/em-format/e-mail-formatter-quote-message-rfc822.c
+++ b/em-format/e-mail-formatter-quote-message-rfc822.c
@@ -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
diff --git a/em-format/e-mail-formatter-quote-text-enriched.c b/em-format/e-mail-formatter-quote-text-enriched.c
index b397b18809..05ae6e0452 100644
--- a/em-format/e-mail-formatter-quote-text-enriched.c
+++ b/em-format/e-mail-formatter-quote-text-enriched.c
@@ -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
diff --git a/em-format/e-mail-formatter-quote-text-html.c b/em-format/e-mail-formatter-quote-text-html.c
index 0031507360..dc98d99574 100644
--- a/em-format/e-mail-formatter-quote-text-html.c
+++ b/em-format/e-mail-formatter-quote-text-html.c
@@ -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
diff --git a/em-format/e-mail-formatter-quote-text-plain.c b/em-format/e-mail-formatter-quote-text-plain.c
index 9ac12b33a0..8c7e369814 100644
--- a/em-format/e-mail-formatter-quote-text-plain.c
+++ b/em-format/e-mail-formatter-quote-text-plain.c
@@ -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
diff --git a/em-format/e-mail-formatter-secure-button.c b/em-format/e-mail-formatter-secure-button.c
index a900fc92a8..164cb19198 100644
--- a/em-format/e-mail-formatter-secure-button.c
+++ b/em-format/e-mail-formatter-secure-button.c
@@ -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
diff --git a/em-format/e-mail-formatter-source.c b/em-format/e-mail-formatter-source.c
index aec6ea29c9..26e9d92d7b 100644
--- a/em-format/e-mail-formatter-source.c
+++ b/em-format/e-mail-formatter-source.c
@@ -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
diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c
index e88d96b049..ce2769d229 100644
--- a/em-format/e-mail-formatter-text-enriched.c
+++ b/em-format/e-mail-formatter-text-enriched.c
@@ -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
diff --git a/em-format/e-mail-formatter-text-html.c b/em-format/e-mail-formatter-text-html.c
index 8b7453f36c..c3b190fea2 100644
--- a/em-format/e-mail-formatter-text-html.c
+++ b/em-format/e-mail-formatter-text-html.c
@@ -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
diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c
index 922a7c4675..9a3b31ac60 100644
--- a/em-format/e-mail-formatter-text-plain.c
+++ b/em-format/e-mail-formatter-text-plain.c
@@ -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