diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-12-07 05:40:13 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-12-08 03:01:05 +0800 |
commit | 54455ca1ad6cae527544fed12d0de4ae95341082 (patch) | |
tree | b223d428459e3be79d1162d8217be6c2856f643b /modules/itip-formatter/e-mail-formatter-itip.c | |
parent | 9d34f72ec1b99d58ee1c3a6d1a964a6dde166f79 (diff) | |
download | gsoc2013-evolution-54455ca1ad6cae527544fed12d0de4ae95341082.tar.gz gsoc2013-evolution-54455ca1ad6cae527544fed12d0de4ae95341082.tar.zst gsoc2013-evolution-54455ca1ad6cae527544fed12d0de4ae95341082.zip |
Remove EMailExtension.
EMailExtension is now too trivial to keep as a standalone interface.
Add a 'mime_types' string array to the EMailFormatterExtension and
EMailFormatterParser interface structs.
Alter e_mail_extension_registry_add_extension() to take a 'mime_types'
string array and the GType of an extension to instantiate, rather than
the extension instance directly.
e_mail_extension_registry_remove_extension() is no longer needed.
Diffstat (limited to 'modules/itip-formatter/e-mail-formatter-itip.c')
-rw-r--r-- | modules/itip-formatter/e-mail-formatter-itip.c | 84 |
1 files changed, 40 insertions, 44 deletions
diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c index 9e2afc4459..2aab01288b 100644 --- a/modules/itip-formatter/e-mail-formatter-itip.c +++ b/modules/itip-formatter/e-mail-formatter-itip.c @@ -34,30 +34,30 @@ #define d(x) -typedef struct _EMailFormatterItip { - EExtension parent; -} EMailFormatterItip; +typedef GObject EMailFormatterItip; +typedef GObjectClass EMailFormatterItipClass; -typedef struct _EMailFormatterItipClass { - EExtensionClass parent_class; -} EMailFormatterItipClass; +typedef EExtension EMailFormatterItipLoader; +typedef EExtensionClass EMailFormatterItipLoaderClass; GType e_mail_formatter_itip_get_type (void); +GType e_mail_formatter_itip_loader_get_type (void); static void e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface); -static void e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface); G_DEFINE_DYNAMIC_TYPE_EXTENDED ( EMailFormatterItip, e_mail_formatter_itip, - E_TYPE_EXTENSION, + G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE_DYNAMIC ( - E_TYPE_MAIL_EXTENSION, - e_mail_formatter_mail_extension_interface_init) - G_IMPLEMENT_INTERFACE_DYNAMIC ( E_TYPE_MAIL_FORMATTER_EXTENSION, e_mail_formatter_formatter_extension_interface_init)); +G_DEFINE_DYNAMIC_TYPE ( + EMailFormatterItipLoader, + e_mail_formatter_itip_loader, + E_TYPE_EXTENSION) + static const gchar *formatter_mime_types[] = { "text/calendar", "application/ics", @@ -154,59 +154,60 @@ emfe_itip_get_description (EMailFormatterExtension *extension) } static void -e_mail_formatter_itip_constructed (GObject *object) +e_mail_formatter_itip_class_init (EMailFormatterItipClass *class) { - EExtensible *extensible; - EMailExtensionRegistry *reg; +} - extensible = e_extension_get_extensible (E_EXTENSION (object)); - reg = E_MAIL_EXTENSION_REGISTRY (extensible); +static void +e_mail_formatter_itip_class_finalize (EMailFormatterItipClass *class) +{ +} - e_mail_extension_registry_add_extension (reg, E_MAIL_EXTENSION (object)); +static void +e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +{ + iface->mime_types = formatter_mime_types; + iface->format = emfe_itip_format; + iface->get_display_name = emfe_itip_get_display_name; + iface->get_description = emfe_itip_get_description; } static void -e_mail_formatter_itip_finalize (GObject *object) +e_mail_formatter_itip_init (EMailFormatterItip *formatter) +{ +} + +static void +mail_formatter_itip_loader_constructed (GObject *object) { EExtensible *extensible; - EMailExtensionRegistry *reg; extensible = e_extension_get_extensible (E_EXTENSION (object)); - reg = E_MAIL_EXTENSION_REGISTRY (extensible); - e_mail_extension_registry_remove_extension (reg, E_MAIL_EXTENSION (object)); + e_mail_extension_registry_add_extension ( + E_MAIL_EXTENSION_REGISTRY (extensible), + formatter_mime_types, + e_mail_formatter_itip_get_type ()); } static void -e_mail_formatter_itip_class_init (EMailFormatterItipClass *class) +e_mail_formatter_itip_loader_class_init (EExtensionClass *class) { GObjectClass *object_class; - EExtensionClass *extension_class; object_class = G_OBJECT_CLASS (class); - object_class->constructed = e_mail_formatter_itip_constructed; - object_class->finalize = e_mail_formatter_itip_finalize; + object_class->constructed = mail_formatter_itip_loader_constructed; - extension_class = E_EXTENSION_CLASS (class); - extension_class->extensible_type = E_TYPE_MAIL_FORMATTER_EXTENSION_REGISTRY; + class->extensible_type = E_TYPE_MAIL_FORMATTER_EXTENSION_REGISTRY; } static void -e_mail_formatter_formatter_extension_interface_init (EMailFormatterExtensionInterface *iface) +e_mail_formatter_itip_loader_class_finalize (EExtensionClass *class) { - iface->format = emfe_itip_format; - iface->get_display_name = emfe_itip_get_display_name; - iface->get_description = emfe_itip_get_description; } static void -e_mail_formatter_mail_extension_interface_init (EMailExtensionInterface *iface) -{ - iface->mime_types = formatter_mime_types; -} - -static void -e_mail_formatter_itip_init (EMailFormatterItip *formatter) +e_mail_formatter_itip_loader_init (EExtension *extension) { } @@ -214,10 +215,5 @@ void e_mail_formatter_itip_type_register (GTypeModule *type_module) { e_mail_formatter_itip_register_type (type_module); -} - -static void -e_mail_formatter_itip_class_finalize (EMailFormatterItipClass *class) -{ - + e_mail_formatter_itip_loader_register_type (type_module); } |