[evolution-data-server] Bug #603506 - Use thread safe G_DEFINE_TYPE/G_DEFINE_TYPE_EXTENDED



commit c8de86e329fd8ddaad4021aafff239172441bc01
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 17 18:30:49 2010 +0100

    Bug #603506 - Use thread safe G_DEFINE_TYPE/G_DEFINE_TYPE_EXTENDED

 .../google/e-book-backend-google-factory.c         |   53 +---------
 .../google/e-book-backend-google-factory.h         |   53 ---------
 .../backends/webdav/e-book-backend-webdav.c        |   26 +----
 addressbook/libebook/e-book-query.c                |   12 ++-
 addressbook/libebook/e-contact.c                   |  115 +++++---------------
 addressbook/libebook/e-destination.c               |   26 +----
 addressbook/libebook/e-vcard.c                     |   26 +----
 addressbook/libedata-book/e-book-backend-cache.c   |   24 +----
 addressbook/libedata-book/e-book-backend-factory.c |   28 +-----
 addressbook/libedata-book/e-book-backend-sexp.c    |   29 +-----
 addressbook/libedata-book/e-book-backend-summary.c |   29 +-----
 addressbook/libedata-book/e-book-backend-sync.c    |   29 +-----
 addressbook/libedata-book/e-book-backend.c         |   29 +-----
 .../backends/contacts/e-cal-backend-contacts.c     |   36 +------
 calendar/backends/file/e-cal-backend-file-events.c |   38 +------
 .../backends/file/e-cal-backend-file-journal.c     |   38 +------
 calendar/backends/file/e-cal-backend-file-todos.c  |   38 +------
 calendar/backends/file/e-cal-backend-file.c        |   34 +------
 calendar/backends/google/e-cal-backend-google.c    |   33 +-----
 .../backends/groupwise/e-cal-backend-groupwise.c   |   36 +------
 calendar/backends/http/e-cal-backend-http.c        |   36 +------
 calendar/backends/weather/e-cal-backend-weather.c  |   35 +------
 calendar/backends/weather/e-weather-source-ccf.c   |   24 +----
 calendar/backends/weather/e-weather-source.c       |   24 +----
 calendar/libecal/e-cal-component.c                 |   36 +------
 calendar/libecal/e-cal.c                           |   34 ++++---
 calendar/libedata-cal/e-cal-backend-cache.c        |   38 +------
 calendar/libedata-cal/e-cal-backend-factory.c      |   28 +-----
 .../libedata-cal/e-cal-backend-loader-factory.c    |   29 +-----
 calendar/libedata-cal/e-cal-backend-sexp.c         |   33 +------
 calendar/libedata-cal/e-cal-backend-sync.c         |   33 +------
 libebackend/e-offline-listener.c                   |   37 ++-----
 libedataserver/e-proxy.c                           |   26 +----
 libedataserver/e-sexp.c                            |   30 +-----
 libedataserver/e-source-list.c                     |   20 +---
 libedataserverui/e-categories-dialog.c             |   32 +-----
 libedataserverui/e-category-completion.c           |   33 +-----
 libedataserverui/e-contact-store.c                 |   44 +-------
 libedataserverui/e-destination-store.c             |   55 ++--------
 libedataserverui/e-source-combo-box.c              |   28 +-----
 libedataserverui/e-tree-model-generator.c          |   44 +-------
 .../google/libgdata-google/gdata-google-service.c  |   60 ++--------
 servers/google/libgdata/gdata-entry.c              |   34 +-----
 servers/google/libgdata/gdata-feed.c               |   35 +-----
 servers/google/libgdata/gdata-service-iface.c      |   15 ++--
 servers/groupwise/e-gw-connection.c                |   26 +----
 servers/groupwise/e-gw-container.c                 |   26 +----
 servers/groupwise/e-gw-filter.c                    |   26 +----
 servers/groupwise/e-gw-item.c                      |   26 +----
 servers/groupwise/e-gw-sendoptions.c               |   36 +------
 50 files changed, 218 insertions(+), 1497 deletions(-)
---
diff --git a/addressbook/backends/google/e-book-backend-google-factory.c b/addressbook/backends/google/e-book-backend-google-factory.c
index 6deb02c..2185ba6 100644
--- a/addressbook/backends/google/e-book-backend-google-factory.c
+++ b/addressbook/backends/google/e-book-backend-google-factory.c
@@ -23,63 +23,16 @@
 
 #include <libebackend/e-data-server-module.h>
 #include <libedata-book/e-book-backend-factory.h>
-#include "e-book-backend-google-factory.h"
 #include "e-book-backend-google.h"
 
-static GType google_type;
+E_BOOK_BACKEND_FACTORY_SIMPLE (google, Google, e_book_backend_google_new)
 
-static void
-e_book_backend_google_factory_instance_init (EBookBackendGoogleFactory *factory)
-{
-}
-
-static const gchar *
-_get_protocol (EBookBackendFactory *factory)
-{
-    return "google";
-}
-
-static EBookBackend*
-_new_backend (EBookBackendFactory *factory)
-{
-    return e_book_backend_google_new ();
-}
-
-static void
-e_book_backend_google_factory_class_init (EBookBackendGoogleFactoryClass *klass)
-{
-  E_BOOK_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
-  E_BOOK_BACKEND_FACTORY_CLASS (klass)->new_backend = _new_backend;
-}
-
-GType
-e_book_backend_google_factory_get_type (GTypeModule *module)
-{
-    static GType  type = 0;
-
-    if (!type) {
-        GTypeInfo info = {
-            sizeof (EBookBackendGoogleFactoryClass),
-            NULL, /* base_class_init */
-            NULL, /* base_class_finalize */
-            (GClassInitFunc)  e_book_backend_google_factory_class_init,
-            NULL, /* class_finalize */
-            NULL, /* class_data */
-            sizeof (EBookBackend),
-            0,    /* n_preallocs */
-            (GInstanceInitFunc) e_book_backend_google_factory_instance_init
-        };
-
-        type = g_type_module_register_type (module, E_TYPE_BOOK_BACKEND_FACTORY,
-                                            "EBookBackendGoogleFactory", &info, 0);
-    }
-    return type;
-}
+GType google_type;
 
 void
 eds_module_initialize (GTypeModule *module)
 {
-    google_type = e_book_backend_google_factory_get_type (module);
+    google_type = _google_factory_get_type (module);
 }
 
 void
diff --git a/addressbook/backends/webdav/e-book-backend-webdav.c b/addressbook/backends/webdav/e-book-backend-webdav.c
index 8c3fc48..e9b081c 100644
--- a/addressbook/backends/webdav/e-book-backend-webdav.c
+++ b/addressbook/backends/webdav/e-book-backend-webdav.c
@@ -55,6 +55,8 @@
 #define USERAGENT             "Evolution/" VERSION
 #define WEBDAV_CLOSURE_NAME   "EBookBackendWebdav.BookView::closure"
 
+G_DEFINE_TYPE (EBookBackendWebdav, e_book_backend_webdav, E_TYPE_BOOK_BACKEND)
+
 static EBookBackendClass *parent_class;
 
 struct _EBookBackendWebdavPrivate {
@@ -1166,27 +1168,3 @@ e_book_backend_webdav_init(EBookBackendWebdav *backend)
 			E_TYPE_BOOK_BACKEND_WEBDAV, EBookBackendWebdavPrivate);
 }
 
-GType
-e_book_backend_webdav_get_type(void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		GTypeInfo info = {
-			sizeof(EBookBackendWebdavClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_backend_webdav_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof(EBookBackendWebdav),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_backend_webdav_init
-		};
-
-		type = g_type_register_static(E_TYPE_BOOK_BACKEND, "EBookBackendWebdav",
-				&info, 0);
-	}
-
-	return type;
-}
diff --git a/addressbook/libebook/e-book-query.c b/addressbook/libebook/e-book-query.c
index 1ea7416..1f5bf19 100644
--- a/addressbook/libebook/e-book-query.c
+++ b/addressbook/libebook/e-book-query.c
@@ -729,13 +729,19 @@ e_book_query_to_string    (EBookQuery *q)
 GType
 e_book_query_get_type (void)
 {
-	static GType type_id = 0;
+	static volatile gsize type_id__volatile = 0;
+
+	if (g_once_init_enter (&type_id__volatile)) {
+		GType type_id;
 
-	if (!type_id)
 		type_id = g_boxed_type_register_static ("EBookQuery",
 							(GBoxedCopyFunc) e_book_query_copy,
 							(GBoxedFreeFunc) e_book_query_unref);
-	return type_id;
+
+		g_once_init_leave (&type_id__volatile, type_id);
+	}
+
+	return type_id__volatile;
 }
 
 /**
diff --git a/addressbook/libebook/e-contact.c b/addressbook/libebook/e-contact.c
index e8bb7cc..974c4c1 100644
--- a/addressbook/libebook/e-contact.c
+++ b/addressbook/libebook/e-contact.c
@@ -41,6 +41,8 @@
 
 #define d(x)
 
+G_DEFINE_TYPE (EContact, e_contact, E_TYPE_VCARD)
+
 struct _EContactPrivate {
 	gchar *cached_strings [E_CONTACT_FIELD_LAST];
 };
@@ -374,30 +376,6 @@ 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)
 {
@@ -1827,18 +1805,27 @@ e_contact_name_free (EContactName *name)
 	g_free (name);
 }
 
-GType
-e_contact_name_get_type (void)
-{
-	static GType type_id = 0;
-
-	if (!type_id)
-		type_id = g_boxed_type_register_static ("EContactName",
-							(GBoxedCopyFunc) e_contact_name_copy,
-							(GBoxedFreeFunc) e_contact_name_free);
-	return type_id;
+#define E_CONTACT_DEFINE_BOXED_TYPE(_tp,_nm)				\
+	GType								\
+	_tp ## _get_type (void)						\
+	{								\
+		static volatile gsize type_id__volatile = 0;		\
+									\
+		if (g_once_init_enter (&type_id__volatile)) {		\
+			GType type_id;					\
+									\
+			type_id = g_boxed_type_register_static (_nm,	\
+				(GBoxedCopyFunc) _tp ## _copy,		\
+				(GBoxedFreeFunc) _tp ## _free);		\
+									\
+			g_once_init_leave (&type_id__volatile, type_id);\
+	}								\
+									\
+	return type_id__volatile;					\
 }
 
+E_CONTACT_DEFINE_BOXED_TYPE (e_contact_name, "EContactName")
+
 /**
  * e_contact_date_from_string:
  * @str: a date string in the format YYYY-MM-DD or YYYYMMDD
@@ -1948,17 +1935,7 @@ e_contact_date_free (EContactDate *date)
 	g_free (date);
 }
 
-GType
-e_contact_date_get_type (void)
-{
-	static GType type_id = 0;
-
-	if (!type_id)
-		type_id = g_boxed_type_register_static ("EContactDate",
-							(GBoxedCopyFunc) e_contact_date_copy,
-							(GBoxedFreeFunc) e_contact_date_free);
-	return type_id;
-}
+E_CONTACT_DEFINE_BOXED_TYPE (e_contact_date, "EContactDate")
 
 /**
  * e_contact_date_new:
@@ -2032,17 +2009,7 @@ e_contact_photo_copy (EContactPhoto *photo)
 	return photo2;
 }
 
-GType
-e_contact_photo_get_type (void)
-{
-	static GType type_id = 0;
-
-	if (!type_id)
-		type_id = g_boxed_type_register_static ("EContactPhoto",
-							(GBoxedCopyFunc) e_contact_photo_copy,
-							(GBoxedFreeFunc) e_contact_photo_free);
-	return type_id;
-}
+E_CONTACT_DEFINE_BOXED_TYPE (e_contact_photo, "EContactPhoto")
 
 /**
  * e_contact_geo_free:
@@ -2066,17 +2033,7 @@ e_contact_geo_copy (EContactGeo *geo)
 	return geo2;
 }
 
-GType
-e_contact_geo_get_type (void)
-{
-	static GType type_id = 0;
-
-	if (!type_id)
-		type_id = g_boxed_type_register_static ("EContactGeo",
-							(GBoxedCopyFunc) e_contact_geo_copy,
-							(GBoxedFreeFunc) e_contact_geo_free);
-	return type_id;
-}
+E_CONTACT_DEFINE_BOXED_TYPE (e_contact_geo, "EContactGeo")
 
 /**
  * e_contact_address_free:
@@ -2119,17 +2076,7 @@ e_contact_address_copy (EContactAddress *address)
 	return address2;
 }
 
-GType
-e_contact_address_get_type (void)
-{
-	static GType type_id = 0;
-
-	if (!type_id)
-		type_id = g_boxed_type_register_static ("EContactAddress",
-							(GBoxedCopyFunc) e_contact_address_copy,
-							(GBoxedFreeFunc) e_contact_address_free);
-	return type_id;
-}
+E_CONTACT_DEFINE_BOXED_TYPE (e_contact_address, "EContactAddress")
 
 /**
  * e_contact_cert_free:
@@ -2158,14 +2105,4 @@ e_contact_cert_copy (EContactCert *cert)
 	return cert2;
 }
 
-GType
-e_contact_cert_get_type (void)
-{
-	static GType type_id = 0;
-
-	if (!type_id)
-		type_id = g_boxed_type_register_static ("EContactCert",
-							(GBoxedCopyFunc) e_contact_cert_copy,
-							(GBoxedFreeFunc) e_contact_cert_free);
-	return type_id;
-}
+E_CONTACT_DEFINE_BOXED_TYPE (e_contact_cert, "EContactCert")
diff --git a/addressbook/libebook/e-destination.c b/addressbook/libebook/e-destination.c
index 5296d68..ffe2572 100644
--- a/addressbook/libebook/e-destination.c
+++ b/addressbook/libebook/e-destination.c
@@ -48,6 +48,8 @@
 
 #define d(x)
 
+G_DEFINE_TYPE (EDestination, e_destination, G_TYPE_OBJECT)
+
 struct _EDestinationPrivate {
 	gchar *raw;
 
@@ -157,30 +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 bdcc96e..daea606 100644
--- a/addressbook/libebook/e-vcard.c
+++ b/addressbook/libebook/e-vcard.c
@@ -34,6 +34,8 @@
 
 #define CRLF "\r\n"
 
+G_DEFINE_TYPE (EVCard, e_vcard, G_TYPE_OBJECT)
+
 /** Encoding used in v-card
  *  Note: v-card spec defines additional 7BIT 8BIT and X- encoding
  */
