commit 2675ee452c9ada356bd6bf294425fee9cabddefc
Author: Thomas Mittelstaedt <tmstaedt@t-mittelstaedt.de>
Date:   Tue Mar 30 19:57:59 2010 +0200

    repeating the same patch for every object in libebook and libecal

diff --git a/addressbook/libebook/e-book-view.c b/addressbook/libebook/e-book-view.c
index 03c2327..12cbe24 100644
--- a/addressbook/libebook/e-book-view.c
+++ b/addressbook/libebook/e-book-view.c
@@ -252,6 +252,8 @@ e_book_view_stop (EBookView *book_view)
 	}
 }
 
+G_DEFINE_TYPE(EBookView, e_book_view, G_TYPE_OBJECT)
+	
 static void
 e_book_view_init (EBookView *book_view)
 {
@@ -361,30 +363,3 @@ e_book_view_class_init (EBookViewClass *klass)
 
 	object_class->dispose = e_book_view_dispose;
 }
-
-/**
- * e_book_view_get_type:
- */
-GType
-e_book_view_get_type (void)
-{
-	static GType type = 0;
-
-	if (! type) {
-		GTypeInfo info = {
-			sizeof (EBookViewClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_view_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EBookView),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_view_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "EBookView", &info, 0);
-	}
-
-	return type;
-}
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index a2d6295..fe1301f 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -368,35 +368,14 @@ e_contact_class_init (EContactClass *klass)
 	}
 }
 
+G_DEFINE_TYPE(EContact, e_contact, E_TYPE_VCARD)
+	
 static void
 e_contact_init (EContact *ec)
 {
 	ec->priv = g_new0 (EContactPrivate, 1);
 }
 
-GType
-e_contact_get_type (void)
-{
-	static GType contact_type = 0;
-
-	if (!contact_type) {
-		static const GTypeInfo contact_info =  {
-			sizeof (EContactClass),
-			NULL,           /* base_init */
-			NULL,           /* base_finalize */
-			(GClassInitFunc) e_contact_class_init,
-			NULL,           /* class_finalize */
-			NULL,           /* class_data */
-			sizeof (EContact),
-			0,             /* n_preallocs */
-			(GInstanceInitFunc) e_contact_init,
-		};
-
-		contact_type = g_type_register_static (E_TYPE_VCARD, "EContact", &contact_info, 0);
-	}
-
-	return contact_type;
-}
 
 static EVCardAttribute*
 e_contact_get_first_attr (EContact *contact, const gchar *attr_name)
diff --git a/addressbook/libebook/e-destination.c b/addressbook/libebook/e-destination.c
index 83b21d7..b32267b 100644
--- a/addressbook/libebook/e-destination.c
+++ b/addressbook/libebook/e-destination.c
@@ -148,6 +148,8 @@ e_destination_class_init (EDestinationClass *klass)
 	object_class->dispose = e_destination_dispose;
 }
 
+G_DEFINE_TYPE(EDestination, e_destination, G_TYPE_OBJECT)
+	
 static void
 e_destination_init (EDestination *dest)
 {
@@ -157,29 +159,6 @@ e_destination_init (EDestination *dest)
 	dest->priv->ignored = FALSE;
 }
 
