diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-08-24 23:21:41 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-08-25 02:37:02 +0800 |
commit | ecf3434da05b1f39f793c24b38bfd278e10b5786 (patch) | |
tree | 485ed2399920ecb10dbee2b4db4c437c22574a20 /e-util/e-module.c | |
parent | f1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff) | |
download | gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.zst gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.zip |
GObject boilerplate cleanup.
Prefer thread-safe G_DEFINE_TYPE and G_DEFINE_INTERFACE macros over
manual GType registration.
This is just a start... lots more to do.
Diffstat (limited to 'e-util/e-module.c')
-rw-r--r-- | e-util/e-module.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/e-util/e-module.c b/e-util/e-module.c index 17c048e2d3..7b4801df47 100644 --- a/e-util/e-module.c +++ b/e-util/e-module.c @@ -52,7 +52,10 @@ enum { PROP_FILENAME }; -static gpointer parent_class; +G_DEFINE_TYPE ( + EModule, + e_module, + G_TYPE_TYPE_MODULE) static void module_set_filename (EModule *module, @@ -107,7 +110,7 @@ module_finalize (GObject *object) g_free (priv->filename); /* Chain up to parent's finalize() method. */ - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (e_module_parent_class)->finalize (object); } static gboolean @@ -164,12 +167,11 @@ module_unload (GTypeModule *type_module) } static void -module_class_init (EModuleClass *class) +e_module_class_init (EModuleClass *class) { GObjectClass *object_class; GTypeModuleClass *type_module_class; - parent_class = g_type_class_peek_parent (class); g_type_class_add_private (class, sizeof (EModulePrivate)); object_class = G_OBJECT_CLASS (class); @@ -199,37 +201,11 @@ module_class_init (EModuleClass *class) } static void -module_init (EModule *module) +e_module_init (EModule *module) { module->priv = E_MODULE_GET_PRIVATE (module); } -GType -e_module_get_type (void) -{ - static GType type = 0; - - if (G_UNLIKELY (type == 0)) { - const GTypeInfo type_info = { - sizeof (EModuleClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) module_class_init, - (GClassFinalizeFunc) NULL, - NULL, /* class_data */ - sizeof (EModule), - 0, /* n_preallocs */ - (GInstanceInitFunc) module_init, - NULL /* value_table */ - }; - - type = g_type_register_static ( - G_TYPE_TYPE_MODULE, "EModule", &type_info, 0); - } - - return type; -} - /** * e_module_new: * @filename: filename of the shared library module |