@@ -100,30 +102,6 @@ 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/addressbook/libedata-book/e-book-backend-cache.c b/addressbook/libedata-book/e-book-backend-cache.c
index de954e4..31a22a8 100644
--- a/addressbook/libedata-book/e-book-backend-cache.c
+++ b/addressbook/libedata-book/e-book-backend-cache.c
@@ -27,6 +27,8 @@
 #include "e-book-backend-cache.h"
 #include "e-book-backend-sexp.h"
 
+G_DEFINE_TYPE (EBookBackendCache, e_book_backend_cache, E_TYPE_FILE_CACHE)
+
 struct _EBookBackendCachePrivate {
 	gchar *uri;
 };
@@ -189,28 +191,6 @@ e_book_backend_cache_init (EBookBackendCache *cache)
 
 }
 
-GType
-e_book_backend_cache_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (EBookBackendCacheClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_book_backend_cache_class_init,
-                        NULL, NULL,
-                        sizeof (EBookBackendCache),
-                        0,
-                        (GInstanceInitFunc) e_book_backend_cache_init,
-                };
-		type = g_type_register_static (E_TYPE_FILE_CACHE, "EBookBackendCache", &info, 0);
-	}
-
-	return type;
-}
-
 /**
  * e_book_backend_cache_new
  * @uri: URI of the backend to be cached.
diff --git a/addressbook/libedata-book/e-book-backend-factory.c b/addressbook/libedata-book/e-book-backend-factory.c
index 7476f8a..b1f594f 100644
--- a/addressbook/libedata-book/e-book-backend-factory.c
+++ b/addressbook/libedata-book/e-book-backend-factory.c
@@ -15,8 +15,10 @@
 
 #include "e-book-backend-factory.h"
 
+G_DEFINE_TYPE (EBookBackendFactory, e_book_backend_factory, G_TYPE_OBJECT)
+
 static void
-e_book_backend_factory_instance_init (EBookBackendFactory *factory)
+e_book_backend_factory_init (EBookBackendFactory *factory)
 {
 }
 
@@ -25,30 +27,6 @@ e_book_backend_factory_class_init (EBookBackendFactoryClass *klass)
 {
 }
 
-GType
-e_book_backend_factory_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		GTypeInfo info = {
-			sizeof (EBookBackendFactoryClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_backend_factory_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EBookBackendFactory),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_backend_factory_instance_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "EBookBackendFactory", &info, 0);
-	}
-
-	return type;
-}
-
 /**
  * e_book_backend_factory_get_protocol:
  * @factory: an #EBookBackendFactory
diff --git a/addressbook/libedata-book/e-book-backend-sexp.c b/addressbook/libedata-book/e-book-backend-sexp.c
index fe67091..e5e04ac 100644
--- a/addressbook/libedata-book/e-book-backend-sexp.c
+++ b/addressbook/libedata-book/e-book-backend-sexp.c
@@ -23,6 +23,8 @@
 #include "libedataserver/e-data-server-util.h"
 #include "e-book-backend-sexp.h"
 
+G_DEFINE_TYPE (EBookBackendSExp, e_book_backend_sexp, G_TYPE_OBJECT)
+
 static GObjectClass *parent_class;
 
 typedef struct _SearchContext SearchContext;
@@ -931,30 +933,3 @@ e_book_backend_sexp_init (EBookBackendSExp *sexp)
 	sexp->priv = priv;
 	priv->search_context = g_new (SearchContext, 1);
 }
-
-/**
- * e_book_backend_sexp_get_type:
- */
-GType
-e_book_backend_sexp_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		GTypeInfo info = {
-			sizeof (EBookBackendSExpClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_backend_sexp_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EBookBackendSExp),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_backend_sexp_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "EBookBackendSExp", &info, 0);
-	}
-
-	return type;
-}
diff --git a/addressbook/libedata-book/e-book-backend-summary.c b/addressbook/libedata-book/e-book-backend-summary.c
index 9fed9fc..e8b0b0b 100644
--- a/addressbook/libedata-book/e-book-backend-summary.c
+++ b/addressbook/libedata-book/e-book-backend-summary.c
@@ -42,6 +42,8 @@
 
 #include "e-book-backend-summary.h"
 
+G_DEFINE_TYPE (EBookBackendSummary, e_book_backend_summary, G_TYPE_OBJECT)
+
 static GObjectClass *parent_class;
 
 struct _EBookBackendSummaryPrivate {
@@ -234,33 +236,6 @@ e_book_backend_summary_init (EBookBackendSummary *summary)
 #endif
 }
 
-/**
- * e_book_backend_summary_get_type:
- */
-GType
-e_book_backend_summary_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		GTypeInfo info = {
-			sizeof (EBookBackendSummaryClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_backend_summary_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EBookBackendSummary),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_backend_summary_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "EBookBackendSummary", &info, 0);
-	}
-
-	return type;
-}
-
 
 static gboolean
 e_book_backend_summary_check_magic (EBookBackendSummary *summary, FILE *fp)
diff --git a/addressbook/libedata-book/e-book-backend-sync.c b/addressbook/libedata-book/e-book-backend-sync.c
index 11ad076..63ee65f 100644
--- a/addressbook/libedata-book/e-book-backend-sync.c
+++ b/addressbook/libedata-book/e-book-backend-sync.c
@@ -12,6 +12,8 @@
 
 #include "e-book-backend-sync.h"
 
+G_DEFINE_TYPE (EBookBackendSync, e_book_backend_sync, E_TYPE_BOOK_BACKEND)
+
 struct _EBookBackendSyncPrivate {
   gint mumble;
 };
@@ -577,30 +579,3 @@ e_book_backend_sync_class_init (EBookBackendSyncClass *klass)
 
 	object_class->dispose = e_book_backend_sync_dispose;
 }
-
-/**
- * e_book_backend_get_type:
- */
-GType
-e_book_backend_sync_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		GTypeInfo info = {
-			sizeof (EBookBackendSyncClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_backend_sync_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EBookBackendSync),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_backend_sync_init
-		};
-
-		type = g_type_register_static (E_TYPE_BOOK_BACKEND, "EBookBackendSync", &info, 0);
-	}
-
-	return type;
-}
diff --git a/addressbook/libedata-book/e-book-backend.c b/addressbook/libedata-book/e-book-backend.c
index 9d9f14d..729c21e 100644
--- a/addressbook/libedata-book/e-book-backend.c
+++ b/addressbook/libedata-book/e-book-backend.c
@@ -12,6 +12,8 @@
 #include "e-data-book.h"
 #include "e-book-backend.h"
 
+G_DEFINE_TYPE (EBookBackend, e_book_backend, G_TYPE_OBJECT)
+
 struct _EBookBackendPrivate {
 	GMutex *open_mutex;
 
@@ -1047,30 +1049,3 @@ e_book_backend_class_init (EBookBackendClass *klass)
 			      g_cclosure_marshal_VOID__VOID,
 			      G_TYPE_NONE, 0);
 }
-
-/**
- * e_book_backend_get_type:
- */
-GType
-e_book_backend_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		GTypeInfo info = {
-			sizeof (EBookBackendClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc)  e_book_backend_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (EBookBackend),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_book_backend_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "EBookBackend", &info, 0);
-	}
-
-	return type;
-}
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c
index 0909949..49c09a5 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -43,6 +43,8 @@
 
 #include "libedataserver/e-source-list.h"
 
+G_DEFINE_TYPE (ECalBackendContacts, e_cal_backend_contacts, E_TYPE_CAL_BACKEND_SYNC)
+
 static ECalBackendSyncClass *parent_class;
 
 typedef enum
@@ -1241,7 +1243,7 @@ e_cal_backend_contacts_finalize (GObject *object)
 
 /* Object initialization function for the contacts backend */
 static void
-e_cal_backend_contacts_init (ECalBackendContacts *cbc, ECalBackendContactsClass *class)
+e_cal_backend_contacts_init (ECalBackendContacts *cbc)
 {
 	ECalBackendContactsPrivate *priv;
 
@@ -1325,35 +1327,3 @@ e_cal_backend_contacts_class_init (ECalBackendContactsClass *class)
 	backend_class->internal_get_default_timezone = e_cal_backend_contacts_internal_get_default_timezone;
 	backend_class->internal_get_timezone = e_cal_backend_contacts_internal_get_timezone;
 }