-GType
-e_destination_get_type (void)
-{
-	static GType dest_type = 0;
-
-	if (!dest_type) {
-		GTypeInfo dest_info = {
-			sizeof (EDestinationClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_destination_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EDestination),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_destination_init
-		};
-
-		dest_type = g_type_register_static (G_TYPE_OBJECT, "EDestination", &dest_info, 0);
-	}
-
-	return dest_type;
-}
 
 /**
  * e_destination_new:
diff --git a/addressbook/libebook/e-vcard.c b/addressbook/libebook/e-vcard.c
index 2398a2b..be3f7cc 100644
--- a/addressbook/libebook/e-vcard.c
+++ b/addressbook/libebook/e-vcard.c
@@ -94,36 +94,14 @@ e_vcard_class_init (EVCardClass *klass)
 	object_class->dispose = e_vcard_dispose;
 }
 
+G_DEFINE_TYPE(EVCard, e_vcard, G_TYPE_OBJECT)
+	
 static void
 e_vcard_init (EVCard *evc)
 {
 	evc->priv = g_new0 (EVCardPrivate, 1);
 }
 
-GType
-e_vcard_get_type (void)
-{
-	static GType vcard_type = 0;
-
-	if (!vcard_type) {
-		static const GTypeInfo vcard_info =  {
-			sizeof (EVCardClass),
-			NULL,           /* base_init */
-			NULL,           /* base_finalize */
-			(GClassInitFunc) e_vcard_class_init,
-			NULL,           /* class_finalize */
-			NULL,           /* class_data */
-			sizeof (EVCard),
-			0,             /* n_preallocs */
-			(GInstanceInitFunc) e_vcard_init,
-		};
-
-		vcard_type = g_type_register_static (G_TYPE_OBJECT, "EVCard", &vcard_info, 0);
-	}
-
-	return vcard_type;
-}
-
 /*  Skip newline characters and return the next character.
  *  This function takes care of folding lines, skipping
  *  newline characters if found, taking care of equal characters
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index ab3e26c..8f2c3b1 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -191,43 +191,15 @@ struct _ECalComponentAlarm {
 
 
 static void e_cal_component_class_init (ECalComponentClass *klass);
-static void e_cal_component_init (ECalComponent *comp, ECalComponentClass *klass);
+static void e_cal_component_init (ECalComponent *comp);
 static void e_cal_component_finalize (GObject *object);
 
 static GObjectClass *parent_class;
 
 
 
-/**
- * e_cal_component_get_type:
- *
- * Registers the #ECalComponent class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalComponent class.
- **/
-GType
-e_cal_component_get_type (void)
-{
-	static GType e_cal_component_type = 0;
-
-	if (!e_cal_component_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalComponentClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_component_class_init,
-                        NULL, NULL,
-                        sizeof (ECalComponent),
-                        0,
-                        (GInstanceInitFunc) e_cal_component_init
-                };
-		e_cal_component_type = g_type_register_static (G_TYPE_OBJECT, "ECalComponent", &info, 0);
-	}
-
-	return e_cal_component_type;
-}
-
+G_DEFINE_TYPE(ECalComponent, e_cal_component, G_TYPE_OBJECT)
+	
 /* Class initialization function for the calendar component object */
 static void
 e_cal_component_class_init (ECalComponentClass *klass)
@@ -243,7 +215,7 @@ e_cal_component_class_init (ECalComponentClass *klass)
 
 /* Object initialization function for the calendar component object */
 static void
-e_cal_component_init (ECalComponent *comp, ECalComponentClass *klass)
+e_cal_component_init (ECalComponent *comp)
 {
 	ECalComponentPrivate *priv;
 
diff --git a/calendar/libecal/e-cal-view.c b/calendar/libecal/e-cal-view.c
index 23fbc96..16b3a8e 100644
--- a/calendar/libecal/e-cal-view.c
+++ b/calendar/libecal/e-cal-view.c
@@ -124,9 +124,11 @@ view_done_cb (ECalViewListener *listener, ECalendarStatus status, gpointer data)
 	g_signal_emit (G_OBJECT (view), signals[VIEW_DONE], 0, status);
 }
 
+G_DEFINE_TYPE(ECalView, e_cal_view, G_TYPE_OBJECT)
+	
 /* Object initialization function for the calendar view */
 static void
-e_cal_view_init (ECalView *view, ECalViewClass *klass)
+e_cal_view_init (ECalView *view)
 {
 	ECalViewPrivate *priv;
 
@@ -301,36 +303,6 @@ e_cal_view_class_init (ECalViewClass *klass)
 }
 
 /**
- * e_cal_view_get_type:
- *
- * Registers the #ECalView class if necessary, and returns the type ID assigned
- * to it.
- *
- * Return value: The type ID of the #ECalView class.
- **/
-GType
-e_cal_view_get_type (void)
-{
-	static GType e_cal_view_type = 0;
-
-	if (!e_cal_view_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalViewClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_view_class_init,
-                        NULL, NULL,
-                        sizeof (ECalView),
-                        0,
-                        (GInstanceInitFunc) e_cal_view_init
-                };
-		e_cal_view_type = g_type_register_static (G_TYPE_OBJECT, "ECalView", &info, 0);
-	}
-
-	return e_cal_view_type;
-}
-
-/**
  * e_cal_view_new:
  * @corba_view: The CORBA object for the view.
  * @listener: An #ECalViewListener.
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 15c6022..0cc4820 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -1053,9 +1053,11 @@ get_factories (const gchar *str_uri, GList **factories)
 	return TRUE;
 }
 
+G_DEFINE_TYPE(ECal, e_cal, G_TYPE_OBJECT)
+	
 /* Object initialization function for the calendar ecal */
 static void
