diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2012-10-09 22:01:05 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-10-10 03:29:39 +0800 |
commit | bdbd225c389a38b8cfebfe703ed5b3d9bca6c523 (patch) | |
tree | 149d982256dde4fd0add19d4fff10fb0d0f01c46 /modules/mail | |
parent | d0734298d21c5a59ed408910b552d7c4ffa79577 (diff) | |
download | gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.tar gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.tar.gz gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.tar.bz2 gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.tar.lz gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.tar.xz gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.tar.zst gsoc2013-evolution-bdbd225c389a38b8cfebfe703ed5b3d9bca6c523.zip |
EMailConfigFormatHTML: Use G_DEFINE_DYNAMIC_TYPE.
Follow the usual GObject conventions.
(cherry picked from commit c3eacfd37e5275942635c069e6f20eb0dd22f6be)
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-config-format-html.c | 61 | ||||
-rw-r--r-- | modules/mail/e-mail-config-format-html.h | 40 | ||||
-rw-r--r-- | modules/mail/evolution-module-mail.c | 2 |
3 files changed, 76 insertions, 27 deletions
diff --git a/modules/mail/e-mail-config-format-html.c b/modules/mail/e-mail-config-format-html.c index e146739f67..40edc7df9e 100644 --- a/modules/mail/e-mail-config-format-html.c +++ b/modules/mail/e-mail-config-format-html.c @@ -22,14 +22,23 @@ #include "e-mail-config-format-html.h" -#include <libebackend/libebackend.h> - #include <shell/e-shell.h> #include <e-util/e-util.h> #include <em-format/e-mail-formatter.h> #include <mail/e-mail-reader-utils.h> -static gpointer parent_class; +#define E_MAIL_CONFIG_FORMAT_HTML_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_MAIL_CONFIG_FORMAT_HTML, EMailConfigFormatHTMLPrivate)) + +struct _EMailConfigFormatHTMLPrivate { + gint placeholder; +}; + +G_DEFINE_DYNAMIC_TYPE ( + EMailConfigFormatHTML, + e_mail_config_format_html, + E_TYPE_EXTENSION) static void headers_changed_cb (GSettings *settings, @@ -134,39 +143,43 @@ mail_config_format_html_constructed (GObject *object) headers_changed_cb (settings, NULL, object); /* Chain up to parent's constructed() method. */ - G_OBJECT_CLASS (parent_class)->constructed (object); + G_OBJECT_CLASS (e_mail_config_format_html_parent_class)-> + constructed (object); } static void -mail_config_format_html_class_init (EExtensionClass *class) +e_mail_config_format_html_class_init (EMailConfigFormatHTMLClass *class) { GObjectClass *object_class; + EExtensionClass *extension_class; - parent_class = g_type_class_peek_parent (class); + g_type_class_add_private ( + class, sizeof (EMailConfigFormatHTMLPrivate)); object_class = G_OBJECT_CLASS (class); object_class->constructed = mail_config_format_html_constructed; - class->extensible_type = E_TYPE_MAIL_FORMATTER; + extension_class = E_EXTENSION_CLASS (class); + extension_class->extensible_type = E_TYPE_MAIL_FORMATTER; +} + +static void +e_mail_config_format_html_class_finalize (EMailConfigFormatHTMLClass *class) +{ +} + +static void +e_mail_config_format_html_init (EMailConfigFormatHTML *extension) +{ + extension->priv = E_MAIL_CONFIG_FORMAT_HTML_GET_PRIVATE (extension); } void -e_mail_config_format_html_register_type (GTypeModule *type_module) +e_mail_config_format_html_type_register (GTypeModule *type_module) { - static const GTypeInfo type_info = { - sizeof (EExtensionClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_config_format_html_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, - "EMailConfigFormatHTML", &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_format_html_register_type (type_module); } + diff --git a/modules/mail/e-mail-config-format-html.h b/modules/mail/e-mail-config-format-html.h index bed76d88b7..09482108db 100644 --- a/modules/mail/e-mail-config-format-html.h +++ b/modules/mail/e-mail-config-format-html.h @@ -19,12 +19,48 @@ #ifndef E_MAIL_CONFIG_FORMAT_HTML_H #define E_MAIL_CONFIG_FORMAT_HTML_H -#include <glib-object.h> +#include <libebackend/libebackend.h> + +/* Standard GObject macros */ +#define E_TYPE_MAIL_CONFIG_FORMAT_HTML \ + (e_mail_config_format_html_get_type ()) +#define E_MAIL_CONFIG_FORMAT_HTML(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), E_TYPE_MAIL_CONFIG_FORMAT_HTML, EMailConfigFormatHTML)) +#define E_MAIL_CONFIG_FORMAT_HTML_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), E_TYPE_MAIL_CONFIG_FORMAT_HTML, EMailConfigFormatHTMLClass)) +#define E_IS_MAIL_CONFIG_FORMAT_HTML(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), E_TYPE_MAIL_CONFIG_FORMAT_HTML)) +#define E_IS_MAIL_CONFIG_FORMAT_HTML_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), E_TYPE_MAIL_CONFIG_FORMAT_HTML)) +#define E_MAIL_CONFIG_FORMAT_HTML_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), E_TYPE_MAIL_CONFIG_FORMAT_HTML, EMailConfigFormatHTMLClass)) G_BEGIN_DECLS -void e_mail_config_format_html_register_type (GTypeModule *type_module); +typedef struct _EMailConfigFormatHTML EMailConfigFormatHTML; +typedef struct _EMailConfigFormatHTMLClass EMailConfigFormatHTMLClass; +typedef struct _EMailConfigFormatHTMLPrivate EMailConfigFormatHTMLPrivate; + +struct _EMailConfigFormatHTML { + EExtension parent; + EMailConfigFormatHTMLPrivate *priv; +}; + +struct _EMailConfigFormatHTMLClass { + EExtensionClass parent_class; +}; + +GType e_mail_config_format_html_get_type + (void) G_GNUC_CONST; +void e_mail_config_format_html_type_register + (GTypeModule *type_module); G_END_DECLS #endif /* E_MAIL_CONFIG_FORMAT_HTML_H */ + diff --git a/modules/mail/evolution-module-mail.c b/modules/mail/evolution-module-mail.c index edb22c4f29..35789b1a87 100644 --- a/modules/mail/evolution-module-mail.c +++ b/modules/mail/evolution-module-mail.c @@ -59,7 +59,7 @@ e_module_load (GTypeModule *type_module) e_mail_shell_sidebar_type_register (type_module); e_mail_shell_view_register_type (type_module); - e_mail_config_format_html_register_type (type_module); + e_mail_config_format_html_type_register (type_module); e_mail_config_reader_register_type (type_module); e_mail_config_web_view_register_type (type_module); |