-
-/**
- * e_cal_backend_contacts_get_type:
- * @void:
- *
- * Registers the #ECalBackendContacts class if necessary, and returns
- * the type ID associated to it.
- *
- * Return value: The type ID of the #ECalBackendContacts class.
- **/
-GType
-e_cal_backend_contacts_get_type (void)
-{
-	static GType e_cal_backend_contacts_type = 0;
-
-	if (!e_cal_backend_contacts_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendContactsClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_contacts_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendContacts),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_contacts_init
-                };
-		e_cal_backend_contacts_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC,
-                                                                     "ECalBackendContacts", &info, 0);
-	}
-
-	return e_cal_backend_contacts_type;
-}
diff --git a/calendar/backends/file/e-cal-backend-file-events.c b/calendar/backends/file/e-cal-backend-file-events.c
index c749873..03a2b7c 100644
--- a/calendar/backends/file/e-cal-backend-file-events.c
+++ b/calendar/backends/file/e-cal-backend-file-events.c
@@ -25,6 +25,8 @@
 
 #include "e-cal-backend-file-events.h"
 
+G_DEFINE_TYPE (ECalBackendFileEvents, e_cal_backend_file_events, E_TYPE_CAL_BACKEND_FILE)
+
 
 
 /* Private part of the CalBackendFileEvents structure */
@@ -34,8 +36,6 @@ struct _ECalBackendFileEventsPrivate {
 
 
 
-static void e_cal_backend_file_events_class_init (ECalBackendFileEventsClass *class);
-static void e_cal_backend_file_events_init (ECalBackendFileEvents *cbfile, ECalBackendFileEventsClass *class);
 static void e_cal_backend_file_events_dispose (GObject *object);
 static void e_cal_backend_file_events_finalize (GObject *object);
 
@@ -43,38 +43,6 @@ static GObjectClass *parent_class;
 
 
 
-/**
- * e_cal_backend_file_events_get_type:
- * @void:
- *
- * Registers the #ECalBackendFileEvents class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendFileEvents class.
- **/
-GType
-e_cal_backend_file_events_get_type (void)
-{
-	static GType e_cal_backend_file_events_type = 0;
-
-	if (!e_cal_backend_file_events_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendFileEventsClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_file_events_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendFileEvents),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_file_events_init
-                };
-		e_cal_backend_file_events_type = g_type_register_static (E_TYPE_CAL_BACKEND_FILE,
-								      "ECalBackendFileEvents", &info, 0);
-	}
-
-	return e_cal_backend_file_events_type;
-}
-
 /* Class initialization function for the file backend */
 static void
 e_cal_backend_file_events_class_init (ECalBackendFileEventsClass *klass)
@@ -93,7 +61,7 @@ e_cal_backend_file_events_class_init (ECalBackendFileEventsClass *klass)
 
 /* Object initialization function for the file backend */
 static void
-e_cal_backend_file_events_init (ECalBackendFileEvents *cbfile, ECalBackendFileEventsClass *class)
+e_cal_backend_file_events_init (ECalBackendFileEvents *cbfile)
 {
 	ECalBackendFileEventsPrivate *priv;
 
diff --git a/calendar/backends/file/e-cal-backend-file-journal.c b/calendar/backends/file/e-cal-backend-file-journal.c
index 9e1b229..815158c 100644
--- a/calendar/backends/file/e-cal-backend-file-journal.c
+++ b/calendar/backends/file/e-cal-backend-file-journal.c
@@ -20,49 +20,17 @@
 
 #include "e-cal-backend-file-journal.h"
 
+G_DEFINE_TYPE (ECalBackendFileJournal, e_cal_backend_file_journal, E_TYPE_CAL_BACKEND_FILE)
+
 struct _ECalBackendFileJournalPrivate {
 	guint reserved;
 };
 
-static void e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *class);
-static void e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile, ECalBackendFileJournalClass *class);
 static void e_cal_backend_file_journal_dispose (GObject *object);
 static void e_cal_backend_file_journal_finalize (GObject *object);
 
 static ECalBackendFileClass *parent_class;
 
-/**
- * e_cal_backend_file_journal_get_type:
- * @void:
- *
- * Registers the #ECalBackendFileJournal class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendFileJournal class.
- **/
-GType
-e_cal_backend_file_journal_get_type (void)
-{
-	static GType e_cal_backend_file_journal_type = 0;
-
-	if (!e_cal_backend_file_journal_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendFileJournalClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_file_journal_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendFileJournal),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_file_journal_init
-                };
-		e_cal_backend_file_journal_type = g_type_register_static (E_TYPE_CAL_BACKEND_FILE,
-									  "ECalBackendFileJournal", &info, 0);
-	}
-
-	return e_cal_backend_file_journal_type;
-}
-
 /* Class initialization function for the journal file backend */
 static void
 e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *klass)
@@ -81,7 +49,7 @@ e_cal_backend_file_journal_class_init (ECalBackendFileJournalClass *klass)
 
 /* Object initialization function for the journal file backend */
 static void
-e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile, ECalBackendFileJournalClass *klass)
+e_cal_backend_file_journal_init (ECalBackendFileJournal *cbfile)
 {
 	ECalBackendFileJournalPrivate *priv;
 
diff --git a/calendar/backends/file/e-cal-backend-file-todos.c b/calendar/backends/file/e-cal-backend-file-todos.c
index c42cc83..fe187a1 100644
--- a/calendar/backends/file/e-cal-backend-file-todos.c
+++ b/calendar/backends/file/e-cal-backend-file-todos.c
@@ -25,6 +25,8 @@
 
 #include "e-cal-backend-file-todos.h"
 
+G_DEFINE_TYPE (ECalBackendFileTodos, e_cal_backend_file_todos, E_TYPE_CAL_BACKEND_FILE)
+
 
 
 /* Private part of the ECalBackendFileTodos structure */
@@ -34,8 +36,6 @@ struct _ECalBackendFileTodosPrivate {
 
 
 
-static void e_cal_backend_file_todos_class_init (ECalBackendFileTodosClass *class);
-static void e_cal_backend_file_todos_init (ECalBackendFileTodos *cbfile, ECalBackendFileTodosClass *class);
 static void e_cal_backend_file_todos_dispose (GObject *object);
 static void e_cal_backend_file_todos_finalize (GObject *object);
 
@@ -43,38 +43,6 @@ static ECalBackendFileClass *parent_class;
 
 
 
-/**
- * e_cal_backend_file_todos_get_type:
- * @void:
- *
- * Registers the #ECalBackendFileTodos class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendFileTodos class.
- **/
-GType
-e_cal_backend_file_todos_get_type (void)
-{
-	static GType e_cal_backend_file_todos_type = 0;
-
-	if (!e_cal_backend_file_todos_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendFileTodosClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_file_todos_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendFileTodos),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_file_todos_init
-                };
-		e_cal_backend_file_todos_type = g_type_register_static (E_TYPE_CAL_BACKEND_FILE,
-								      "ECalBackendFileTodos", &info, 0);
-	}
-
-	return e_cal_backend_file_todos_type;
-}
-
 /* Class initialization function for the file backend */
 static void
 e_cal_backend_file_todos_class_init (ECalBackendFileTodosClass *klass)
@@ -93,7 +61,7 @@ e_cal_backend_file_todos_class_init (ECalBackendFileTodosClass *klass)
 
 /* Object initialization function for the file backend */
 static void