-e_cal_init (ECal *ecal, ECalClass *klass)
+e_cal_init (ECal *ecal)
 {
 	ECalPrivate *priv;
 
@@ -1237,36 +1239,6 @@ e_cal_class_init (ECalClass *klass)
 	object_class->finalize = e_cal_finalize;
 }
 
-/**
- * e_cal_get_type:
- *
- * Registers the #ECal class if necessary, and returns the type ID assigned
- * to it.
- *
- * Return value: The type ID of the #ECal class.
- **/
-GType
-e_cal_get_type (void)
-{
-	static GType e_cal_type = 0;
-
-	if (!e_cal_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_class_init,
-                        NULL, NULL,
-                        sizeof (ECal),
-                        0,
-                        (GInstanceInitFunc) e_cal_init
-                };
-		e_cal_type = g_type_register_static (G_TYPE_OBJECT, "ECal", &info, 0);
-	}
-
-	return e_cal_type;
-}
-
 static gboolean
 fetch_corba_cal (ECal *ecal, ESource *source, ECalSourceType type)
 {
diff --git a/calendar/libedata-cal/e-cal-backend-cache.c b/calendar/libedata-cal/e-cal-backend-cache.c
index 79316ba..ea5048b 100644
--- a/calendar/libedata-cal/e-cal-backend-cache.c
+++ b/calendar/libedata-cal/e-cal-backend-cache.c
@@ -86,6 +86,8 @@ get_filename_from_uri (const gchar *uri, ECalSourceType source_type)
 	return filename;
 }
 
+G_DEFINE_TYPE(ECalBackendCache, e_cal_backend_cache, E_TYPE_FILE_CACHE)
+	
 static void
 e_cal_backend_cache_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
