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-backend.c | 56 +++++++++++++++++---------------------------- 1 file changed, 21 insertions(+), 35 deletions(-) (limited to 'mail/e-mail-shell-backend.c') diff --git a/mail/e-mail-shell-backend.c b/mail/e-mail-shell-backend.c index 0d0521ebc0..8b5f6542c7 100644 --- a/mail/e-mail-shell-backend.c +++ b/mail/e-mail-shell-backend.c @@ -38,6 +38,7 @@ #include "e-mail-shell-migrate.h" #include "e-mail-shell-settings.h" +#include "e-mail-shell-sidebar.h" #include "e-mail-shell-view.h" #include "e-attachment-handler-mail.h" @@ -104,12 +105,8 @@ struct _EMailShellBackendPrivate { guint mail_sync_timeout_source_id; }; -/* Module Entry Points */ -void e_module_load (GTypeModule *type_module); -void e_module_unload (GTypeModule *type_module); - -GType e_mail_shell_backend_type = 0; static gpointer parent_class; +static GType mail_shell_backend_type; /* The array elements correspond to EMailFolderType. */ static struct { @@ -1031,41 +1028,30 @@ mail_shell_backend_init (EMailShellBackend *mail_shell_backend) } GType -e_mail_shell_backend_get_type (GTypeModule *type_module) -{ - if (e_mail_shell_backend_type == 0) { - const GTypeInfo type_info = { - sizeof (EMailShellBackendClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) mail_shell_backend_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EMailShellBackend), - 0, /* n_preallocs */ - (GInstanceInitFunc) mail_shell_backend_init, - NULL /* value_table */ - }; - - e_mail_shell_backend_type = - g_type_module_register_type ( - type_module, E_TYPE_SHELL_BACKEND, - "EMailShellBackend", &type_info, 0); - } - - return e_mail_shell_backend_type; -} - -void -e_module_load (GTypeModule *type_module) +e_mail_shell_backend_get_type (void) { - e_mail_shell_backend_get_type (type_module); - e_mail_shell_view_get_type (type_module); + return mail_shell_backend_type; } void -e_module_unload (GTypeModule *type_module) +e_mail_shell_backend_register_type (GTypeModule *type_module) { + const GTypeInfo type_info = { + sizeof (EMailShellBackendClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) mail_shell_backend_class_init, + (GClassFinalizeFunc) NULL, + NULL, /* class_data */ + sizeof (EMailShellBackend), + 0, /* n_preallocs */ + (GInstanceInitFunc) mail_shell_backend_init, + NULL /* value_table */ + }; + + mail_shell_backend_type = g_type_module_register_type ( + type_module, E_TYPE_SHELL_BACKEND, + "EMailShellBackend", &type_info, 0); } /******************************** Public API *********************************/ -- cgit v1.2.3