-e_cal_backend_file_todos_init (ECalBackendFileTodos *cbfile, ECalBackendFileTodosClass *class)
+e_cal_backend_file_todos_init (ECalBackendFileTodos *cbfile)
 {
 	ECalBackendFileTodosPrivate *priv;
 
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index 30e5501..9742971 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -45,6 +45,8 @@
 #define O_BINARY 0
 #endif
 
+G_DEFINE_TYPE (ECalBackendFile, e_cal_backend_file, E_TYPE_CAL_BACKEND_SYNC)
+
 /* Placeholder for each component and its recurrences */
 typedef struct {
 	ECalComponent *full_object;
@@ -3120,38 +3122,6 @@ e_cal_backend_file_class_init (ECalBackendFileClass *class)
 	backend_class->internal_get_timezone = e_cal_backend_file_internal_get_timezone;
 }
 
-/**
- * e_cal_backend_file_get_type:
- * @void:
- *
- * Registers the #ECalBackendFile class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendFile class.
- **/
-GType
-e_cal_backend_file_get_type (void)
-{
-	static GType e_cal_backend_file_type = 0;
-
-	if (!e_cal_backend_file_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendFileClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_file_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendFile),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_file_init
-                };
-		e_cal_backend_file_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC,
-								"ECalBackendFile", &info, 0);
-	}
-
-	return e_cal_backend_file_type;
-}
-
 void
 e_cal_backend_file_set_file_name (ECalBackendFile *cbfile, const gchar *file_name)
 {
diff --git a/calendar/backends/google/e-cal-backend-google.c b/calendar/backends/google/e-cal-backend-google.c
index c351607..21a4b06 100644
--- a/calendar/backends/google/e-cal-backend-google.c
+++ b/calendar/backends/google/e-cal-backend-google.c
@@ -56,6 +56,8 @@
 #define O_BINARY 0
 #endif
 
+G_DEFINE_TYPE (ECalBackendGoogle, e_cal_backend_google, E_TYPE_CAL_BACKEND_SYNC)
+
 static ECalBackendGoogleClass *parent_class = NULL;
 struct _ECalBackendGooglePrivate {
 	ECalBackendCache *cache;
@@ -1274,7 +1276,7 @@ proxy_settings_changed (EProxy *proxy, gpointer user_data)
 
 /* Object initialisation function for google backend */
 static void
-e_cal_backend_google_init (ECalBackendGoogle *cbgo, ECalBackendGoogleClass *class)
+e_cal_backend_google_init (ECalBackendGoogle *cbgo)
 {
 	ECalBackendGooglePrivate *priv;
 
@@ -1348,35 +1350,6 @@ e_cal_backend_google_class_init (ECalBackendGoogleClass *class)
 	backend_class->internal_get_default_timezone = e_cal_backend_google_internal_get_default_timezone;
 }
 
-/**
- * e_cal_backend_google_get_type:
- * @void:
- * Registers the #ECalBackendGoogle class if necessary and returns the type ID
- * associated with it
- * Return value: The type id of the #ECalBackendGoogle class.
- **/
-GType
-e_cal_backend_google_get_type (void)
-{
-	static	GType e_cal_backend_google_type = 0;
-
-	if (!e_cal_backend_google_type) {
-		static GTypeInfo info = {
-			sizeof (ECalBackendGoogleClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_cal_backend_google_class_init,
-			NULL, NULL,
-			sizeof (ECalBackendGoogle),
-			0,
-			(GInstanceInitFunc) e_cal_backend_google_init
-		};
-		e_cal_backend_google_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC,
-				"ECalBackendGoogle", &info, 0);
-	}
-	return e_cal_backend_google_type;
-}
-
 /***************************************** Helper Functions ****************************************************/
 
 /**
diff --git a/calendar/backends/groupwise/e-cal-backend-groupwise.c b/calendar/backends/groupwise/e-cal-backend-groupwise.c
index 8ea5035..af50306 100644
--- a/calendar/backends/groupwise/e-cal-backend-groupwise.c
+++ b/calendar/backends/groupwise/e-cal-backend-groupwise.c
@@ -61,6 +61,8 @@
 #define SERVER_UTC_TIME "server_utc_time"
 #define CACHE_MARKER "populated"
 
+G_DEFINE_TYPE (ECalBackendGroupwise, e_cal_backend_groupwise, E_TYPE_CAL_BACKEND_SYNC)
+
 typedef struct {
 	GCond *cond;
 	GMutex *mutex;
@@ -2801,7 +2803,7 @@ e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, c
 
 /* Object initialization function for the file backend */
 static void
-e_cal_backend_groupwise_init (ECalBackendGroupwise *cbgw, ECalBackendGroupwiseClass *class)
+e_cal_backend_groupwise_init (ECalBackendGroupwise *cbgw)
 {
 	ECalBackendGroupwisePrivate *priv;
 
@@ -2865,38 +2867,6 @@ e_cal_backend_groupwise_class_init (ECalBackendGroupwiseClass *class)
 	backend_class->internal_get_timezone = e_cal_backend_groupwise_internal_get_timezone;
 }
 
-/**
- * e_cal_backend_groupwise_get_type:
- * @void:
- *
- * Registers the #ECalBackendGroupwise class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendGroupwise class.
- **/
-GType
-e_cal_backend_groupwise_get_type (void)
-{
-	static GType e_cal_backend_groupwise_type = 0;
-
-	if (!e_cal_backend_groupwise_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendGroupwiseClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_groupwise_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendGroupwise),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_groupwise_init
-                };
-		e_cal_backend_groupwise_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC,
-								  "ECalBackendGroupwise", &info, 0);
-	}
-
-	return e_cal_backend_groupwise_type;
-}
-
 void
 e_cal_backend_groupwise_notify_error_code (ECalBackendGroupwise *cbgw, EGwConnectionStatus status)
 {
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index 197e203..644eb79 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -39,6 +39,8 @@
 #include <libsoup/soup.h>
 #include "e-cal-backend-http.h"
 
+G_DEFINE_TYPE (ECalBackendHttp, e_cal_backend_http, E_TYPE_CAL_BACKEND_SYNC)
+
 
 
 /* Private part of the ECalBackendHttp structure */
@@ -1322,7 +1324,7 @@ e_cal_backend_http_internal_get_timezone (ECalBackend *backend, const gchar *tzi
 
 /* Object initialization function for the file backend */
 static void
-e_cal_backend_http_init (ECalBackendHttp *cbhttp, ECalBackendHttpClass *class)
+e_cal_backend_http_init (ECalBackendHttp *cbhttp)
 {
 	ECalBackendHttpPrivate *priv;
 
@@ -1383,35 +1385,3 @@ e_cal_backend_http_class_init (ECalBackendHttpClass *class)
 	backend_class->internal_get_default_timezone = e_cal_backend_http_internal_get_default_timezone;
 	backend_class->internal_get_timezone = e_cal_backend_http_internal_get_timezone;
 }
-
-/**
- * e_cal_backend_http_get_type:
- * @void:
- *
- * Registers the #ECalBackendHttp class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackendHttp class.
- **/
-GType
-e_cal_backend_http_get_type (void)
-{
-	static GType e_cal_backend_http_type = 0;
-
-	if (!e_cal_backend_http_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendHttpClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_http_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackendHttp),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_http_init
-                };
-		e_cal_backend_http_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC,
-								  "ECalBackendHttp", &info, 0);
-	}
-
-	return e_cal_backend_http_type;
-}
diff --git a/calendar/backends/weather/e-cal-backend-weather.c b/calendar/backends/weather/e-cal-backend-weather.c
index 00e9d32..4ac358e 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -34,6 +34,8 @@
 
 #define WEATHER_UID_EXT "-weather"
 
+G_DEFINE_TYPE (ECalBackendWeather, e_cal_backend_weather, E_TYPE_CAL_BACKEND_SYNC)
+
 static gboolean reload_cb (ECalBackendWeather *cbw);
 static gboolean begin_retrieval_cb (ECalBackendWeather *cbw);
 static ECalComponent* create_weather (ECalBackendWeather *cbw, WeatherInfo *report, gboolean is_forecast);
@@ -910,7 +912,7 @@ e_cal_backend_weather_finalize (GObject *object)
 
 /* Object initialization function for the weather backend */
 static void
-e_cal_backend_weather_init (ECalBackendWeather *cbw, ECalBackendWeatherClass *class)
+e_cal_backend_weather_init (ECalBackendWeather *cbw)
 {
 	ECalBackendWeatherPrivate *priv;
 
@@ -972,34 +974,3 @@ e_cal_backend_weather_class_init (ECalBackendWeatherClass *class)
 	backend_class->internal_get_default_timezone = e_cal_backend_weather_internal_get_default_timezone;
 	backend_class->internal_get_timezone = e_cal_backend_weather_internal_get_timezone;
 }