@@ -247,42 +249,6 @@ e_cal_backend_cache_init (ECalBackendCache *cache)
 }
 
 /**
- * e_cal_backend_cache_get_type:
- * @void:
- *
- * Registers the #ECalBackendCache class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendCache class.
- **/
-GType
-e_cal_backend_cache_get_type (void)
-{
-	static GType type = 0;
-	static GStaticMutex registering = G_STATIC_MUTEX_INIT;
-
-	g_static_mutex_lock (&registering);
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendCacheClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_cache_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendCache),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_cache_init,
-                };
-		/* Check if the type is already registered */
-		if (!(type = g_type_from_name ("ECalBackendCache")))
-			type = g_type_register_static (E_TYPE_FILE_CACHE, "ECalBackendCache", &info, 0);
-	}
-	g_static_mutex_unlock (&registering);
-
-	return type;
-}
-
-/**
  * e_cal_backend_cache_new
  * @uri: URI of the backend to be cached.
  *
diff --git a/calendar/libedata-cal/e-cal-backend-factory.c b/calendar/libedata-cal/e-cal-backend-factory.c
index 2bb1aaf..50f18ae 100644
--- a/calendar/libedata-cal/e-cal-backend-factory.c
+++ b/calendar/libedata-cal/e-cal-backend-factory.c
@@ -15,8 +15,10 @@
 
 #include "e-cal-backend-factory.h"
 
+G_DEFINE_TYPE(ECalBackendFactory, e_cal_backend_factory, G_TYPE_OBJECT)
+	
 static void
-e_cal_backend_factory_instance_init (ECalBackendFactory *factory)
+e_cal_backend_factory_init (ECalBackendFactory *factory)
 {
 }
 
@@ -25,30 +27,6 @@ e_cal_backend_factory_class_init (ECalBackendFactoryClass *klass)
 {
 }
 
-GType
-e_cal_backend_factory_get_type (void)
-{
-	static GType type = 0;
-
-	if (! type) {
-		GTypeInfo info = {
-			sizeof (ECalBackendFactoryClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_cal_backend_factory_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (ECalBackend),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_cal_backend_factory_instance_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "ECalBackendFactory", &info, 0);
-	}
-
-	return type;
-}
-
 /**
  * e_cal_backend_factory_get_kind:
  * @factory: An #ECalBackendFactory object.
diff --git a/calendar/libedata-cal/e-cal-backend-loader-factory.c b/calendar/libedata-cal/e-cal-backend-loader-factory.c
index 909eb84..877c80a 100644
--- a/calendar/libedata-cal/e-cal-backend-loader-factory.c
+++ b/calendar/libedata-cal/e-cal-backend-loader-factory.c
@@ -17,8 +17,10 @@
 
 static GObjectClass *parent_class = NULL;
 
+G_DEFINE_TYPE(ECalBackendLoaderFactory, e_cal_backend_loader_factory, E_TYPE_CAL_BACKEND_FACTORY)
+	
 static void
-e_cal_backend_loader_factory_instance_init (ECalBackendLoaderFactory *factory)
+e_cal_backend_loader_factory_init (ECalBackendLoaderFactory *factory)
 {
 }
 
@@ -32,28 +34,3 @@ e_cal_backend_loader_factory_class_init (ECalBackendLoaderFactoryClass *klass)
 	object_class = G_OBJECT_CLASS (klass);
 
 }
-
-GType
-e_cal_backend_loader_factory_get_type (void)
-{
-	static GType type = 0;
-
-	if (! type) {
-		GTypeInfo info = {
-			sizeof (ECalBackendLoaderFactoryClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_cal_backend_loader_factory_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (ECalBackend),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_cal_backend_loader_factory_instance_init
-		};
-
-		type = g_type_register_static (E_TYPE_CAL_BACKEND_FACTORY, "ECalBackendLoaderFactory", &info, 0);
-	}
-
-	return type;
-}
-
diff --git a/calendar/libedata-cal/e-cal-backend-sexp.c b/calendar/libedata-cal/e-cal-backend-sexp.c
index f94248b..26e7678 100644
--- a/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -1271,6 +1271,8 @@ static struct {
 	{ "percent-complete?", func_percent_complete, 0 }
 };
 
+G_DEFINE_TYPE(ECalBackendSExp, e_cal_backend_sexp, G_TYPE_OBJECT)
+	
 /**
  * e_cal_backend_sexp_match_comp:
  * @sexp: An #ESExp object.
@@ -1446,33 +1448,3 @@ e_cal_backend_sexp_init (ECalBackendSExp *sexp)
 	priv->search_context = g_new (SearchContext, 1);
 }
 
-/**
- * e_cal_backend_sexp_get_type:
- *
- * Registers the #ECalBackendSExp class if needed.
- *
- * Return value: The unique identifier of the class.
- */
-GType
-e_cal_backend_sexp_get_type (void)
-{
-	static GType type = 0;
-
-	if (! type) {
-		GTypeInfo info = {
-			sizeof (ECalBackendSExpClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_cal_backend_sexp_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (ECalBackendSExp),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_cal_backend_sexp_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "ECalBackendSExp", &info, 0);
-	}
-
-	return type;
-}
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index 10fdf8a..87fb4b1 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -1020,6 +1020,8 @@ _e_cal_backend_get_free_busy (ECalBackend *backend, EDataCal *cal, GList *users,
 	g_list_free (freebusy);
 }
 
+G_DEFINE_TYPE(ECalBackendSync, e_cal_backend_sync, E_TYPE_CAL_BACKEND)
+	
 static void
 e_cal_backend_sync_init (ECalBackendSync *backend)
 {
@@ -1086,33 +1088,3 @@ e_cal_backend_sync_class_init (ECalBackendSyncClass *klass)
 	object_class->dispose = e_cal_backend_sync_dispose;
 }
 
-/**
- * e_cal_backend_get_type:
- *
- * Registers the ECalBackendSync class if needed.
- *
- * Return value: The ID of the ECalBackendSync class.
- */
-GType
-e_cal_backend_sync_get_type (void)
-{
-	static GType type = 0;
-
-	if (! type) {
-		GTypeInfo info = {
-			sizeof (ECalBackendSyncClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_cal_backend_sync_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (ECalBackendSync),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_cal_backend_sync_init
-		};
-
-		type = g_type_register_static (E_TYPE_CAL_BACKEND, "ECalBackendSync", &info, 0);
-	}
-
-	return type;
-}
