aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-import.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-24 23:21:41 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-25 02:37:02 +0800
commitecf3434da05b1f39f793c24b38bfd278e10b5786 (patch)
tree485ed2399920ecb10dbee2b4db4c437c22574a20 /e-util/e-import.c
parentf1d2541c487fbf7433a1b9aad8e8982ef08b85f5 (diff)
downloadgsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar
gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.gz
gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.bz2
gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.lz
gsoc2013-evolution-ecf3434da05b1f39f793c24b38bfd278e10b5786.tar.xz
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-import.c')
-rw-r--r--e-util/e-import.c80
1 files changed, 17 insertions, 63 deletions
diff --git a/e-util/e-import.c b/e-util/e-import.c
index 14485633c1..700d4b885c 100644
--- a/e-util/e-import.c
+++ b/e-util/e-import.c
@@ -43,7 +43,10 @@ struct _EImportImporters {
gpointer data;
};
-static gpointer parent_class;
+G_DEFINE_TYPE (
+ EImport,
+ e_import,
+ G_TYPE_OBJECT)
static void
import_finalize (GObject *object)
@@ -53,7 +56,7 @@ import_finalize (GObject *object)
g_free (import->id);
/* Chain up to parent's finalize () method. */
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (e_import_parent_class)->finalize (object);
}
static void
@@ -77,50 +80,19 @@ import_target_free (EImport *import,
}
static void
-import_class_init (EImportClass *class)
+e_import_class_init (EImportClass *class)
{
GObjectClass *object_class;
- parent_class = g_type_class_peek_parent (class);
-
object_class = G_OBJECT_CLASS (class);
object_class->finalize = import_finalize;
class->target_free = import_target_free;
}
-/**
- * e_import_get_type:
- *
- * Standard GObject method. Used to subclass for the concrete
- * implementations.
- *
- * Return value: EImport type.
- **/
-GType
-e_import_get_type (void)
+static void
+e_import_init (EImport *import)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EImportClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) import_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EImport),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- type = g_type_register_static (
- G_TYPE_OBJECT, "EImport", &type_info, 0);
- }
-
- return type;
}
/**
@@ -434,7 +406,6 @@ e_import_target_new_home (EImport *import)
*/
-static gpointer emph_parent_class;
#define emph ((EImportHook *)eph)
static const EImportHookTargetMask eih_no_masks[] = {
@@ -447,6 +418,11 @@ static const EImportHookTargetMap eih_targets[] = {
{ NULL }
};
+G_DEFINE_TYPE (
+ EImportHook,
+ e_import_hook,
+ E_TYPE_PLUGIN_HOOK)
+
static gboolean
eih_supported (EImport *ei,
EImportTarget *target,
@@ -557,7 +533,7 @@ emph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
d (printf ("loading import hook\n"));
- if (E_PLUGIN_HOOK_CLASS (emph_parent_class)->construct (eph, ep, root) == -1)
+ if (E_PLUGIN_HOOK_CLASS (e_import_hook_parent_class)->construct (eph, ep, root) == -1)
return -1;
class = E_IMPORT_HOOK_GET_CLASS (eph)->import_class;
@@ -585,7 +561,7 @@ emph_construct (EPluginHook *eph, EPlugin *ep, xmlNodePtr root)
}
static void
-emph_class_init (EImportHookClass *class)
+e_import_hook_class_init (EImportHookClass *class)
{
EPluginHookClass *plugin_hook_class;
gint ii;
@@ -608,31 +584,9 @@ emph_class_init (EImportHookClass *class)
e_import_hook_class_add_target_map (class, &eih_targets[ii]);
}
-GType
-e_import_hook_get_type (void)
+static void
+e_import_hook_init (EImportHook *hook)
{
- static GType type = 0;
-
- if (G_UNLIKELY (type == 0)) {
- static const GTypeInfo type_info = {
- sizeof (EImportHookClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) emph_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (EImportHook),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- NULL /* value_table */
- };
-
- emph_parent_class = g_type_class_ref (e_plugin_hook_get_type ());
- type = g_type_register_static (
- E_TYPE_PLUGIN_HOOK, "EImportHook", &type_info, 0);
- }
-
- return type;
}
/**