-
-/**
- * e_cal_backend_weather_get_type:
- * @void:
- *
- * Registers the #ECalBackendWeather class if necessary, and returns
- * the type ID associated to it.
- *
- * Return value: The type ID of the #ECalBackendWeather class.
- **/
-GType
-e_cal_backend_weather_get_type (void)
-{
-	static GType e_cal_backend_weather_type = 0;
-
-	if (!e_cal_backend_weather_type) {
-		static GTypeInfo info = {
-			sizeof (ECalBackendWeatherClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_cal_backend_weather_class_init,
-			NULL, NULL,
-			sizeof (ECalBackendWeather),
-			0,
-			(GInstanceInitFunc) e_cal_backend_weather_init
-		};
-		e_cal_backend_weather_type = g_type_register_static (E_TYPE_CAL_BACKEND_SYNC, "ECalBackendWeather", &info, 0);
-	}
-
-	return e_cal_backend_weather_type;
-}
diff --git a/calendar/backends/weather/e-weather-source-ccf.c b/calendar/backends/weather/e-weather-source-ccf.c
index 215b2c5..2400f16 100644
--- a/calendar/backends/weather/e-weather-source-ccf.c
+++ b/calendar/backends/weather/e-weather-source-ccf.c
@@ -54,6 +54,8 @@
 #define strtok_r(s,sep,lasts) (*(lasts)=strtok((s),(sep)))
 #endif
 
+G_DEFINE_TYPE (EWeatherSourceCCF, e_weather_source_ccf, E_TYPE_WEATHER_SOURCE)
+
 struct search_struct
 {
 	const gchar *code;
@@ -456,25 +458,3 @@ e_weather_source_ccf_init (EWeatherSourceCCF *source)
 	source->location = NULL;
 	source->info = NULL;
 }
-
-GType
-e_weather_source_ccf_get_type (void)
-{
-	static GType e_weather_source_ccf_type = 0;
-
-	if (!e_weather_source_ccf_type) {
-		static GTypeInfo info = {
-			sizeof (EWeatherSourceCCFClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_weather_source_ccf_class_init,
-			NULL, NULL,
-			sizeof (EWeatherSourceCCF),
-			0,
-			(GInstanceInitFunc) e_weather_source_ccf_init
-		};
-		e_weather_source_ccf_type = g_type_register_static (E_TYPE_WEATHER_SOURCE, "EWeatherSourceCCF", &info, 0);
-	}
-
-	return e_weather_source_ccf_type;
-}
diff --git a/calendar/backends/weather/e-weather-source.c b/calendar/backends/weather/e-weather-source.c
index 6ab8bc9..539390a 100644
--- a/calendar/backends/weather/e-weather-source.c
+++ b/calendar/backends/weather/e-weather-source.c
@@ -23,6 +23,8 @@
 
 #include <string.h>
 
+G_DEFINE_TYPE (EWeatherSource, e_weather_source, G_TYPE_OBJECT)
+
 void
 e_weather_source_parse (EWeatherSource *source, EWeatherSourceFinished done, gpointer data)
 {
@@ -44,28 +46,6 @@ e_weather_source_init (EWeatherSource *source)
 	/* nothing to do here */
 }
 
-GType
-e_weather_source_get_type (void)
-{
-	static GType e_weather_source_type = 0;
-
-	if (!e_weather_source_type) {
-		static GTypeInfo info = {
-			sizeof (EWeatherSourceClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_weather_source_class_init,
-			NULL, NULL,
-			sizeof (EWeatherSource),
-			0,
-			(GInstanceInitFunc) e_weather_source_init
-		};
-		e_weather_source_type = g_type_register_static (G_TYPE_OBJECT, "EWeatherSource", &info, 0);
-	}
-
-	return e_weather_source_type;
-}
-
 EWeatherSource*	e_weather_source_new (const gchar *uri)
 {
 	const gchar *base = uri + 10; /* skip weather:// */
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index 30faa54..0caf9b5 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -34,6 +34,8 @@
 #define getppid() 0
 #endif
 
+G_DEFINE_TYPE (ECalComponent, e_cal_component, G_TYPE_OBJECT)
+
 /* Extension property for alarm components so that we can reference them by UID */
 #define EVOLUTION_ALARM_UID_PROPERTY "X-EVOLUTION-ALARM-UID"
 
@@ -190,44 +192,12 @@ 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_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;
-}
-
 /* Class initialization function for the calendar component object */
 static void
 e_cal_component_class_init (ECalComponentClass *klass)
@@ -243,7 +213,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.c b/calendar/libecal/e-cal.c
index 3678fea..48ab4ae 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -276,9 +276,10 @@ unwrap_gerror(GError **error)
 GType
 e_cal_source_type_enum_get_type (void)
 {
-	static GType e_cal_source_type_enum_type = 0;
+	static volatile gsize enum_type__volatile = 0;
 
-	if (!e_cal_source_type_enum_type) {
+	if (g_once_init_enter (&enum_type__volatile)) {
+		GType enum_type;
 		static GEnumValue values [] = {
 			{ E_CAL_SOURCE_TYPE_EVENT, "Event", NULL},
 			{ E_CAL_SOURCE_TYPE_TODO, "ToDo", NULL},
@@ -287,11 +288,11 @@ e_cal_source_type_enum_get_type (void)
 			{ -1, NULL, NULL}
 		};
 
-		e_cal_source_type_enum_type =
-			g_enum_register_static ("ECalSourceTypeEnum", values);
+		enum_type = g_enum_register_static ("ECalSourceTypeEnum", values);
+		g_once_init_leave (&enum_type__volatile, enum_type);
 	}
 
-	return e_cal_source_type_enum_type;
+	return enum_type__volatile;
 }
 
 /**
@@ -304,21 +305,22 @@ e_cal_source_type_enum_get_type (void)
 GType
 e_cal_set_mode_status_enum_get_type (void)
 {
-	static GType e_cal_set_mode_status_enum_type = 0;
+	static volatile gsize enum_type__volatile = 0;
 
-	if (!e_cal_set_mode_status_enum_type) {
+	if (g_once_init_enter (&enum_type__volatile)) {
+		GType enum_type;
 		static GEnumValue values [] = {
 			{ E_CAL_SET_MODE_SUCCESS,          "ECalSetModeSuccess",         "success"     },
 			{ E_CAL_SET_MODE_ERROR,            "ECalSetModeError",           "error"       },
 			{ E_CAL_SET_MODE_NOT_SUPPORTED,    "ECalSetModeNotSupported",    "unsupported" },
-			{ -1,                                   NULL,                              NULL          }
+			{ -1,                                   NULL,                              NULL}
 		};
 
-		e_cal_set_mode_status_enum_type =
-			g_enum_register_static ("ECalSetModeStatusEnum", values);
+		enum_type = g_enum_register_static ("ECalSetModeStatusEnum", values);
+		g_once_init_leave (&enum_type__volatile, enum_type);
 	}
 
-	return e_cal_set_mode_status_enum_type;
+	return enum_type__volatile;
 }
 
 /**
@@ -331,9 +333,10 @@ e_cal_set_mode_status_enum_get_type (void)
 GType
 cal_mode_enum_get_type (void)
 {
-	static GType cal_mode_enum_type = 0;
+	static volatile gsize enum_type__volatile = 0;
 
-	if (!cal_mode_enum_type) {
+	if (g_once_init_enter (&enum_type__volatile)) {
+		GType enum_type;
 		static GEnumValue values [] = {
 			{ CAL_MODE_INVALID,                     "CalModeInvalid",                  "invalid" },
 			{ CAL_MODE_LOCAL,                       "CalModeLocal",                    "local"   },
@@ -342,10 +345,11 @@ cal_mode_enum_get_type (void)
 			{ -1,                                   NULL,                              NULL      }
 		};
 
-		cal_mode_enum_type = g_enum_register_static ("CalModeEnum", values);
+		enum_type = g_enum_register_static ("CalModeEnum", values);
+		g_once_init_leave (&enum_type__volatile, enum_type);
 	}
 
-	return cal_mode_enum_type;
+	return enum_type__volatile;
 }
 
 static EDataCalObjType
diff --git a/calendar/libedata-cal/e-cal-backend-cache.c b/calendar/libedata-cal/e-cal-backend-cache.c
index 33f5fd6..0ac3dd8 100644
--- a/calendar/libedata-cal/e-cal-backend-cache.c
+++ b/calendar/libedata-cal/e-cal-backend-cache.c
@@ -29,6 +29,8 @@
 #include <libecal/e-cal-util.h>
 #include "e-cal-backend-cache.h"
 
+G_DEFINE_TYPE (ECalBackendCache, e_cal_backend_cache, E_TYPE_FILE_CACHE)
+
 struct _ECalBackendCachePrivate {
 	gchar *uri;
 	ECalSourceType source_type;
@@ -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 d3056a2..44118fb 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 d49a4f8..22e589e 100644
--- a/calendar/libedata-cal/e-cal-backend-loader-factory.c
+++ b/calendar/libedata-cal/e-cal-backend-loader-factory.c
@@ -15,10 +15,12 @@
 
 #include "e-cal-backend-loader-factory.h"
 
+G_DEFINE_TYPE (ECalBackendLoaderFactory, e_cal_backend_loader_factory, E_TYPE_CAL_BACKEND_FACTORY)
+
 static GObjectClass *parent_class = NULL;
 
 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 51cc388..6941a24 100644
--- a/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -29,6 +29,8 @@
 
 #include "e-cal-backend-sexp.h"
 
+G_DEFINE_TYPE (ECalBackendSExp, e_cal_backend_sexp, G_TYPE_OBJECT)
+
 static GObjectClass *parent_class;
 
 typedef struct _SearchContext SearchContext;
@@ -1444,34 +1446,3 @@ e_cal_backend_sexp_init (ECalBackendSExp *sexp)
 	sexp->priv = priv;
 	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 c01d904..c0f584c 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -13,6 +13,8 @@
 #include "e-cal-backend-sync.h"
 #include <libical/icaltz-util.h>
 
+G_DEFINE_TYPE (ECalBackendSync, e_cal_backend_sync, E_TYPE_CAL_BACKEND)
+
 struct _ECalBackendSyncPrivate {
 	GMutex *sync_mutex;
 
@@ -1175,34 +1177,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;
-}
diff --git a/libebackend/e-offline-listener.c b/libebackend/e-offline-listener.c
index d7bbc36..b8a3888 100644
--- a/libebackend/e-offline-listener.c
+++ b/libebackend/e-offline-listener.c
@@ -30,6 +30,8 @@
 #include "e-offline-listener.h"
 #include <gconf/gconf-client.h>
 
+G_DEFINE_TYPE (EOfflineListener, e_offline_listener, G_TYPE_OBJECT)
+
 enum {
 	CHANGED,
 	NUM_SIGNALS
@@ -105,7 +107,7 @@ e_offline_listener_new (void)
 }
 
 static void
-eol_dispose (GObject *object)
+e_offline_listener_dispose (GObject *object)
 {
 	EOfflineListener *eol = E_OFFLINE_LISTENER (object);
 	if (eol->priv->default_client) {
@@ -117,7 +119,7 @@ eol_dispose (GObject *object)
 }
 
 static void
-eol_finalize (GObject *object)
+e_offline_listener_finalize (GObject *object)
 {
 	EOfflineListener *eol;
 	EOfflineListenerPrivate *priv;
@@ -132,7 +134,7 @@ eol_finalize (GObject *object)
 }
 
 static void
-eol_init (EOfflineListener *eol)
+e_offline_listener_init (EOfflineListener *eol)
 {
 	EOfflineListenerPrivate *priv;
 
@@ -141,15 +143,15 @@ eol_init (EOfflineListener *eol)
 }
 
 static void
-eol_class_init (EOfflineListenerClass *klass)
+e_offline_listener_class_init (EOfflineListenerClass *klass)
 {
 	GObjectClass *object_class;
 
 	parent_class = g_type_class_peek_parent (klass);
 
 	object_class = G_OBJECT_CLASS (klass);
-	object_class->dispose = eol_dispose;
-	object_class->finalize = eol_finalize;
+	object_class->dispose = e_offline_listener_dispose;
+	object_class->finalize = e_offline_listener_finalize;
 
 	signals[CHANGED] =
 		g_signal_new ("changed",
@@ -161,29 +163,6 @@ eol_class_init (EOfflineListenerClass *klass)
 			      G_TYPE_NONE, 0);
 }
 
-GType
-e_offline_listener_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (EOfflineListenerClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) eol_class_init,
-                        NULL, NULL,
-                        sizeof (EOfflineListener),
-                        0,
-                        (GInstanceInitFunc) eol_init,
-                };
-
-		type = g_type_register_static (G_TYPE_OBJECT, "EOfflineListener", &info, 0);
-	}
-
-	return type;
-}
-
 EOfflineListenerState
 e_offline_listener_get_state (EOfflineListener *eol)
 {
diff --git a/libedataserver/e-proxy.c b/libedataserver/e-proxy.c
index 1c6463f..6980226 100644
--- a/libedataserver/e-proxy.c
+++ b/libedataserver/e-proxy.c
@@ -49,6 +49,8 @@
 #include <libsoup/soup-uri.h>
 #include "e-proxy.h"
 
+G_DEFINE_TYPE (EProxy, e_proxy, G_TYPE_OBJECT)
+
 /* Debug */
 #define d(x)
 
@@ -179,7 +181,7 @@ e_proxy_class_init (EProxyClass *klass)
 }
 
 static void
-e_proxy_init (EProxy *pxy, EProxyClass *klass)
+e_proxy_init (EProxy *pxy)
 {
 	EProxyPrivate *priv;
 
@@ -245,28 +247,6 @@ e_proxy_dispose (GObject *object)
 	}
 }
 
-GType
-e_proxy_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (EProxyClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_proxy_class_init,
-                        NULL, NULL,
-                        sizeof (EProxy),
-                        0,
-                        (GInstanceInitFunc) e_proxy_init
-                };
-		type = g_type_register_static (G_TYPE_OBJECT, "EProxy", &info, 0);
-	}
-
-	return type;
-}
-
 static gboolean
 ep_is_in_ignored (EProxy *proxy, const gchar *host)
 {
diff --git a/libedataserver/e-sexp.c b/libedataserver/e-sexp.c
index 4ad7c2c..c06571a 100644
--- a/libedataserver/e-sexp.c
+++ b/libedataserver/e-sexp.c
@@ -98,6 +98,10 @@
 #define r(x)			/* run debug */
 #define d(x)			/* general debug */
 
+#ifdef E_SEXP_IS_G_OBJECT
+G_DEFINE_TYPE (ESExp, e_sexp, G_TYPE_OBJECT)
+#endif
+
 static struct _ESExpTerm * parse_list(ESExp *f, gint gotbrace);
 static struct _ESExpTerm * parse_value(ESExp *f);
 
@@ -1137,32 +1141,6 @@ e_sexp_init (ESExp *s)
 #endif
 }
 
-#ifdef E_SEXP_IS_G_OBJECT
-GType
-e_sexp_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static const GTypeInfo info = {
-			sizeof (ESExpClass),
-			NULL, /* base_class_init */
-			NULL, /* base_class_finalize */
-			(GClassInitFunc) e_sexp_class_init,
-			NULL, /* class_finalize */
-			NULL, /* class_data */
-			sizeof (ESExp),
-			0,    /* n_preallocs */
-			(GInstanceInitFunc) e_sexp_init,
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT, "ESExp", &info, 0);
-	}
-
-	return type;
-}
-#endif
-
 ESExp *
 e_sexp_new (void)
 {
diff --git a/libedataserver/e-source-list.c b/libedataserver/e-source-list.c
index 5f3a9d3..610fe33 100644
--- a/libedataserver/e-source-list.c
+++ b/libedataserver/e-source-list.c
@@ -334,26 +334,12 @@ e_source_list_init (ESourceList *source_list)
 	source_list->priv = priv;
 }
 
-/* returns the type */
-static GType
-get_source_list_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		if (!(type = g_type_from_name ("ESourceList")))
-			type = e_source_list_get_type ();
-	}
-
-	return type;
-}
-
 /* Public methods.  */
 
 ESourceList *
 e_source_list_new (void)
 {
-	ESourceList *list = g_object_new (get_source_list_type (), NULL);
+	ESourceList *list = g_object_new (e_source_list_get_type (), NULL);
 
 	return list;
 }
@@ -367,7 +353,7 @@ e_source_list_new_for_gconf (GConfClient *client,
 	g_return_val_if_fail (GCONF_IS_CLIENT (client), NULL);
 	g_return_val_if_fail (path != NULL, NULL);
 
-	list = g_object_new (get_source_list_type (), NULL);
+	list = g_object_new (e_source_list_get_type (), NULL);
 
 	list->priv->gconf_path = g_strdup (path);
 	list->priv->gconf_client = client;
@@ -391,7 +377,7 @@ e_source_list_new_for_gconf_default (const gchar  *path)
 
 	g_return_val_if_fail (path != NULL, NULL);
 
-	list = g_object_new (get_source_list_type (), NULL);
+	list = g_object_new (e_source_list_get_type (), NULL);
 
 	list->priv->gconf_path = g_strdup (path);
 	list->priv->gconf_client = gconf_client_get_default ();
diff --git a/libedataserverui/e-categories-dialog.c b/libedataserverui/e-categories-dialog.c
index ad54053..3d81213 100644
--- a/libedataserverui/e-categories-dialog.c
+++ b/libedataserverui/e-categories-dialog.c
@@ -34,6 +34,8 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_CATEGORIES_DIALOG, ECategoriesDialogPrivate))
 
