diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-09 23:13:38 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-09 23:13:38 +0800 |
commit | 5acc8469ce861b90aad0f2d84061d2b6cc205f80 (patch) | |
tree | 3c972dd4cf8a2e3c45a11da4b480ca169461eee4 /modules | |
parent | c3eacfd37e5275942635c069e6f20eb0dd22f6be (diff) | |
download | gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.tar gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.tar.gz gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.tar.bz2 gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.tar.lz gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.tar.xz gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.tar.zst gsoc2013-evolution-5acc8469ce861b90aad0f2d84061d2b6cc205f80.zip |
EMailConfigReader: Use G_DEFINE_DYNAMIC_TYPE.
Follow the usual GObject conventions.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mail/e-mail-config-reader.c | 60 | ||||
-rw-r--r-- | modules/mail/e-mail-config-reader.h | 39 | ||||
-rw-r--r-- | modules/mail/evolution-module-mail.c | 2 |
3 files changed, 74 insertions, 27 deletions
diff --git a/modules/mail/e-mail-config-reader.c b/modules/mail/e-mail-config-reader.c index f732c7377a..aacfbd956b 100644 --- a/modules/mail/e-mail-config-reader.c +++ b/modules/mail/e-mail-config-reader.c @@ -22,12 +22,21 @@ #include "e-mail-config-reader.h" -#include <libebackend/libebackend.h> - #include <shell/e-shell.h> #include <mail/e-mail-reader.h> -static gpointer parent_class; +#define E_MAIL_CONFIG_READER_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_CONFIG_READER, EMailConfigReaderPrivate)) + +struct _EMailConfigReaderPrivate { + gint placeholder; +}; + +G_DEFINE_DYNAMIC_TYPE ( + EMailConfigReader, + e_mail_config_reader, + E_TYPE_EXTENSION) static gboolean mail_config_reader_idle_cb (EExtension *extension) @@ -83,39 +92,42 @@ mail_config_reader_constructed (GObject *object) (GDestroyNotify) g_object_unref); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_mail_config_reader_parent_class)-> + constructed (object); } static void -mail_config_reader_class_init (EExtensionClass *class) +e_mail_config_reader_class_init (EMailConfigReaderClass *class) { GObjectClass *object_class; + EExtensionClass *extension_class; - parent_class = g_type_class_peek_parent (class); + g_type_class_add_private (class, sizeof (EMailConfigReaderPrivate)); object_class = G_OBJECT_CLASS (class); object_class->constructed = mail_config_reader_constructed; - class->extensible_type = E_TYPE_MAIL_READER; + extension_class = E_EXTENSION_CLASS (class); + extension_class->extensible_type = E_TYPE_MAIL_READER; +} + +static void +e_mail_config_reader_class_finalize (EMailConfigReaderClass *class) +{ +} + +static void +e_mail_config_reader_init (EMailConfigReader *extension) +{ + extension->priv = E_MAIL_CONFIG_READER_GET_PRIVATE (extension); } void -e_mail_config_reader_register_type (GTypeModule *type_module) +e_mail_config_reader_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EExtensionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_config_reader_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EExtension), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - NULL /* value_table */ - }; - - g_type_module_register_type ( - type_module, E_TYPE_EXTENSION, - "EMailConfigReader", &type_info, 0); + /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration + * function, so we have to wrap it with a public function in + * order to register types from a separate compilation unit. */ + e_mail_config_reader_register_type (type_module); } + diff --git a/modules/mail/e-mail-config-reader.h b/modules/mail/e-mail-config-reader.h index 6dd856c97c..b808320ced 100644 --- a/modules/mail/e-mail-config-reader.h +++ b/modules/mail/e-mail-config-reader.h @@ -19,12 +19,47 @@ #ifndef E_MAIL_CONFIG_READER_H #define E_MAIL_CONFIG_READER_H -#include <glib-object.h> +#include <libebackend/libebackend.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_CONFIG_READER \ + (e_mail_config_reader_get_type ()) +#define E_MAIL_CONFIG_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_CONFIG_READER, EMailConfigReader)) +#define E_MAIL_CONFIG_READER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_CONFIG_READER, EMailConfigReaderClass)) +#define E_IS_MAIL_CONFIG_READER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_CONFIG_READER)) +#define E_IS_MAIL_CONFIG_READER_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_CONFIG_READER)) +#define E_MAIL_CONFIG_READER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_CONFIG_READER, EMailConfigReaderClass)) G_BEGIN_DECLS -void e_mail_config_reader_register_type (GTypeModule *type_module); +typedef struct _EMailConfigReader EMailConfigReader; +typedef struct _EMailConfigReaderClass EMailConfigReaderClass; +typedef struct _EMailConfigReaderPrivate EMailConfigReaderPrivate; + +struct _EMailConfigReader { + EExtension parent; + EMailConfigReaderPrivate *priv; +}; + +struct _EMailConfigReaderClass { + EExtensionClass parent_class; +}; + +GType e_mail_config_reader_get_type (void) G_GNUC_CONST; +void e_mail_config_reader_type_register + (GTypeModule *type_module); G_END_DECLS #endif /* E_MAIL_CONFIG_READER_H */ + diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c index 35789b1a87..daeece98f0 100644 --- a/modules/mail/evolution-module-mail.c +++ b/modules/mail/evolution-module-mail.c @@ -60,7 +60,7 @@ e_module_load (GTypeModule *type_module) e_mail_shell_view_register_type (type_module); e_mail_config_format_html_type_register (type_module); - e_mail_config_reader_register_type (type_module); + e_mail_config_reader_type_register (type_module); e_mail_config_web_view_register_type (type_module); em_account_prefs_type_register (type_module); |