From 5eb12906c4242a576ad6fac4d229f096d3aab17a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 10 May 2009 13:18:28 -0400 Subject: Use the proper idiom for loading types in a GTypeModule. Also, combine calendar, memo, and task backends into a single module, similar to how it worked under Bonobo. --- mail/e-mail-shell-content.c | 62 +++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'mail/e-mail-shell-content.c') diff --git a/mail/e-mail-shell-content.c b/mail/e-mail-shell-content.c index 50bf0471bb..de07873dc2 100644 --- a/mail/e-mail-shell-content.c +++ b/mail/e-mail-shell-content.c @@ -78,6 +78,7 @@ enum { }; static gpointer parent_class; +static GType mail_shell_content_type; static void mail_shell_content_etree_unfreeze (MessageList *message_list, @@ -677,37 +678,38 @@ mail_shell_content_init (EMailShellContent *mail_shell_content) GType e_mail_shell_content_get_type (void) { - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - static const GTypeInfo type_info = { - sizeof (EMailShellContentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_shell_content_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailShellContent), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_shell_content_init, - NULL /* value_table */ - }; - - static const GInterfaceInfo iface_info = { - (GInterfaceInitFunc) mail_shell_content_iface_init, - (GInterfaceFinalizeFunc) NULL, - NULL /* interface_data */ - }; - - type = g_type_register_static ( - E_TYPE_SHELL_CONTENT, "EMailShellContent", - &type_info, 0); - - g_type_add_interface_static ( - type, E_TYPE_MAIL_READER, &iface_info); - } + return mail_shell_content_type; +} - return type; +void +e_mail_shell_content_register_type (GTypeModule *type_module) +{ + static const GTypeInfo type_info = { + sizeof (EMailShellContentClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_shell_content_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailShellContent), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_shell_content_init, + NULL /* value_table */ + }; + + static const GInterfaceInfo iface_info = { + (GInterfaceInitFunc) mail_shell_content_iface_init, + (GInterfaceFinalizeFunc) NULL, + NULL /* interface_data */ + }; + + mail_shell_content_type = g_type_module_register_type ( + type_module, E_TYPE_SHELL_CONTENT, + "EMailShellContent", &type_info, 0); + + g_type_module_add_interface ( + type_module, mail_shell_content_type, + E_TYPE_MAIL_READER, &iface_info); } GtkWidget * -- cgit v1.2.3