+G_DEFINE_TYPE (ECategoriesDialog, e_categories_dialog, GTK_TYPE_DIALOG)
+
 struct _ECategoriesDialogPrivate {
 	GtkBuilder *gui;
 	GtkWidget *categories_entry;
@@ -578,7 +580,7 @@ categories_dialog_finalize (GObject *object)
 }
 
 static void
-categories_dialog_class_init (ECategoriesDialogClass *class)
+e_categories_dialog_class_init (ECategoriesDialogClass *class)
 {
 	GObjectClass *object_class;
 
@@ -591,7 +593,7 @@ categories_dialog_class_init (ECategoriesDialogClass *class)
 }
 
 static void
-categories_dialog_init (ECategoriesDialog *dialog)
+e_categories_dialog_init (ECategoriesDialog *dialog)
 {
 	GtkCellRenderer *renderer;
 	GtkEntryCompletion *completion;
@@ -690,32 +692,6 @@ categories_dialog_init (ECategoriesDialog *dialog)
 		G_CALLBACK (categories_dialog_listener_cb), dialog);
 }
 
-GType
-e_categories_dialog_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0)) {
-		static const GTypeInfo type_info = {
-			sizeof (ECategoriesDialogClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) categories_dialog_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,  /* class_data */
-			sizeof (ECategoriesDialog),
-			0,     /* n_preallocs */
-			(GInstanceInitFunc) categories_dialog_init,
-			NULL   /* value_table */
-		};
-
-		type = g_type_register_static (
-			GTK_TYPE_DIALOG, "ECategoriesDialog", &type_info, 0);
-	}
-
-	return type;
-}
-
 /**
  * e_categories_dialog_new:
  * @categories: Comma-separated list of categories
diff --git a/libedataserverui/e-category-completion.c b/libedataserverui/e-category-completion.c
index e0ce6fd..788669f 100644
--- a/libedataserverui/e-category-completion.c
+++ b/libedataserverui/e-category-completion.c
@@ -29,6 +29,8 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_CATEGORY_COMPLETION, ECategoryCompletionPrivate))
 
+G_DEFINE_TYPE (ECategoryCompletion, e_category_completion, GTK_TYPE_ENTRY_COMPLETION)
+
 struct _ECategoryCompletionPrivate {
 	GtkWidget *last_known_entry;
 	gchar *create;
@@ -424,7 +426,7 @@ category_completion_action_activated (GtkEntryCompletion *completion,
 }
 
 static void
-category_completion_class_init (ECategoryCompletionClass *class)
+e_category_completion_class_init (ECategoryCompletionClass *class)
 {
 	GObjectClass *object_class;
 	GtkEntryCompletionClass *entry_completion_class;
@@ -442,7 +444,7 @@ category_completion_class_init (ECategoryCompletionClass *class)
 }
 
 static void
-category_completion_init (ECategoryCompletion *category_completion)
+e_category_completion_init (ECategoryCompletion *category_completion)
 {
 	GtkCellRenderer *renderer;
 	GtkEntryCompletion *completion;
@@ -474,33 +476,6 @@ category_completion_init (ECategoryCompletion *category_completion)
 	category_completion_build_model (completion);
 }
 
-GType
-e_category_completion_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0)) {
-		static const GTypeInfo type_info = {
-			sizeof (ECategoryCompletionClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) category_completion_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,  /* class_data */
-			sizeof (ECategoryCompletion),
-			0,     /* n_preallocs */
-			(GInstanceInitFunc) category_completion_init,
-			NULL   /* value_table */
-		};
-
-		type = g_type_register_static (
-			GTK_TYPE_ENTRY_COMPLETION, "ECategoryCompletion",
-			&type_info, 0);
-	}
-
-	return type;
-}
-
 GtkEntryCompletion *
 e_category_completion_new (void)
 {
diff --git a/libedataserverui/e-contact-store.c b/libedataserverui/e-contact-store.c
index 2c1d873..bb9ef72 100644
--- a/libedataserverui/e-contact-store.c
+++ b/libedataserverui/e-contact-store.c
@@ -36,9 +36,11 @@ G_STMT_START {                                            \
 	(iter)->user_data = GINT_TO_POINTER (index);        \
 } G_STMT_END
 
-static void         e_contact_store_init            (EContactStore      *contact_store);
-static void         e_contact_store_class_init      (EContactStoreClass *class);
-static void         e_contact_store_tree_model_init (GtkTreeModelIface  *iface);
+static void e_contact_store_tree_model_init (GtkTreeModelIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (EContactStore, e_contact_store, G_TYPE_OBJECT, 0,
+	G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, e_contact_store_tree_model_init))
+
 static void         e_contact_store_finalize        (GObject            *object);
 static GtkTreeModelFlags e_contact_store_get_flags       (GtkTreeModel       *tree_model);
 static gint         e_contact_store_get_n_columns   (GtkTreeModel       *tree_model);
@@ -92,42 +94,6 @@ static void stop_view             (EContactStore *contact_store, EBookView *view
 
 static GObjectClass *parent_class = NULL;
 
-GType
-e_contact_store_get_type (void)
-{
-	static GType contact_store_type = 0;
-
-	if (!contact_store_type) {
-		static const GTypeInfo contact_store_info =
-		{
-			sizeof (EContactStoreClass),
-			NULL,		/* base_init */
-			NULL,		/* base_finalize */
-			(GClassInitFunc) e_contact_store_class_init,
-			NULL,		/* class_finalize */
-			NULL,		/* class_data */
-			sizeof (EContactStore),
-			0,
-			(GInstanceInitFunc) e_contact_store_init,
-		};
-
-		static const GInterfaceInfo tree_model_info =
-		{
-			(GInterfaceInitFunc) e_contact_store_tree_model_init,
-			NULL,
-			NULL
-		};
-
-		contact_store_type = g_type_register_static (G_TYPE_OBJECT, "EContactStore",
-							     &contact_store_info, 0);
-		g_type_add_interface_static (contact_store_type,
-					     GTK_TYPE_TREE_MODEL,
-					     &tree_model_info);
-	}
-
-	return contact_store_type;
-}
-
 static void
 e_contact_store_class_init (EContactStoreClass *class)
 {
diff --git a/libedataserverui/e-destination-store.c b/libedataserverui/e-destination-store.c
index f58eceb..de546bc 100644
--- a/libedataserverui/e-destination-store.c
+++ b/libedataserverui/e-destination-store.c
@@ -36,9 +36,17 @@ G_STMT_START {                                        \
 	(iter)->user_data = GINT_TO_POINTER (index);  \
 } G_STMT_END
 
-static void         e_destination_store_init            (EDestinationStore      *destination_store);
-static void         e_destination_store_class_init      (EDestinationStoreClass *class);
-static void         e_destination_store_tree_model_init (GtkTreeModelIface  *iface);
+static GType column_types [E_DESTINATION_STORE_NUM_COLUMNS];
+
+static void e_destination_store_tree_model_init (GtkTreeModelIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (EDestinationStore, e_destination_store, G_TYPE_OBJECT, 0,
+	G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, e_destination_store_tree_model_init);
+	column_types [E_DESTINATION_STORE_COLUMN_NAME]    = G_TYPE_STRING;
+	column_types [E_DESTINATION_STORE_COLUMN_EMAIL]   = G_TYPE_STRING;
+	column_types [E_DESTINATION_STORE_COLUMN_ADDRESS] = G_TYPE_STRING;
+	)
+
 static void         e_destination_store_finalize        (GObject            *object);
 static GtkTreeModelFlags e_destination_store_get_flags       (GtkTreeModel       *tree_model);
 static gint         e_destination_store_get_n_columns   (GtkTreeModel       *tree_model);
@@ -76,47 +84,6 @@ static void stop_destination    (EDestinationStore *destination_store, EDestinat
  * ------------------ */
 
 static GObjectClass *parent_class = NULL;
-static GType         column_types [E_DESTINATION_STORE_NUM_COLUMNS];
-
-GType
-e_destination_store_get_type (void)
-{
-	static GType destination_store_type = 0;
-
-	if (!destination_store_type) {
-		static const GTypeInfo destination_store_info =
-		{
-			sizeof (EDestinationStoreClass),
-			NULL,		/* base_init */
-			NULL,		/* base_finalize */
-			(GClassInitFunc) e_destination_store_class_init,
-			NULL,		/* class_finalize */
-			NULL,		/* class_data */
-			sizeof (EDestinationStore),
-			0,
-			(GInstanceInitFunc) e_destination_store_init,
-		};
-
-		static const GInterfaceInfo tree_model_info =
-		{
-			(GInterfaceInitFunc) e_destination_store_tree_model_init,
-			NULL,
-			NULL
-		};
-
-		column_types [E_DESTINATION_STORE_COLUMN_NAME]    = G_TYPE_STRING;
-		column_types [E_DESTINATION_STORE_COLUMN_EMAIL]   = G_TYPE_STRING;
-		column_types [E_DESTINATION_STORE_COLUMN_ADDRESS] = G_TYPE_STRING;
-
-		destination_store_type = g_type_register_static (G_TYPE_OBJECT, "EDestinationStore",
-								 &destination_store_info, 0);
-		g_type_add_interface_static (destination_store_type,
-					     GTK_TYPE_TREE_MODEL,
-					     &tree_model_info);
-	}
-
-	return destination_store_type;
-}
 
 static void
 e_destination_store_class_init (EDestinationStoreClass *class)
diff --git a/libedataserverui/e-source-combo-box.c b/libedataserverui/e-source-combo-box.c
index 35d2af9..04f365f 100644
--- a/libedataserverui/e-source-combo-box.c
+++ b/libedataserverui/e-source-combo-box.c
@@ -29,6 +29,8 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_SOURCE_COMBO_BOX, ESourceComboBoxPrivate))
 
+G_DEFINE_TYPE (ESourceComboBox, e_source_combo_box, GTK_TYPE_COMBO_BOX)
+
 struct _ESourceComboBoxPrivate {
 	ESourceList *source_list;
 	GHashTable *uid_index;
@@ -337,32 +339,6 @@ e_source_combo_box_init (ESourceComboBox *source_combo_box)
 			(GDestroyNotify) gtk_tree_row_reference_free);
 }
 
-GType
-e_source_combo_box_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY (type == 0)) {
-		static const GTypeInfo type_info = {
-			sizeof (ESourceComboBoxClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_source_combo_box_class_init,
-			(GClassFinalizeFunc) NULL,
-			NULL,  /* class_data */
-			sizeof (ESourceComboBox),
-			0,     /* n_preallocs */
-			(GInstanceInitFunc) e_source_combo_box_init,
-			NULL   /* value_table */
-		};
-
-		type = g_type_register_static (
-			GTK_TYPE_COMBO_BOX, "ESourceComboBox", &type_info, 0);
-	}
-
-	return type;
-}
-
 /**
  * e_source_combo_box_new:
  * @source_list: an #ESourceList
diff --git a/libedataserverui/e-tree-model-generator.c b/libedataserverui/e-tree-model-generator.c
index 975e88d..3d666bd 100644
--- a/libedataserverui/e-tree-model-generator.c
+++ b/libedataserverui/e-tree-model-generator.c
@@ -44,9 +44,11 @@ G_STMT_START {                                              \
 	(iter)->user_data2 = GINT_TO_POINTER (index);       \
 } G_STMT_END
 
-static void         e_tree_model_generator_init            (ETreeModelGenerator      *tree_model_generator);
-static void         e_tree_model_generator_class_init      (ETreeModelGeneratorClass *class);
-static void         e_tree_model_generator_tree_model_init (GtkTreeModelIface  *iface);
+static void e_tree_model_generator_tree_model_init (GtkTreeModelIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (ETreeModelGenerator, e_tree_model_generator, G_TYPE_OBJECT, 0,
+	G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, e_tree_model_generator_tree_model_init))
+
 static void         e_tree_model_generator_finalize        (GObject            *object);
 static GtkTreeModelFlags e_tree_model_generator_get_flags       (GtkTreeModel       *tree_model);
 static gint         e_tree_model_generator_get_n_columns   (GtkTreeModel       *tree_model);
@@ -155,42 +157,6 @@ e_tree_model_generator_set_property (GObject *object, guint prop_id,
 	}
 }
 
-GType
-e_tree_model_generator_get_type (void)
-{
-	static GType tree_model_generator_type = 0;
-
-	if (!tree_model_generator_type) {
-		static const GTypeInfo tree_model_generator_info =
-		{
-			sizeof (ETreeModelGeneratorClass),
-			NULL,		/* base_init */
-			NULL,		/* base_finalize */
-			(GClassInitFunc) e_tree_model_generator_class_init,
-			NULL,		/* class_finalize */
-			NULL,		/* class_data */
-			sizeof (ETreeModelGenerator),
-			0,
-			(GInstanceInitFunc) e_tree_model_generator_init,
-		};
-
-		static const GInterfaceInfo tree_model_info =
-		{
-			(GInterfaceInitFunc) e_tree_model_generator_tree_model_init,
-			NULL,
-			NULL
-		};
-
-		tree_model_generator_type = g_type_register_static (G_TYPE_OBJECT, "ETreeModelGenerator",
-								    &tree_model_generator_info, 0);
-		g_type_add_interface_static (tree_model_generator_type,
-					     GTK_TYPE_TREE_MODEL,
-					     &tree_model_info);
-	}
-
-	return tree_model_generator_type;
-}
-
 static void
 e_tree_model_generator_class_init (ETreeModelGeneratorClass *class)
 {
diff --git a/servers/google/libgdata-google/gdata-google-service.c b/servers/google/libgdata-google/gdata-google-service.c
index 1d4b1ab..c3cfa50 100644
--- a/servers/google/libgdata-google/gdata-google-service.c
+++ b/servers/google/libgdata-google/gdata-google-service.c
@@ -31,6 +31,11 @@
 
 #define GDATA_GOOGLE_SERVICE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDATA_TYPE_GOOGLE_SERVICE, GDataGoogleServicePrivate))
 
+static void gdata_google_service_iface_init (GDataServiceIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (GDataGoogleService, gdata_google_service, G_TYPE_OBJECT, 0,
+	G_IMPLEMENT_INTERFACE (GDATA_TYPE_SERVICE, gdata_google_service_iface_init))
+
 static GDataEntry * gdata_google_service_update_entry_with_link (GDataService *service, GDataEntry *entry, const gchar *edit_link, GError **error);
 static GDataEntry * gdata_google_service_insert_entry (GDataService *service, const gchar *feed_url, GDataEntry *entry, GError **error);
 static gboolean     gdata_google_service_delete_entry (GDataService *service, GDataEntry *entry, GError **error);
@@ -424,10 +429,9 @@ gdata_google_service_update_entry_with_link (GDataService *service, GDataEntry *
 	return updated_entry;
 }
 
-static void gdata_google_service_iface_init(gpointer  g_iface, gpointer iface_data)
+static void
+gdata_google_service_iface_init (GDataServiceIface *iface)
 {
-	GDataServiceIface *iface = (GDataServiceIface *)g_iface;
-
 	iface->set_proxy = gdata_google_service_set_proxy;
 	iface->set_credentials = gdata_google_service_set_credentials;
 	iface->get_feed = gdata_google_service_get_feed;
@@ -438,11 +442,11 @@ static void gdata_google_service_iface_init(gpointer  g_iface, gpointer iface_da
 	return;
 }
 
-static void gdata_google_service_instance_init(GTypeInstance *instance,
-		gpointer      g_class)
+static void
+gdata_google_service_init (GDataGoogleService *instance)
 {
 	GDataGoogleServicePrivate *priv;
-	GDataGoogleService *self = (GDataGoogleService *)instance;
+	GDataGoogleService *self = instance;
 
 	/* Private data set by g_type_class_add_private */
 	priv = GDATA_GOOGLE_SERVICE_GET_PRIVATE(self);
@@ -569,11 +573,9 @@ static void gdata_google_service_set_property (GObject *obj,
 	}
 }
 
-static void gdata_google_service_class_init(gpointer g_class,
-		gpointer g_class_data)
+static void gdata_google_service_class_init (GDataGoogleServiceClass *klass)
 {
-	GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
-	GDataGoogleServiceClass *klass = GDATA_GOOGLE_SERVICE_CLASS(g_class);
+	GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
 	g_type_class_add_private(klass, sizeof (GDataGoogleServicePrivate));
 
@@ -605,44 +607,6 @@ static void gdata_google_service_class_init(gpointer g_class,
 	return;
 }
 
-GType  gdata_google_service_get_type (void)
-{
-	static GType type = 0;
-
-	if (G_UNLIKELY(type == 0))
-	{
-		static const GTypeInfo info =
-		{
-			sizeof (GDataGoogleServiceClass),
-			NULL,   /* base_init */
-			NULL,   /* base_finalize */
-			(GClassInitFunc) gdata_google_service_class_init, /* class_init */
-			NULL,   /* class_finalize */
-			NULL,   /* class_data */
-			sizeof (GDataGoogleService),
-			0,      /* n_preallocs */
-			gdata_google_service_instance_init    /* instance_init */
-		};
-
-		static const GInterfaceInfo gdata_google_service_iface_info =
-		{
-			(GInterfaceInitFunc) gdata_google_service_iface_init, /* interface_init */
-			NULL,         /* interface_finalize */
-			NULL          /* interface_data */
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT,
-				"GDataGoogleServiceType",
-				&info, 0);
-
-		g_type_add_interface_static (type, GDATA_TYPE_SERVICE,
-				&gdata_google_service_iface_info);
-
-	}
-
-	return type;
-}
-
 /*********API******* */
 
 /**
diff --git a/servers/google/libgdata/gdata-entry.c b/servers/google/libgdata/gdata-entry.c
index 87bc032..ab69eb0 100644
--- a/servers/google/libgdata/gdata-entry.c
+++ b/servers/google/libgdata/gdata-entry.c
@@ -35,6 +35,8 @@
 
 #define GDATA_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDATA_TYPE_ENTRY, GDataEntryPrivate))
 
+G_DEFINE_TYPE (GDataEntry, gdata_entry, G_TYPE_OBJECT)
+
 struct _GDataEntryPrivate {
 	GSList *authors;
 	GSList *categories;
@@ -172,11 +174,10 @@ static void destroy_postal_address (gpointer data, gpointer user_data)
 	g_free (address);
 }
 
-static void gdata_entry_init (GTypeInstance *instance,
-		gpointer      g_class)
+static void gdata_entry_init (GDataEntry *instance)
 {
+	GDataEntry *self = instance;
 	GDataEntryPrivate *priv;
-	GDataEntry *self = (GDataEntry *)instance;
 
 	/* Private data set by g_type_class_add_private */
 	priv = GDATA_ENTRY_GET_PRIVATE(self);
@@ -290,11 +291,9 @@ static void gdata_entry_set_property (GObject *obj,
 	priv = GDATA_ENTRY_GET_PRIVATE(self);
 }
 
-static void gdata_entry_class_init (gpointer g_class,
-		gpointer g_class_data)
+static void gdata_entry_class_init (GDataEntryClass *klass)
 {
-	GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
-	GDataEntryClass *klass = GDATA_ENTRY_CLASS(g_class);
+	GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
 
 	g_type_class_add_private(klass, sizeof (GDataEntryPrivate));
 	gobject_class->set_property = gdata_entry_set_property;
@@ -303,27 +302,6 @@ static void gdata_entry_class_init (gpointer g_class,
 	gobject_class->finalize = gdata_entry_finalize;
 }
 
-GType gdata_entry_get_type (void)
-{
-	static GType type = 0;
-	if (type == 0) {
-		static const GTypeInfo info = {
-			sizeof (GDataEntryClass),
-			NULL, /* base init */
-			NULL, /* base finalize */
-			gdata_entry_class_init, /* class init */
-			NULL, /* class finalize */
-			NULL, /* class data */
-			sizeof (GDataEntry),
-			0, /* n_preallocs */
-			gdata_entry_init /* instance init */
-		};
-		type = g_type_register_static(G_TYPE_OBJECT,"GDataEntryType", &info,0);
-	}
-
-	return type;
-}
-
 /*** API ***/
 static GDataEntryAuthor *
 xmlnode_to_author (xmlDocPtr doc, xmlNodePtr cur)
diff --git a/servers/google/libgdata/gdata-feed.c b/servers/google/libgdata/gdata-feed.c
index dad83d8..712d800 100644
--- a/servers/google/libgdata/gdata-feed.c
+++ b/servers/google/libgdata/gdata-feed.c
@@ -36,6 +36,8 @@
 
 #define GDATA_FEED_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDATA_TYPE_FEED, GDataFeedPrivate))
 
+G_DEFINE_TYPE (GDataFeed, gdata_feed, G_TYPE_OBJECT)
+
 struct _GDataFeedAuthor {
 	gchar *email;
 	gchar *name;
@@ -149,13 +151,11 @@ static void destroy_entries(gpointer data, gpointer user_data)
 }
 
 static void
-gdata_feed_init(GTypeInstance *instance,
-		gpointer      g_class)
+gdata_feed_init (GDataFeed *instance)
 {
+	GDataFeed *self = instance;
 	GDataFeedPrivate *priv;
 
-	GDataFeed *self = (GDataFeed *)instance;
-
 	/* Private data set by g_type_class_add_private */
 	priv = GDATA_FEED_GET_PRIVATE(self);
 	priv->dispose_has_run = FALSE;
@@ -294,11 +294,9 @@ static GObject * gdata_feed_constructor(GType type,
 }
 
 static void
-gdata_feed_class_init(gpointer g_class,
-		gpointer g_class_data)
+gdata_feed_class_init (GDataFeedClass *klass)
 {
-	GObjectClass *gobject_class = G_OBJECT_CLASS(g_class);
-	GDataFeedClass *klass = GDATA_FEED_CLASS(g_class);
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
 	g_type_class_add_private(klass, sizeof (GDataFeedPrivate));
 
@@ -308,27 +306,6 @@ gdata_feed_class_init(gpointer g_class,
 	gobject_class->dispose     = gdata_feed_dispose;
 	gobject_class->finalize    = gdata_feed_finalize;
 	gobject_class->constructor = gdata_feed_constructor;
-
-}
-
-GType gdata_feed_get_type(void)
-{
-  static GType type = 0;
-  if (type == 0) {
-    static const GTypeInfo info = {
-      sizeof (GDataFeedClass),
-      NULL, /* base init */
-      NULL, /* base finalize */
-      gdata_feed_class_init, /* class init */
-      NULL, /* class finalize */
-      NULL, /* class data */
-      sizeof (GDataFeed),
-      0, /* n_preallocs */
-      gdata_feed_init /* instance init */
-    };
-    type = g_type_register_static(G_TYPE_OBJECT,"GDataFeedType", &info,0);
-  }
-  return type;
 }
 
 /*** API ***/
diff --git a/servers/google/libgdata/gdata-service-iface.c b/servers/google/libgdata/gdata-service-iface.c
index fe8e663..4fa9e15 100644
--- a/servers/google/libgdata/gdata-service-iface.c
+++ b/servers/google/libgdata/gdata-service-iface.c
@@ -87,10 +87,9 @@ gdata_service_base_init (gpointer g_class)
 GType
 gdata_service_get_type (void)
 {
-	static GType type = 0;
+        static volatile gsize define_type_id__volatile = 0;
 
-	if (G_UNLIKELY(type == 0))
-	{
+	if (g_once_init_enter (&define_type_id__volatile)) {
 		static const GTypeInfo info =
 		{
 			sizeof (GDataServiceIface),
@@ -103,10 +102,12 @@ gdata_service_get_type (void)
 			0,      /* n_preallocs */
 			NULL    /* instance_init */
 		};
-		type = g_type_register_static (G_TYPE_INTERFACE,
-				"GDataService", &info, 0);
-		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT );
+		GType type = g_type_register_static (G_TYPE_INTERFACE, "GDataService", &info, 0);
+
+		g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+
+		g_once_init_leave (&define_type_id__volatile, type);
 	}
 
-	return type;
+	return define_type_id__volatile;
 }
diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c
index 6f923b6..6ee881d 100644
--- a/servers/groupwise/e-gw-connection.c
+++ b/servers/groupwise/e-gw-connection.c
@@ -41,6 +41,8 @@
 /* Soup session proxy-uri property */
 #define SOUP_SESSION_PROXY_URI "proxy-uri"
 
+G_DEFINE_TYPE (EGwConnection, e_gw_connection, G_TYPE_OBJECT)
+
 static GObjectClass *parent_class = NULL;
 static GHashTable *loaded_connections_permissions = NULL;
 
@@ -422,7 +424,7 @@ e_gw_connection_class_init (EGwConnectionClass *klass)
 }
 
 static void
-e_gw_connection_init (EGwConnection *cnc, EGwConnectionClass *klass)
+e_gw_connection_init (EGwConnection *cnc)
 {
 	EGwConnectionPrivate *priv;
 	guint timeout = GW_SOUP_SESSION_TIMEOUT;
@@ -465,28 +467,6 @@ e_gw_connection_init (EGwConnection *cnc, EGwConnectionClass *klass)
 	*/
 }
 
-GType
-e_gw_connection_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (EGwConnectionClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_gw_connection_class_init,
-                        NULL, NULL,
-                        sizeof (EGwConnection),
-                        0,
-                        (GInstanceInitFunc) e_gw_connection_init
-                };
-		type = g_type_register_static (G_TYPE_OBJECT, "EGwConnection", &info, 0);
-	}
-
-	return type;
-}
-
 static SoupSoapMessage*
 form_login_request (const gchar *uri, const gchar * username, const gchar * password)
 {
diff --git a/servers/groupwise/e-gw-container.c b/servers/groupwise/e-gw-container.c
index 3dd5b61..b96c151 100644
--- a/servers/groupwise/e-gw-container.c
+++ b/servers/groupwise/e-gw-container.c
@@ -28,6 +28,8 @@
 #include "e-gw-container.h"
 #include "e-gw-message.h"
 
+G_DEFINE_TYPE (EGwContainer, e_gw_container, G_TYPE_OBJECT)
+
 struct _EGwContainerPrivate {
 	gchar *name;
 	gchar *id;
@@ -137,7 +139,7 @@ e_gw_container_class_init (EGwContainerClass *klass)
 }
 
 static void
-e_gw_container_init (EGwContainer *container, EGwContainerClass *klass)
+e_gw_container_init (EGwContainer *container)
 {
 	EGwContainerPrivate *priv;
 
@@ -148,28 +150,6 @@ e_gw_container_init (EGwContainer *container, EGwContainerClass *klass)
 	container->priv = priv;
 }
 
-GType
-e_gw_container_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (EGwContainerClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_gw_container_class_init,
-                        NULL, NULL,
-                        sizeof (EGwContainer),
-                        0,
-                        (GInstanceInitFunc) e_gw_container_init
-                };
-		type = g_type_register_static (G_TYPE_OBJECT, "EGwContainer", &info, 0);
-	}
-
-	return type;
-}
-
 EGwContainer *
 e_gw_container_new_from_soap_parameter (SoupSoapParameter *param)
 {
diff --git a/servers/groupwise/e-gw-filter.c b/servers/groupwise/e-gw-filter.c
index 6cc9e18..77b0c45 100644
--- a/servers/groupwise/e-gw-filter.c
+++ b/servers/groupwise/e-gw-filter.c
@@ -28,6 +28,8 @@
 #include "e-gw-filter.h"
 #include "e-gw-message.h"
 
+G_DEFINE_TYPE (EGwFilter, e_gw_filter, G_TYPE_OBJECT)
+
 static GObjectClass *parent_class = NULL;
 
 struct _FilterComponent {
@@ -232,7 +234,7 @@ e_gw_filter_dispose (GObject *object)
 }
 
 static void
-e_gw_filter_init (EGwFilter *filter, EGwFilterClass *klass)
+e_gw_filter_init (EGwFilter *filter)
 {
 	EGwFilterPrivate *priv;
 
@@ -252,28 +254,6 @@ e_gw_filter_class_init (EGwFilterClass *klass)
 	object_class->finalize = e_gw_filter_finalize;
 }
 
-GType
-e_gw_filter_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-			sizeof (EGwFilterClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_gw_filter_class_init,
-			NULL, NULL,
-			sizeof (EGwFilter),
-			0,
-			(GInstanceInitFunc) e_gw_filter_init
-		};
-		type = g_type_register_static (G_TYPE_OBJECT, "EGwFilter", &info, 0);
-	}
-
-	return type;
-}
-
 EGwFilter *
 e_gw_filter_new (void)
 {
diff --git a/servers/groupwise/e-gw-item.c b/servers/groupwise/e-gw-item.c
index 09748b1..66bc49a 100644
--- a/servers/groupwise/e-gw-item.c
+++ b/servers/groupwise/e-gw-item.c
@@ -32,6 +32,8 @@
 #include "e-gw-connection.h"
 #include "e-gw-message.h"
 
+G_DEFINE_TYPE (EGwItem, e_gw_item, G_TYPE_OBJECT)
+
 struct _EGwItemPrivate {
 	EGwItemType item_type;
 	gchar *container;
@@ -537,7 +539,7 @@ e_gw_item_class_init (EGwItemClass *klass)
 }
 
 static void
-e_gw_item_init (EGwItem *item, EGwItemClass *klass)
+e_gw_item_init (EGwItem *item)
 {
 	EGwItemPrivate *priv;
 
@@ -585,28 +587,6 @@ e_gw_item_init (EGwItem *item, EGwItemClass *klass)
 
 }
 
-GType
-e_gw_item_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-			sizeof (EGwItemClass),
-			(GBaseInitFunc) NULL,
-			(GBaseFinalizeFunc) NULL,
-			(GClassInitFunc) e_gw_item_class_init,
-			NULL, NULL,
-			sizeof (EGwItem),
-			0,
-			(GInstanceInitFunc) e_gw_item_init
-		};
-		type = g_type_register_static (G_TYPE_OBJECT, "EGwItem", &info, 0);
-	}
-
-	return type;
-}
-
 void
 e_gw_item_free_cal_id (EGwItemCalId *calid)
 {
diff --git a/servers/groupwise/e-gw-sendoptions.c b/servers/groupwise/e-gw-sendoptions.c
index 292f715..aace978 100644
--- a/servers/groupwise/e-gw-sendoptions.c
+++ b/servers/groupwise/e-gw-sendoptions.c
@@ -29,6 +29,8 @@
 #include "e-gw-sendoptions.h"
 #include "e-gw-message.h"
 
+G_DEFINE_TYPE (EGwSendOptions, e_gw_sendoptions, G_TYPE_OBJECT)
+
 struct _EGwSendOptionsPrivate {
 	EGwSendOptionsGeneral *gopts;
 	EGwSendOptionsStatusTracking *mopts;
@@ -39,10 +41,6 @@ struct _EGwSendOptionsPrivate {
 static GObjectClass *parent_class = NULL;
 
 static gboolean e_gw_sendoptions_store_settings (SoupSoapParameter *param, EGwSendOptions *opts);
-static void e_gw_sendoptions_init (GObject *object);
-static void e_gw_sendoptions_class_init (GObjectClass *klass);
-static void e_gw_sendoptions_dispose (GObject *object);
-static void e_gw_sendoptions_finalize (GObject *object);
 
 EGwSendOptionsGeneral*
 e_gw_sendoptions_get_general_options (EGwSendOptions *opts)
@@ -119,7 +117,7 @@ e_gw_sendoptions_finalize (GObject *object)
 }
 
 static void
-e_gw_sendoptions_class_init (GObjectClass *klass)
+e_gw_sendoptions_class_init (EGwSendOptionsClass *klass)
 {
 	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
@@ -130,13 +128,10 @@ e_gw_sendoptions_class_init (GObjectClass *klass)
 }
 
 static void
-e_gw_sendoptions_init (GObject *object)
+e_gw_sendoptions_init (EGwSendOptions *opts)
 {
-	EGwSendOptions *opts;
 	EGwSendOptionsPrivate *priv;
 
-	opts = E_GW_SENDOPTIONS (object);
-
 	/* allocate internal structure */
 	priv = g_new0 (EGwSendOptionsPrivate, 1);
 	priv->gopts = g_new0 (EGwSendOptionsGeneral, 1);
@@ -146,29 +141,6 @@ e_gw_sendoptions_init (GObject *object)
 	opts->priv = priv;
 }
 
-GType
-e_gw_sendoptions_get_type (void)
-{
-	static GType type = 0;
-
-	if (!type) {
-		static GTypeInfo info = {
-                        sizeof (EGwSendOptionsClass),
-                        NULL,
-                        NULL,
-                        (GClassInitFunc) e_gw_sendoptions_class_init,
-                        NULL, NULL,
-                        sizeof (EGwSendOptions),
-                        0,
-                        (GInstanceInitFunc) e_gw_sendoptions_init,
-			NULL
-                };
-		type = g_type_register_static (G_TYPE_OBJECT, "EGwSendOptions", &info, 0);
-	}
-
-	return type;
-}
-
 static void
 parse_status_tracking_options (SoupSoapParameter *group_param, guint i, EGwSendOptionsStatusTracking *sopts)
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]