aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-12-08 01:32:32 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-12-08 03:01:05 +0800
commitcab6eac8f14974ea1c2fedaf9143e98cf630c489 (patch)
tree38cd8e6e510b6c461f7537c64aea88a11c385f4f /modules
parent3ae26f0ab68776e230a2be58939e5bf69c8fa2d5 (diff)
downloadgsoc2013-evolution-cab6eac8f14974ea1c2fedaf9143e98cf630c489.tar.gz
gsoc2013-evolution-cab6eac8f14974ea1c2fedaf9143e98cf630c489.tar.zst
gsoc2013-evolution-cab6eac8f14974ea1c2fedaf9143e98cf630c489.zip
Convert EMailParserExtension to an abstract class.
With the previous changes, all parser extensions derive from GObjectClass and implement the EMailParserExtensionInterface. Simplify things further by making EMailParserExtension an abstract base class so parser extensions are now just direct subclasses and need not bother with implementing GObject interfaces.
Diffstat (limited to 'modules')
-rw-r--r--modules/audio-inline/e-mail-parser-audio-inline.c30
-rw-r--r--modules/itip-formatter/e-mail-parser-itip.c31
-rw-r--r--modules/prefer-plain/e-mail-parser-prefer-plain.c25
-rw-r--r--modules/text-highlight/e-mail-parser-text-highlight.c28
-rw-r--r--modules/tnef-attachment/e-mail-parser-tnef-attachment.c27
-rw-r--r--modules/vcard-inline/e-mail-parser-vcard-inline.c31
6 files changed, 58 insertions, 114 deletions
diff --git a/modules/audio-inline/e-mail-parser-audio-inline.c b/modules/audio-inline/e-mail-parser-audio-inline.c
index 7fc025efec..519f6ce428 100644
--- a/modules/audio-inline/e-mail-parser-audio-inline.c
+++ b/modules/audio-inline/e-mail-parser-audio-inline.c
@@ -38,24 +38,19 @@
#define d(x)
-typedef GObject EMailParserAudioInline;
-typedef GObjectClass EMailParserAudioInlineClass;
+typedef EMailParserExtension EMailParserAudioInline;
+typedef EMailParserExtensionClass EMailParserAudioInlineClass;
typedef EExtension EMailParserAudioInlineLoader;
typedef EExtensionClass EMailParserAudioInlineLoaderClass;
GType e_mail_parser_audio_inline_get_type (void);
GType e_mail_parser_audio_inline_loader_get_type (void);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserAudioInline,
e_mail_parser_audio_inline,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
G_DEFINE_DYNAMIC_TYPE (
EMailParserAudioInlineLoader,
@@ -157,26 +152,21 @@ empe_audio_inline_get_flags (EMailParserExtension *extension)
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
-{
- iface->mime_types = parser_mime_types;
- iface->parse = empe_audio_inline_parse;
- iface->get_flags = empe_audio_inline_get_flags;
-}
-
-static void
-e_mail_parser_audio_inline_class_init (EMailParserAudioInlineClass *class)
+e_mail_parser_audio_inline_class_init (EMailParserExtensionClass *class)
{
+ class->mime_types = parser_mime_types;
+ class->parse = empe_audio_inline_parse;
+ class->get_flags = empe_audio_inline_get_flags;
}
static void
-e_mail_parser_audio_inline_class_finalize (EMailParserAudioInlineClass *class)
+e_mail_parser_audio_inline_class_finalize (EMailParserExtensionClass *class)
{
}
static void
-e_mail_parser_audio_inline_init (EMailParserAudioInline *self)
+e_mail_parser_audio_inline_init (EMailParserExtension *extension)
{
}
diff --git a/modules/itip-formatter/e-mail-parser-itip.c b/modules/itip-formatter/e-mail-parser-itip.c
index 2894b525e6..a63fc2fc56 100644
--- a/modules/itip-formatter/e-mail-parser-itip.c
+++ b/modules/itip-formatter/e-mail-parser-itip.c
@@ -44,24 +44,19 @@
#define d(x)
-typedef GObject EMailParserItip;
-typedef GObjectClass EMailParserItipClass;
+typedef EMailParserExtension EMailParserItip;
+typedef EMailParserExtensionClass EMailParserItipClass;
typedef EExtension EMailParserItipLoader;
typedef EExtensionClass EMailParserItipLoaderClass;
GType e_mail_parser_itip_get_type (void);
GType e_mail_parser_itip_loader_get_type (void);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserItip,
e_mail_parser_itip,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
G_DEFINE_DYNAMIC_TYPE (
EMailParserItipLoader,
@@ -260,26 +255,20 @@ empe_itip_get_flags (EMailParserExtension *extension)
}
static void
-e_mail_parser_itip_class_init (EMailParserItipClass *class)
-{
-}
-
-static void
-e_mail_parser_itip_class_finalize (EMailParserItipClass *class)
+e_mail_parser_itip_class_init (EMailParserExtensionClass *class)
{
-
+ class->mime_types = parser_mime_types;
+ class->parse = empe_itip_parse;
+ class->get_flags = empe_itip_get_flags;
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
+e_mail_parser_itip_class_finalize (EMailParserExtensionClass *class)
{
- iface->mime_types = parser_mime_types;
- iface->parse = empe_itip_parse;
- iface->get_flags = empe_itip_get_flags;
}
static void
-e_mail_parser_itip_init (EMailParserItip *self)
+e_mail_parser_itip_init (EMailParserExtension *class)
{
}
diff --git a/modules/prefer-plain/e-mail-parser-prefer-plain.c b/modules/prefer-plain/e-mail-parser-prefer-plain.c
index eea1d280b5..d434c20bc8 100644
--- a/modules/prefer-plain/e-mail-parser-prefer-plain.c
+++ b/modules/prefer-plain/e-mail-parser-prefer-plain.c
@@ -39,7 +39,7 @@ typedef EExtension EMailParserPreferPlainLoader;
typedef EExtensionClass EMailParserPreferPlainLoaderClass;
struct _EMailParserPreferPlain {
- GObject parent;
+ EMailParserExtension parent;
GSettings *settings;
gint mode;
@@ -47,12 +47,11 @@ struct _EMailParserPreferPlain {
};
struct _EMailParserPreferPlainClass {
- GObjectClass parent_class;
+ EMailParserExtensionClass parent_class;
};
GType e_mail_parser_prefer_plain_get_type (void);
GType e_mail_parser_prefer_plain_loader_get_type (void);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
enum {
PREFER_HTML,
@@ -60,14 +59,10 @@ enum {
ONLY_PLAIN
};
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserPreferPlain,
e_mail_parser_prefer_plain,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
G_DEFINE_DYNAMIC_TYPE (
EMailParserPreferPlainLoader,
@@ -332,13 +327,6 @@ empe_prefer_plain_parse (EMailParserExtension *extension,
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
-{
- iface->mime_types = parser_mime_types;
- iface->parse = empe_prefer_plain_parse;
-}
-
-static void
e_mail_parser_prefer_plain_get_property (GObject *object,
guint property_id,
GValue *value,
@@ -400,12 +388,17 @@ static void
e_mail_parser_prefer_plain_class_init (EMailParserPreferPlainClass *class)
{
GObjectClass *object_class;
+ EMailParserExtensionClass *extension_class;
object_class = G_OBJECT_CLASS (class);
object_class->get_property = e_mail_parser_prefer_plain_get_property;
object_class->set_property = e_mail_parser_prefer_plain_set_property;
object_class->dispose = e_mail_parser_prefer_plain_dispose;
+ extension_class = E_MAIL_PARSER_EXTENSION_CLASS (class);
+ extension_class->mime_types = parser_mime_types;
+ extension_class->parse = empe_prefer_plain_parse;
+
g_object_class_install_property (
object_class,
PROP_MODE,
diff --git a/modules/text-highlight/e-mail-parser-text-highlight.c b/modules/text-highlight/e-mail-parser-text-highlight.c
index cf8ff5f11a..99d920fe0b 100644
--- a/modules/text-highlight/e-mail-parser-text-highlight.c
+++ b/modules/text-highlight/e-mail-parser-text-highlight.c
@@ -34,24 +34,19 @@
#define d(x)
-typedef GObject EMailParserTextHighlight;
-typedef GObjectClass EMailParserTextHighlightClass;
+typedef EMailParserExtension EMailParserTextHighlight;
+typedef EMailParserExtensionClass EMailParserTextHighlightClass;
typedef EExtension EMailParserTextHighlightLoader;
typedef EExtensionClass EMailParserTextHighlightLoaderClass;
GType e_mail_parser_text_highlight_get_type (void);
GType e_mail_parser_text_highlight_loader_get_type (void);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserTextHighlight,
e_mail_parser_text_highlight,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
G_DEFINE_DYNAMIC_TYPE (
EMailParserTextHighlightLoader,
@@ -99,24 +94,19 @@ empe_text_highlight_parse (EMailParserExtension *extension,
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
-{
- iface->mime_types = get_mime_types ();
- iface->parse = empe_text_highlight_parse;
-}
-
-static void
-e_mail_parser_text_highlight_class_init (EMailParserTextHighlightClass *class)
+e_mail_parser_text_highlight_class_init (EMailParserExtensionClass *class)
{
+ class->mime_types = get_mime_types ();
+ class->parse = empe_text_highlight_parse;
}
void
-e_mail_parser_text_highlight_class_finalize (EMailParserTextHighlightClass *class)
+e_mail_parser_text_highlight_class_finalize (EMailParserExtensionClass *class)
{
}
static void
-e_mail_parser_text_highlight_init (EMailParserTextHighlight *parser)
+e_mail_parser_text_highlight_init (EMailParserExtension *extension)
{
}
diff --git a/modules/tnef-attachment/e-mail-parser-tnef-attachment.c b/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
index 27d8c7019b..f2619ae1cc 100644
--- a/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
+++ b/modules/tnef-attachment/e-mail-parser-tnef-attachment.c
@@ -50,7 +50,7 @@
#define d(x)
typedef struct _EMailParserTnefAttachment {
- GObject parent;
+ EMailParserExtension parent;
GSettings *settings;
gint mode;
@@ -58,7 +58,7 @@ typedef struct _EMailParserTnefAttachment {
} EMailParserTnefAttachment;
typedef struct _EMailParserTnefAttachmentClass {
- GObjectClass parent_class;
+ EMailParserExtensionClass parent_class;
} EMailParserTnefAttachmentClass;
typedef EExtension EMailParserTnefAttachmentLoader;
@@ -66,16 +66,11 @@ typedef EExtensionClass EMailParserTnefAttachmentLoaderClass;
GType e_mail_parser_tnef_attachment_get_type (void);
GType e_mail_parser_tnef_attachment_loader_get_type (void);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserTnefAttachment,
e_mail_parser_tnef_attachment,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
G_DEFINE_DYNAMIC_TYPE (
EMailParserTnefAttachmentLoader,
@@ -267,15 +262,13 @@ empe_tnef_attachment_parse (EMailParserExtension *extension,
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
-{
- iface->mime_types = parser_mime_types;
- iface->parse = empe_tnef_attachment_parse;
-}
-
-static void
e_mail_parser_tnef_attachment_class_init (EMailParserTnefAttachmentClass *class)
{
+ EMailParserExtensionClass *extension_class;
+
+ extension_class = E_MAIL_PARSER_EXTENSION_CLASS (class);
+ extension_class->mime_types = parser_mime_types;
+ extension_class->parse = empe_tnef_attachment_parse;
}
void
@@ -284,7 +277,7 @@ e_mail_parser_tnef_attachment_class_finalize (EMailParserTnefAttachmentClass *cl
}
static void
-e_mail_parser_tnef_attachment_init (EMailParserTnefAttachment *parser)
+e_mail_parser_tnef_attachment_init (EMailParserTnefAttachment *extension)
{
}
diff --git a/modules/vcard-inline/e-mail-parser-vcard-inline.c b/modules/vcard-inline/e-mail-parser-vcard-inline.c
index c3998c79f8..1328e5031a 100644
--- a/modules/vcard-inline/e-mail-parser-vcard-inline.c
+++ b/modules/vcard-inline/e-mail-parser-vcard-inline.c
@@ -48,24 +48,19 @@
#define d(x)
-typedef GObject EMailParserVCardInline;
-typedef GObjectClass EMailParserVCardInlineClass;
+typedef EMailParserExtension EMailParserVCardInline;
+typedef EMailParserExtensionClass EMailParserVCardInlineClass;
typedef EExtension EMailParserVCardInlineLoader;
typedef EExtensionClass EMailParserVCardInlineLoaderClass;
GType e_mail_parser_vcard_inline_get_type (void);
GType e_mail_parser_vcard_inline_loader_get_type (void);
-static void e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface);
-G_DEFINE_DYNAMIC_TYPE_EXTENDED (
+G_DEFINE_DYNAMIC_TYPE (
EMailParserVCardInline,
e_mail_parser_vcard_inline,
- G_TYPE_OBJECT,
- 0,
- G_IMPLEMENT_INTERFACE_DYNAMIC (
- E_TYPE_MAIL_PARSER_EXTENSION,
- e_mail_parser_parser_extension_interface_init));
+ E_TYPE_MAIL_PARSER_EXTENSION)
G_DEFINE_DYNAMIC_TYPE (
EMailParserVCardInlineLoader,
@@ -381,26 +376,20 @@ empe_vcard_inline_get_flags (EMailParserExtension *extension)
}
static void
-e_mail_parser_parser_extension_interface_init (EMailParserExtensionInterface *iface)
-{
- iface->mime_types = parser_mime_types;
- iface->parse = empe_vcard_inline_parse;
- iface->get_flags = empe_vcard_inline_get_flags;
-}
-
-static void
-e_mail_parser_vcard_inline_class_init (EMailParserVCardInlineClass *class)
+e_mail_parser_vcard_inline_class_init (EMailParserExtensionClass *class)
{
+ class->mime_types = parser_mime_types;
+ class->parse = empe_vcard_inline_parse;
+ class->get_flags = empe_vcard_inline_get_flags;
}
static void
-e_mail_parser_vcard_inline_class_finalize (EMailParserVCardInlineClass *class)
+e_mail_parser_vcard_inline_class_finalize (EMailParserExtensionClass *class)
{
-
}
static void
-e_mail_parser_vcard_inline_init (EMailParserVCardInline *self)
+e_mail_parser_vcard_inline_init (EMailParserExtension *extension)
{
}