diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-07 22:37:37 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-08 03:01:05 +0800 |
commit | 00b211b0f515d6b6d9147c1ca568d0c4b42af699 (patch) | |
tree | f12c1f0180a6c76918f0f6b379d64246f689105f /em-format | |
parent | 54455ca1ad6cae527544fed12d0de4ae95341082 (diff) | |
download | gsoc2013-evolution-00b211b0f515d6b6d9147c1ca568d0c4b42af699.tar.gz gsoc2013-evolution-00b211b0f515d6b6d9147c1ca568d0c4b42af699.tar.zst gsoc2013-evolution-00b211b0f515d6b6d9147c1ca568d0c4b42af699.zip |
Convert EMailFormatterExtension to an abstract class.
With the previous changes, all formatter extensions derive from
GObjectClass and implement the EMailFormatterExtensionInterface.
Simplify things further by making EMailFormatterExtension an abstract
base class so formatter extensions are now just direct subclasses and
need not bother with implementing GObject interfaces.
Diffstat (limited to 'em-format')
21 files changed, 275 insertions, 594 deletions
diff --git a/em-format/e-mail-format-extensions.c b/em-format/e-mail-format-extensions.c index 01162bc9ea..117d51a90e 100644 --- a/em-format/e-mail-format-extensions.c +++ b/em-format/e-mail-format-extensions.c @@ -98,13 +98,9 @@ load (EMailExtensionRegistry *ereg, extension_class = g_type_class_ref (extension_type); interface_type = E_TYPE_MAIL_FORMATTER_EXTENSION; - if (g_type_is_a (extension_type, interface_type)) { - EMailFormatterExtensionInterface *interface; - - interface = g_type_interface_peek ( - extension_class, interface_type); - mime_types = interface->mime_types; - } + if (g_type_is_a (extension_type, interface_type)) + mime_types = ((EMailFormatterExtensionClass *) + extension_class)->mime_types; interface_type = E_TYPE_MAIL_PARSER_EXTENSION; if (g_type_is_a (extension_type, interface_type)) { diff --git a/em-format/e-mail-formatter-attachment-bar.c b/em-format/e-mail-formatter-attachment-bar.c index 160c8af891..57e6a72d8f 100644 --- a/em-format/e-mail-formatter-attachment-bar.c +++ b/em-format/e-mail-formatter-attachment-bar.c @@ -28,24 +28,13 @@ #include <em-format/e-mail-formatter-extension.h> #include <em-format/e-mail-formatter.h> -typedef struct _EMailFormatterAttachmentBar { - GObject parent; -} EMailFormatterAttachmentBar; +typedef EMailFormatterExtension EMailFormatterAttachmentBar; +typedef EMailFormatterExtensionClass EMailFormatterAttachmentBarClass; -typedef struct _EMailFormatterAttachmentBarClass { - GObjectClass parent_class; -} EMailFormatterAttachmentBarClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterAttachmentBar, e_mail_formatter_attachment_bar, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.widget.attachment-bar", @@ -122,22 +111,16 @@ emfe_attachment_bar_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_attachment_bar_class_init (EMailFormatterAttachmentBarClass *class) +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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_attachment_bar_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_attachment_bar_format; - iface->get_widget = emfe_attachment_bar_get_widget; - iface->get_display_name = emfe_attachment_bar_get_display_name; - iface->get_description = emfe_attachment_bar_get_description; -} - -static void -e_mail_formatter_attachment_bar_init (EMailFormatterAttachmentBar *extension) -{ - } diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c index f637766f1d..1e9565d611 100644 --- a/em-format/e-mail-formatter-attachment.c +++ b/em-format/e-mail-formatter-attachment.c @@ -40,25 +40,13 @@ #define d(x) -typedef struct _EMailFormatterAttachment { - GObject parent; -} EMailFormatterAttachment; +typedef EMailFormatterExtension EMailFormatterAttachment; +typedef EMailFormatterExtensionClass EMailFormatterAttachmentClass; -typedef struct _EMailFormatterAttachmentClass { - GObjectClass parent_class; -} EMailFormatterAttachmentClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterAttachment, e_mail_formatter_attachment, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init) -) + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.attachment", @@ -387,22 +375,16 @@ emfe_attachment_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_attachment_class_init (EMailFormatterAttachmentClass *class) +e_mail_formatter_attachment_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_attachment_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_attachment_format; - iface->get_widget = emfe_attachment_get_widget; - iface->get_display_name = emfe_attachment_get_display_name; - iface->get_description = emfe_attachment_get_description; -} - -static void -e_mail_formatter_attachment_init (EMailFormatterAttachment *formatter) -{ - } diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c index 8c8615662c..441a86c9d8 100644 --- a/em-format/e-mail-formatter-error.c +++ b/em-format/e-mail-formatter-error.c @@ -29,24 +29,13 @@ #include <camel/camel.h> -typedef struct _EMailFormatterError { - GObject parent; -} EMailFormatterError; +typedef EMailFormatterExtension EMailFormatterError; +typedef EMailFormatterExtensionClass EMailFormatterErrorClass; -typedef struct _EMailFormatterErrorClass { - GObjectClass parent_class; -} EMailFormatterErrorClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterError, e_mail_formatter_error, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.error", @@ -128,21 +117,15 @@ emfe_error_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_error_class_init (EMailFormatterErrorClass *class) +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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_error_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_error_format; - iface->get_display_name = emfe_error_get_display_name; - iface->get_description = emfe_error_get_description; -} - -static void -e_mail_formatter_error_init (EMailFormatterError *formatter) -{ - } diff --git a/em-format/e-mail-formatter-extension.c b/em-format/e-mail-formatter-extension.c index 3e10aa1488..beee63841b 100644 --- a/em-format/e-mail-formatter-extension.c +++ b/em-format/e-mail-formatter-extension.c @@ -18,22 +18,19 @@ #include "e-mail-formatter-extension.h" -G_DEFINE_INTERFACE ( +G_DEFINE_ABSTRACT_TYPE ( EMailFormatterExtension, e_mail_formatter_extension, G_TYPE_OBJECT) -/** - * EMailFormatterExtension: - * - * The #EMailFormatterExtension is an abstract interface for all extensions for - * #EmailFormatter. - */ - static void -e_mail_formatter_extension_default_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_extension_class_init (EMailFormatterExtensionClass *class) { +} +static void +e_mail_formatter_extension_init (EMailFormatterExtension *extension) +{ } /** @@ -45,18 +42,18 @@ e_mail_formatter_extension_default_init (EMailFormatterExtensionInterface *iface * @stream: a #CamelStream to which the output should be written * @cancellable: (allow-none) a #GCancellable * - * A virtual function reimplemented in all mail formatter extensions. The function - * formats @part, generated HTML (or other format that can be displayed to user) - * and writes it to the @stream. + * A virtual function reimplemented in all mail formatter extensions. The + * function formats @part, generated HTML (or other format that can be + * displayed to user) and writes it to the @stream. * * When the function is unable to format the @part (either because it's broken - * or because it is a different mimetype then the extension is specialized for), the - * function will return @FALSE indicating the #EMailFormatter, that it should pick - * another extension. + * or because it is a different mimetype then the extension is specialized + * for), the function will return @FALSE indicating the #EMailFormatter, that + * it should pick another extension. * * Implementation of this function must be thread-safe. * - * Return value: Returns @TRUE when the @part was successfully formatted and + * Returns: Returns @TRUE when the @part was successfully formatted and * data were written to the @stream, @FALSE otherwise. */ gboolean @@ -67,7 +64,7 @@ e_mail_formatter_extension_format (EMailFormatterExtension *extension, CamelStream *stream, GCancellable *cancellable) { - EMailFormatterExtensionInterface *interface; + EMailFormatterExtensionClass *class; g_return_val_if_fail (E_IS_MAIL_FORMATTER_EXTENSION (extension), FALSE); g_return_val_if_fail (E_IS_MAIL_FORMATTER (formatter), FALSE); @@ -75,10 +72,10 @@ e_mail_formatter_extension_format (EMailFormatterExtension *extension, g_return_val_if_fail (part != NULL, FALSE); g_return_val_if_fail (CAMEL_IS_STREAM (stream), FALSE); - interface = E_MAIL_FORMATTER_EXTENSION_GET_INTERFACE (extension); - g_return_val_if_fail (interface->format != NULL, FALSE); + class = E_MAIL_FORMATTER_EXTENSION_GET_CLASS (extension); + g_return_val_if_fail (class->format != NULL, FALSE); - return interface->format (extension, formatter, context, part, stream, cancellable); + return class->format (extension, formatter, context, part, stream, cancellable); } /** @@ -87,19 +84,19 @@ e_mail_formatter_extension_format (EMailFormatterExtension *extension, * * Returns whether the extension can provide a GtkWidget. * - * Return value: Returns %TRUE when @extension reimplements get_widget(), %FALSE + * Returns: Returns %TRUE when @extension reimplements get_widget(), %FALSE * otherwise. */ gboolean e_mail_formatter_extension_has_widget (EMailFormatterExtension *extension) { - EMailFormatterExtensionInterface *interface; + EMailFormatterExtensionClass *class; g_return_val_if_fail (E_IS_MAIL_FORMATTER_EXTENSION (extension), FALSE); - interface = E_MAIL_FORMATTER_EXTENSION_GET_INTERFACE (extension); + class = E_MAIL_FORMATTER_EXTENSION_GET_CLASS (extension); - return (interface->get_widget != NULL); + return (class->get_widget != NULL); } /** @@ -108,17 +105,17 @@ e_mail_formatter_extension_has_widget (EMailFormatterExtension *extension) * @part: an #EMailPart * @params: a #GHashTable * - * A virtual function reimplemented in some mail formatter extensions. The function - * should construct a #GtkWidget for given @part. The @params hash table can contain - * additional parameters listed in the <object> HTML element that has requested - * the widget. + * A virtual function reimplemented in some mail formatter extensions. The + * function should construct a #GtkWidget for given @part. The @params hash + * table can contain additional parameters listed in the <object> HTML + * element that has requested the widget. * * When @bind_dom_func is not %NULL, the callee will set a callback function * which should be called when the webpage is completely rendered to setup * bindings between DOM events and the widget. * - * Return value: Returns a #GtkWidget or %NULL, when error occurs or given @extension - * does not reimplement this method. + * Returns: Returns a #GtkWidget or %NULL, when error occurs or given + * @extension does not reimplement this method. */ GtkWidget * e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension, @@ -126,20 +123,17 @@ e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension, EMailPart *part, GHashTable *params) { - EMailFormatterExtensionInterface *interface; - GtkWidget *widget; + EMailFormatterExtensionClass *class; + GtkWidget *widget = NULL; g_return_val_if_fail (E_IS_MAIL_FORMATTER_EXTENSION (extension), NULL); g_return_val_if_fail (part != NULL, NULL); g_return_val_if_fail (params != NULL, NULL); - interface = E_MAIL_FORMATTER_EXTENSION_GET_INTERFACE (extension); + class = E_MAIL_FORMATTER_EXTENSION_GET_CLASS (extension); - widget = NULL; - if (interface->get_widget) { - widget = interface->get_widget ( - extension, context, part, params); - } + if (class->get_widget != NULL) + widget = class->get_widget (extension, context, part, params); return widget; } @@ -149,21 +143,21 @@ e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension, * @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 interface. + * short name of the extension that can be displayed in user class. * - * Return value: A (localized) string with name of the extension + * Returns: A (localized) string with name of the extension */ const gchar * e_mail_formatter_extension_get_display_name (EMailFormatterExtension *extension) { - EMailFormatterExtensionInterface *interface; + EMailFormatterExtensionClass *class; g_return_val_if_fail (E_IS_MAIL_FORMATTER_EXTENSION (extension), NULL); - interface = E_MAIL_FORMATTER_EXTENSION_GET_INTERFACE (extension); - g_return_val_if_fail (interface->get_display_name != NULL, NULL); + class = E_MAIL_FORMATTER_EXTENSION_GET_CLASS (extension); + g_return_val_if_fail (class->get_display_name != NULL, NULL); - return interface->get_display_name (extension); + return class->get_display_name (extension); } /** @@ -173,17 +167,17 @@ e_mail_formatter_extension_get_display_name (EMailFormatterExtension *extension) * A virtual function reimplemented in all formatter extensions. It returns a * longer description of capabilities of the extension. * - * Return value: A (localized) string with description of the extension. + * Returns: A (localized) string with description of the extension. */ const gchar * e_mail_formatter_extension_get_description (EMailFormatterExtension *extension) { - EMailFormatterExtensionInterface *interface; + EMailFormatterExtensionClass *class; g_return_val_if_fail (E_IS_MAIL_FORMATTER_EXTENSION (extension), NULL); - interface = E_MAIL_FORMATTER_EXTENSION_GET_INTERFACE (extension); - g_return_val_if_fail (interface->get_description != NULL, NULL); + class = E_MAIL_FORMATTER_EXTENSION_GET_CLASS (extension); + g_return_val_if_fail (class->get_description != NULL, NULL); - return interface->get_description (extension); + return class->get_description (extension); } diff --git a/em-format/e-mail-formatter-extension.h b/em-format/e-mail-formatter-extension.h index 9a3f3925c4..9111ad85f3 100644 --- a/em-format/e-mail-formatter-extension.h +++ b/em-format/e-mail-formatter-extension.h @@ -30,29 +30,41 @@ #define E_MAIL_FORMATTER_EXTENSION(obj) \ (G_TYPE_CHECK_INSTANCE_CAST \ ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtension)) -#define E_MAIL_FORMATTER_EXTENSION_INTERFACE(cls) \ +#define E_MAIL_FORMATTER_EXTENSION_CLASS(cls) \ (G_TYPE_CHECK_CLASS_CAST \ - ((cls), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtensionInterface)) + ((cls), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtensionClass)) #define E_IS_MAIL_FORMATTER_EXTENSION(obj) \ (G_TYPE_CHECK_INSTANCE_TYPE \ ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION)) -#define E_IS_MAIL_FORMATTER_EXTENSION_INTERFACE(cls) \ +#define E_IS_MAIL_FORMATTER_EXTENSION_CLASS(cls) \ (G_TYPE_CHECK_CLASS_TYPE \ ((cls), E_TYPE_MAIL_FORMATTER_EXTENSION)) -#define E_MAIL_FORMATTER_EXTENSION_GET_INTERFACE(obj) \ - (G_TYPE_INSTANCE_GET_INTERFACE \ - ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtensionInterface)) +#define E_MAIL_FORMATTER_EXTENSION_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_FORMATTER_EXTENSION, EMailFormatterExtensionClass)) #define EMF_EXTENSION_GET_FORMATTER(e) \ E_MAIL_FORMATTER (e_extension_get_extensible (E_EXTENSION (e))) G_BEGIN_DECLS +/** + * EMailFormatterExtension: + * + * The #EMailFormatterExtension is an abstract class for all extensions for + * #EMailFormatter. + */ typedef struct _EMailFormatterExtension EMailFormatterExtension; -typedef struct _EMailFormatterExtensionInterface EMailFormatterExtensionInterface; +typedef struct _EMailFormatterExtensionClass EMailFormatterExtensionClass; +typedef struct _EMailFormatterExtensionPrivate EMailFormatterExtensionPrivate; + +struct _EMailFormatterExtension { + GObject parent; + EMailFormatterExtensionPrivate *priv; +}; -struct _EMailFormatterExtensionInterface { - GTypeInterface parent_interface; +struct _EMailFormatterExtensionClass { + GObjectClass parent_class; /* This is a NULL-terminated array of supported MIME types. * The MIME types can be exact (e.g. "text/plain") or use a @@ -65,23 +77,19 @@ struct _EMailFormatterExtensionInterface { EMailPart *part, CamelStream *stream, GCancellable *cancellable); - GtkWidget * (*get_widget) (EMailFormatterExtension *extension, EMailPartList *context, EMailPart *part, GHashTable *params); - const gchar * (*get_display_name) (EMailFormatterExtension *extension); - const gchar * (*get_description) (EMailFormatterExtension *extension); }; GType e_mail_formatter_extension_get_type - (void); - + (void) G_GNUC_CONST; gboolean e_mail_formatter_extension_format (EMailFormatterExtension *extension, EMailFormatter *formatter, @@ -89,19 +97,15 @@ gboolean e_mail_formatter_extension_format EMailPart *part, CamelStream *stream, GCancellable *cancellable); - gboolean e_mail_formatter_extension_has_widget (EMailFormatterExtension *extension); - GtkWidget * e_mail_formatter_extension_get_widget (EMailFormatterExtension *extension, 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 855f6a6320..135b24f586 100644 --- a/em-format/e-mail-formatter-headers.c +++ b/em-format/e-mail-formatter-headers.c @@ -37,30 +37,19 @@ #include <string.h> -typedef struct _EMailFormatterHeaders { - GObject parent; -} EMailFormatterHeaders; +typedef EMailFormatterExtension EMailFormatterHeaders; +typedef EMailFormatterExtensionClass EMailFormatterHeadersClass; -typedef struct _EMailFormatterHeadersClass { - GObjectClass parent_class; -} EMailFormatterHeadersClass; +G_DEFINE_TYPE ( + EMailFormatterHeaders, + e_mail_formatter_headers, + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.headers", NULL }; -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterHeaders, - e_mail_formatter_headers, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)) - static void format_short_headers (EMailFormatter *formatter, GString *buffer, @@ -583,21 +572,15 @@ emfe_headers_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_headers_class_init (EMailFormatterHeadersClass *class) +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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_headers_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_headers_format; - iface->get_display_name = emfe_headers_get_display_name; - iface->get_description = emfe_headers_get_description; -} - -static void -e_mail_formatter_headers_init (EMailFormatterHeaders *formatter) -{ - } diff --git a/em-format/e-mail-formatter-image.c b/em-format/e-mail-formatter-image.c index cd4d2e1e93..2dbccf50df 100644 --- a/em-format/e-mail-formatter-image.c +++ b/em-format/e-mail-formatter-image.c @@ -33,6 +33,14 @@ #include <glib/gi18n-lib.h> #include <camel/camel.h> +typedef EMailFormatterExtension EMailFormatterImage; +typedef EMailFormatterExtensionClass EMailFormatterImageClass; + +G_DEFINE_TYPE ( + EMailFormatterImage, + e_mail_formatter_image, + E_TYPE_MAIL_FORMATTER_EXTENSION) + static const gchar *formatter_mime_types[] = { "image/gif", "image/jpeg", @@ -54,25 +62,6 @@ static const gchar *formatter_mime_types[] = { NULL }; -typedef struct _EMailFormatterImage { - GObject parent; -} EMailFormatterImage; - -typedef struct _EMailFormatterImageClass { - GObjectClass parent_class; -} EMailFormatterImageClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterImage, - e_mail_formatter_image, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); - static gboolean emfe_image_format (EMailFormatterExtension *extension, EMailFormatter *formatter, @@ -163,21 +152,15 @@ emfe_image_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_image_class_init (EMailFormatterImageClass *class) +e_mail_formatter_image_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_image_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_image_format; - iface->get_display_name = emfe_image_get_display_name; - iface->get_description = emfe_image_get_description; -} - -static void -e_mail_formatter_image_init (EMailFormatterImage *formatter) -{ - } diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c index dea737deb9..1d243f0308 100644 --- a/em-format/e-mail-formatter-message-rfc822.c +++ b/em-format/e-mail-formatter-message-rfc822.c @@ -35,31 +35,20 @@ #include <string.h> +typedef EMailFormatterExtension EMailFormatterMessageRFC822; +typedef EMailFormatterExtensionClass EMailFormatterMessageRFC822Class; + +G_DEFINE_TYPE ( + EMailFormatterMessageRFC822, + e_mail_formatter_message_rfc822, + E_TYPE_MAIL_FORMATTER_EXTENSION) + static const gchar *formatter_mime_types[] = { "message/rfc822", "application/vnd.evolution.rfc822.end", NULL }; -typedef struct _EMailFormatterMessageRFC822 { - GObject parent; -} EMailFormatterMessageRFC822; - -typedef struct _EMailFormatterMessageRFC822Class { - GObjectClass parent_class; -} EMailFormatterMessageRFC822Class; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterMessageRFC822, - e_mail_formatter_message_rfc822, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); - static gboolean emfe_message_rfc822_format (EMailFormatterExtension *extension, EMailFormatter *formatter, @@ -254,21 +243,15 @@ emfe_message_rfc822_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_message_rfc822_class_init (EMailFormatterMessageRFC822Class *class) +e_mail_formatter_message_rfc822_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_message_rfc822_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_message_rfc822_format; - iface->get_display_name = emfe_message_rfc822_get_display_name; - iface->get_description = emfe_message_rfc822_get_description; -} - -static void -e_mail_formatter_message_rfc822_init (EMailFormatterMessageRFC822 *formatter) -{ - } diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c index 1821268424..9ab407937b 100644 --- a/em-format/e-mail-formatter-print-headers.c +++ b/em-format/e-mail-formatter-print-headers.c @@ -35,31 +35,19 @@ #include <string.h> -typedef struct _EMailFormatterPrintHeaders { - GObject parent; -} EMailFormatterPrintHeaders; +typedef EMailFormatterExtension EMailFormatterPrintHeaders; +typedef EMailFormatterExtensionClass EMailFormatterPrintHeadersClass; -typedef struct _EMailFormatterPrintHeadersClass { - GObjectClass parent_class; -} EMailFormatterPrintHeadersClass; +G_DEFINE_TYPE ( + EMailFormatterPrintHeaders, + e_mail_formatter_print_headers, + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.headers", NULL }; -static void e_mail_formatter_print_formatter_extension_interface_init - (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterPrintHeaders, - e_mail_formatter_print_headers, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_print_formatter_extension_interface_init)) - static gboolean emfpe_headers_format (EMailFormatterExtension *extension, EMailFormatter *formatter, @@ -231,21 +219,15 @@ emfpe_headers_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_print_headers_class_init (EMailFormatterPrintHeadersClass *class) +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; } static void -e_mail_formatter_print_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_print_headers_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfpe_headers_format; - iface->get_display_name = emfpe_headers_get_display_name; - iface->get_description = emfpe_headers_get_description; -} - -static void -e_mail_formatter_print_headers_init (EMailFormatterPrintHeaders *formatter) -{ - } diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c index 0dcf5f0206..4a48a84dc0 100644 --- a/em-format/e-mail-formatter-quote-attachment.c +++ b/em-format/e-mail-formatter-quote-attachment.c @@ -33,25 +33,13 @@ #define d(x) -typedef struct _EMailFormatterQuoteAttachment { - GObject parent; -} EMailFormatterQuoteAttachment; +typedef EMailFormatterExtension EMailFormatterQuoteAttachment; +typedef EMailFormatterExtensionClass EMailFormatterQuoteAttachmentClass; -typedef struct _EMailFormatterQuoteAttachmentClass { - GObjectClass parent_class; -} EMailFormatterQuoteAttachmentClass; - -static void e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterQuoteAttachment, e_mail_formatter_quote_attachment, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_quote_formatter_extension_interface_init) -) + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.attachment", @@ -132,21 +120,15 @@ emfqe_attachment_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_quote_attachment_class_init (EMailFormatterQuoteAttachmentClass *class) +e_mail_formatter_quote_attachment_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_quote_attachment_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfqe_attachment_format; - iface->get_display_name = emfqe_attachment_get_display_name; - iface->get_description = emfqe_attachment_get_description; -} - -static void -e_mail_formatter_quote_attachment_init (EMailFormatterQuoteAttachment *formatter) -{ - } diff --git a/em-format/e-mail-formatter-quote-headers.c b/em-format/e-mail-formatter-quote-headers.c index 3f059dc1bb..4e13cab255 100644 --- a/em-format/e-mail-formatter-quote-headers.c +++ b/em-format/e-mail-formatter-quote-headers.c @@ -35,25 +35,13 @@ #include <string.h> -typedef struct _EMailFormatterQuoteHeaders { - GObject parent; -} EMailFormatterQuoteHeaders; +typedef EMailFormatterExtension EMailFormatterQuoteHeaders; +typedef EMailFormatterExtensionClass EMailFormatterQuoteHeadersClass; -typedef struct _EMailFormatterQuoteHeadersClass { - GObjectClass parent_class; -} EMailFormatterQuoteHeadersClass; - -static void e_mail_formatter_quote_formatter_extension_interface_init - (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterQuoteHeaders, e_mail_formatter_quote_headers, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_quote_formatter_extension_interface_init)) + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.headers", @@ -257,21 +245,15 @@ emqfe_headers_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_quote_headers_class_init (EMailFormatterQuoteHeadersClass *class) +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; } static void -e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_quote_headers_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emqfe_headers_format; - iface->get_display_name = emqfe_headers_get_display_name; - iface->get_description = emqfe_headers_get_description; -} - -static void -e_mail_formatter_quote_headers_init (EMailFormatterQuoteHeaders *formatter) -{ - } diff --git a/em-format/e-mail-formatter-quote-message-rfc822.c b/em-format/e-mail-formatter-quote-message-rfc822.c index 19f77c0792..93e4caac9b 100644 --- a/em-format/e-mail-formatter-quote-message-rfc822.c +++ b/em-format/e-mail-formatter-quote-message-rfc822.c @@ -35,24 +35,13 @@ #include <string.h> -typedef struct _EMailFormatterQuoteMessageRFC822 { - GObject parent; -} EMailFormatterQuoteMessageRFC822; +typedef EMailFormatterExtension EMailFormatterQuoteMessageRFC822; +typedef EMailFormatterExtensionClass EMailFormatterQuoteMessageRFC822Class; -typedef struct _EMailFormatterQuoteMessageRFC822Class { - GObjectClass parent_class; -} EMailFormatterQuoteMessageRFC822Class; - -static void e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterQuoteMessageRFC822, e_mail_formatter_quote_message_rfc822, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_quote_formatter_extension_interface_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "message/rfc822", @@ -160,21 +149,15 @@ emfqe_message_rfc822_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_quote_message_rfc822_class_init (EMailFormatterQuoteMessageRFC822Class *class) +e_mail_formatter_quote_message_rfc822_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_quote_message_rfc822_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfqe_message_rfc822_format; - iface->get_display_name = emfqe_message_rfc822_get_display_name; - iface->get_description = emfqe_message_rfc822_get_description; -} - -static void -e_mail_formatter_quote_message_rfc822_init (EMailFormatterQuoteMessageRFC822 *formatter) -{ - } diff --git a/em-format/e-mail-formatter-quote-text-enriched.c b/em-format/e-mail-formatter-quote-text-enriched.c index ba991db2f4..fc7febb09a 100644 --- a/em-format/e-mail-formatter-quote-text-enriched.c +++ b/em-format/e-mail-formatter-quote-text-enriched.c @@ -30,25 +30,13 @@ #include <glib/gi18n-lib.h> #include <camel/camel.h> -typedef struct _EMailFormatterQuoteTextEnriched { - GObject parent; -} EMailFormatterQuoteTextEnriched; +typedef EMailFormatterExtension EMailFormatterQuoteTextEnriched; +typedef EMailFormatterExtensionClass EMailFormatterQuoteTextEnrichedClass; -typedef struct _EMailFormatterQuoteTextEnrichedClass { - GObjectClass parent_class; -} EMailFormatterQuoteTextEnrichedClass; - -static void e_mail_formatter_quote_formatter_extension_interace_init - (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterQuoteTextEnriched, e_mail_formatter_quote_text_enriched, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_quote_formatter_extension_interace_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "text/enriched", @@ -106,21 +94,15 @@ emqfe_text_enriched_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_quote_text_enriched_class_init (EMailFormatterQuoteTextEnrichedClass *class) +e_mail_formatter_quote_text_enriched_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_quote_formatter_extension_interace_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_quote_text_enriched_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emqfe_text_enriched_format; - iface->get_display_name = emqfe_text_enriched_get_display_name; - iface->get_description = emqfe_text_enriched_get_description; -} - -static void -e_mail_formatter_quote_text_enriched_init (EMailFormatterQuoteTextEnriched *formatter) -{ - } diff --git a/em-format/e-mail-formatter-quote-text-html.c b/em-format/e-mail-formatter-quote-text-html.c index bbc81905a1..84425ac8d3 100644 --- a/em-format/e-mail-formatter-quote-text-html.c +++ b/em-format/e-mail-formatter-quote-text-html.c @@ -33,25 +33,13 @@ #include <string.h> -typedef struct _EMailFormatterQuoteTextHTML { - GObject parent; -} EMailFormatterQuoteTextHTML; +typedef EMailFormatterExtension EMailFormatterQuoteTextHTML; +typedef EMailFormatterExtensionClass EMailFormatterQuoteTextHTMLClass; -typedef struct _EMailFormatterQuoteTextHTMLClass { - GObjectClass parent_class; -} EMailFormatterQuoteTextHTMLClass; - -static void e_mail_formatter_quote_formatter_extension_interface_init - (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterQuoteTextHTML, e_mail_formatter_quote_text_html, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_quote_formatter_extension_interface_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "text/html", @@ -109,21 +97,15 @@ emqfe_text_html_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_quote_text_html_class_init (EMailFormatterQuoteTextHTMLClass *class) +e_mail_formatter_quote_text_html_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_quote_text_html_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emqfe_text_html_format; - iface->get_display_name = emqfe_text_html_get_display_name; - iface->get_description = emqfe_text_html_get_description; -} - -static void -e_mail_formatter_quote_text_html_init (EMailFormatterQuoteTextHTML *formatter) -{ - } diff --git a/em-format/e-mail-formatter-quote-text-plain.c b/em-format/e-mail-formatter-quote-text-plain.c index 7deb9ebb75..62715ff708 100644 --- a/em-format/e-mail-formatter-quote-text-plain.c +++ b/em-format/e-mail-formatter-quote-text-plain.c @@ -31,25 +31,13 @@ #include <glib/gi18n-lib.h> #include <camel/camel.h> -typedef struct _EMailFormatterQuoteTextPlain { - GObject parent; -} EMailFormatterQuoteTextPlain; +typedef EMailFormatterExtension EMailFormatterQuoteTextPlain; +typedef EMailFormatterExtensionClass EMailFormatterQuoteTextPlainClass; -typedef struct _EMailFormatterQuoteTextPlainClass { - GObjectClass parent_class; -} EMailFormatterQuoteTextPlainClass; - -static void e_mail_formatter_quote_formatter_extension_interface_init - (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterQuoteTextPlain, e_mail_formatter_quote_text_plain, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_quote_formatter_extension_interface_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "text/plain", @@ -128,21 +116,15 @@ emqfe_text_plain_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_quote_text_plain_class_init (EMailFormatterQuoteTextPlainClass *class) +e_mail_formatter_quote_text_plain_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_quote_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_quote_text_plain_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emqfe_text_plain_format; - iface->get_display_name = emqfe_text_plain_get_display_name; - iface->get_description = emqfe_text_plain_get_description; -} - -static void -e_mail_formatter_quote_text_plain_init (EMailFormatterQuoteTextPlain *formatter) -{ - } diff --git a/em-format/e-mail-formatter-secure-button.c b/em-format/e-mail-formatter-secure-button.c index b31c6fb819..be1331ae00 100644 --- a/em-format/e-mail-formatter-secure-button.c +++ b/em-format/e-mail-formatter-secure-button.c @@ -34,24 +34,13 @@ #include <camel/camel.h> -typedef struct _EMailFormatterSecureButton { - GObject parent; -} EMailFormatterSecureButton; +typedef EMailFormatterExtension EMailFormatterSecureButton; +typedef EMailFormatterExtensionClass EMailFormatterSecureButtonClass; -typedef struct _EMailFormatterSecureButtonClass { - GObjectClass parent_class; -} EMailFormatterSecureButtonClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterSecureButton, e_mail_formatter_secure_button, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.widget.secure-button", @@ -483,22 +472,16 @@ emfe_secure_button_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_secure_button_class_init (EMailFormatterSecureButtonClass *class) +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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_secure_button_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_secure_button_format; - iface->get_widget = emfe_secure_button_get_widget; - iface->get_display_name = emfe_secure_button_get_display_name; - iface->get_description = emfe_secure_button_get_description; -} - -static void -e_mail_formatter_secure_button_init (EMailFormatterSecureButton *extension) -{ - } diff --git a/em-format/e-mail-formatter-source.c b/em-format/e-mail-formatter-source.c index ce9fc36957..8c5242c0b6 100644 --- a/em-format/e-mail-formatter-source.c +++ b/em-format/e-mail-formatter-source.c @@ -30,25 +30,13 @@ #include <glib/gi18n-lib.h> #include <camel/camel.h> -typedef struct _EMailFormatterSource { - GObject parent; -} EMailFormatterSource; +typedef EMailFormatterExtension EMailFormatterSource; +typedef EMailFormatterExtensionClass EMailFormatterSourceClass; -typedef struct _EMailFormatterSourceClass { - GObjectClass parent_class; -} EMailFormatterSourceClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( +G_DEFINE_TYPE ( EMailFormatterSource, e_mail_formatter_source, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init) -) + E_TYPE_MAIL_FORMATTER_EXTENSION) static const gchar *formatter_mime_types[] = { "application/vnd.evolution.source", @@ -146,21 +134,15 @@ emfe_source_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_source_class_init (EMailFormatterSourceClass *class) +e_mail_formatter_source_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_source_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_source_format; - iface->get_display_name = emfe_source_get_display_name; - iface->get_description = emfe_source_get_description; -} - -static void -e_mail_formatter_source_init (EMailFormatterSource *formatter) -{ - } diff --git a/em-format/e-mail-formatter-text-enriched.c b/em-format/e-mail-formatter-text-enriched.c index 7a358bdfad..342228d956 100644 --- a/em-format/e-mail-formatter-text-enriched.c +++ b/em-format/e-mail-formatter-text-enriched.c @@ -30,31 +30,20 @@ #include <glib/gi18n-lib.h> #include <camel/camel.h> +typedef EMailFormatterExtension EMailFormatterTextEnriched; +typedef EMailFormatterExtensionClass EMailFormatterTextEnrichedClass; + +G_DEFINE_TYPE ( + EMailFormatterTextEnriched, + e_mail_formatter_text_enriched, + E_TYPE_MAIL_FORMATTER_EXTENSION) + static const gchar *formatter_mime_types[] = { "text/enriched", "text/richtext", NULL }; -typedef struct _EMailFormatterTextEnriched { - GObject parent; -} EMailFormatterTextEnriched; - -typedef struct _EMailFormatterTextEnrichedClass { - GObjectClass parent_class; -} EMailFormatterTextEnrichedClass; - -static void e_mail_formatter_formatter_extension_interace_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterTextEnriched, - e_mail_formatter_text_enriched, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interace_init)); - static gboolean emfe_text_enriched_format (EMailFormatterExtension *extension, EMailFormatter *formatter, @@ -121,20 +110,15 @@ emfe_text_enriched_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_text_enriched_class_init (EMailFormatterTextEnrichedClass *class) -{ -} - -static void -e_mail_formatter_formatter_extension_interace_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_text_enriched_class_init (EMailFormatterExtensionClass *class) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_text_enriched_format; - iface->get_display_name = emfe_text_enriched_get_display_name; - iface->get_description = emfe_text_enriched_get_description; + 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; } static void -e_mail_formatter_text_enriched_init (EMailFormatterTextEnriched *formatter) +e_mail_formatter_text_enriched_init (EMailFormatterExtension *extension) { } diff --git a/em-format/e-mail-formatter-text-html.c b/em-format/e-mail-formatter-text-html.c index 08c40127d0..9a1883eb5c 100644 --- a/em-format/e-mail-formatter-text-html.c +++ b/em-format/e-mail-formatter-text-html.c @@ -34,30 +34,19 @@ #include <ctype.h> #include <string.h> +typedef EMailFormatterExtension EMailFormatterTextHTML; +typedef EMailFormatterExtensionClass EMailFormatterTextHTMLClass; + +G_DEFINE_TYPE ( + EMailFormatterTextHTML, + e_mail_formatter_text_html, + E_TYPE_MAIL_FORMATTER_EXTENSION) + static const gchar *formatter_mime_types[] = { "text/html", NULL }; -typedef struct _EMailFormatterTextHTML { - GObject parent; -} EMailFormatterTextHTML; - -typedef struct _EMailFormatterTextHTMLClass { - GObjectClass parent_class; -} EMailFormatterTextHTMLClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterTextHTML, - e_mail_formatter_text_html, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); - static gchar * get_tag (const gchar *utf8_string, const gchar *tag_name, @@ -360,21 +349,15 @@ emfe_text_html_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_text_html_class_init (EMailFormatterTextHTMLClass *class) +e_mail_formatter_text_html_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_text_html_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_text_html_format; - iface->get_display_name = emfe_text_html_get_display_name; - iface->get_description = emfe_text_html_get_description; -} - -static void -e_mail_formatter_text_html_init (EMailFormatterTextHTML *formatter) -{ - } diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c index ce620016a7..8a29a90d2a 100644 --- a/em-format/e-mail-formatter-text-plain.c +++ b/em-format/e-mail-formatter-text-plain.c @@ -31,6 +31,14 @@ #include <glib/gi18n-lib.h> #include <camel/camel.h> +typedef EMailFormatterExtension EMailFormatterTextPlain; +typedef EMailFormatterExtensionClass EMailFormatterTextPlainClass; + +G_DEFINE_TYPE ( + EMailFormatterTextPlain, + e_mail_formatter_text_plain, + E_TYPE_MAIL_FORMATTER_EXTENSION) + static const gchar *formatter_mime_types[] = { "text/plain", "text/*", @@ -39,25 +47,6 @@ static const gchar *formatter_mime_types[] = { NULL }; -typedef struct _EMailFormatterTextPlain { - GObject parent; -} EMailFormatterTextPlain; - -typedef struct _EMailFormatterTextPlainClass { - GObjectClass parent_class; -} EMailFormatterTextPlainClass; - -static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); - -G_DEFINE_TYPE_EXTENDED ( - EMailFormatterTextPlain, - e_mail_formatter_text_plain, - G_TYPE_OBJECT, - 0, - G_IMPLEMENT_INTERFACE ( - E_TYPE_MAIL_FORMATTER_EXTENSION, - e_mail_formatter_formatter_extension_interface_init)); - static gboolean emfe_text_plain_format (EMailFormatterExtension *extension, EMailFormatter *formatter, @@ -195,21 +184,15 @@ emfe_text_plain_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_text_plain_class_init (EMailFormatterTextPlainClass *class) +e_mail_formatter_text_plain_class_init (EMailFormatterExtensionClass *class) { + 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; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_text_plain_init (EMailFormatterExtension *extension) { - iface->mime_types = formatter_mime_types; - iface->format = emfe_text_plain_format; - iface->get_display_name = emfe_text_plain_get_display_name; - iface->get_description = emfe_text_plain_get_description; -} - -static void -e_mail_formatter_text_plain_init (EMailFormatterTextPlain *formatter) -{ - } |