[evolution-data-server] Use g_type_ensure() where applicable.



commit f28dd62c5ec41791227cc0e8293f5c205332779a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Nov 9 07:49:33 2012 -0500

    Use g_type_ensure() where applicable.

 libedataserver/e-source-registry.c |    8 +-----
 libedataserver/e-source.c          |   53 ++++++++++++++++-------------------
 2 files changed, 25 insertions(+), 36 deletions(-)
---
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index cbaf89b..4c9c572 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -87,12 +87,6 @@
 #define E_SETTINGS_DEFAULT_MEMO_LIST_KEY	"default-memo-list"
 #define E_SETTINGS_DEFAULT_TASK_LIST_KEY	"default-task-list"
 
-/* This forces the GType to be registered in a way that
- * avoids a "statement with no effect" compiler warning.
- * FIXME Use g_type_ensure() once we require GLib 2.34. */
-#define REGISTER_TYPE(type) \
-	(g_type_class_unref (g_type_class_ref (type)))
-
 typedef struct _AsyncContext AsyncContext;
 typedef struct _AuthContext AuthContext;
 typedef struct _CreateContext CreateContext;
@@ -1365,7 +1359,7 @@ e_source_registry_new_sync (GCancellable *cancellable,
 	/* XXX Work around http://bugzilla.gnome.org/show_bug.cgi?id=683519
 	 *     until GObject's type initialization deadlock issue is fixed.
 	 *     Apparently only the synchronous instantiation is affected. */
-	REGISTER_TYPE (G_TYPE_DBUS_CONNECTION);
+	g_type_ensure (G_TYPE_DBUS_CONNECTION);
 
 	return g_initable_new (
 		E_TYPE_SOURCE_REGISTRY,
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 75eb7f6..ad17708 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -102,11 +102,6 @@
 	(G_TYPE_INSTANCE_GET_PRIVATE \
 	((obj), E_TYPE_SOURCE, ESourcePrivate))
 
-/* This forces the GType to be registered in a way that
- * avoids a "statement with no effect" compiler warning. */
-#define REGISTER_TYPE(type) \
-	(g_type_class_unref (g_type_class_ref (type)))
-
 #define PRIMARY_GROUP_NAME	"Data Source"
 
 typedef struct _AsyncContext AsyncContext;
@@ -1510,30 +1505,30 @@ e_source_class_init (ESourceClass *class)
 		G_TYPE_NONE, 0);
 
 	/* Register built-in ESourceExtension types. */
-	REGISTER_TYPE (E_TYPE_SOURCE_ADDRESS_BOOK);
-	REGISTER_TYPE (E_TYPE_SOURCE_ALARMS);
-	REGISTER_TYPE (E_TYPE_SOURCE_AUTHENTICATION);
-	REGISTER_TYPE (E_TYPE_SOURCE_AUTOCOMPLETE);
-	REGISTER_TYPE (E_TYPE_SOURCE_CALENDAR);
-	REGISTER_TYPE (E_TYPE_SOURCE_COLLECTION);
-	REGISTER_TYPE (E_TYPE_SOURCE_GOA);
-	REGISTER_TYPE (E_TYPE_SOURCE_MAIL_ACCOUNT);
-	REGISTER_TYPE (E_TYPE_SOURCE_MAIL_COMPOSITION);
-	REGISTER_TYPE (E_TYPE_SOURCE_MAIL_IDENTITY);
-	REGISTER_TYPE (E_TYPE_SOURCE_MAIL_SIGNATURE);
-	REGISTER_TYPE (E_TYPE_SOURCE_MAIL_SUBMISSION);
-	REGISTER_TYPE (E_TYPE_SOURCE_MAIL_TRANSPORT);
-	REGISTER_TYPE (E_TYPE_SOURCE_MDN);
-	REGISTER_TYPE (E_TYPE_SOURCE_MEMO_LIST);
-	REGISTER_TYPE (E_TYPE_SOURCE_OFFLINE);
-	REGISTER_TYPE (E_TYPE_SOURCE_OPENPGP);
-	REGISTER_TYPE (E_TYPE_SOURCE_REFRESH);
-	REGISTER_TYPE (E_TYPE_SOURCE_RESOURCE);
-	REGISTER_TYPE (E_TYPE_SOURCE_SECURITY);
-	REGISTER_TYPE (E_TYPE_SOURCE_SELECTABLE);
-	REGISTER_TYPE (E_TYPE_SOURCE_SMIME);
-	REGISTER_TYPE (E_TYPE_SOURCE_TASK_LIST);
-	REGISTER_TYPE (E_TYPE_SOURCE_WEBDAV);
+	g_type_ensure (E_TYPE_SOURCE_ADDRESS_BOOK);
+	g_type_ensure (E_TYPE_SOURCE_ALARMS);
+	g_type_ensure (E_TYPE_SOURCE_AUTHENTICATION);
+	g_type_ensure (E_TYPE_SOURCE_AUTOCOMPLETE);
+	g_type_ensure (E_TYPE_SOURCE_CALENDAR);
+	g_type_ensure (E_TYPE_SOURCE_COLLECTION);
+	g_type_ensure (E_TYPE_SOURCE_GOA);
+	g_type_ensure (E_TYPE_SOURCE_MAIL_ACCOUNT);
+	g_type_ensure (E_TYPE_SOURCE_MAIL_COMPOSITION);
+	g_type_ensure (E_TYPE_SOURCE_MAIL_IDENTITY);
+	g_type_ensure (E_TYPE_SOURCE_MAIL_SIGNATURE);
+	g_type_ensure (E_TYPE_SOURCE_MAIL_SUBMISSION);
+	g_type_ensure (E_TYPE_SOURCE_MAIL_TRANSPORT);
+	g_type_ensure (E_TYPE_SOURCE_MDN);
+	g_type_ensure (E_TYPE_SOURCE_MEMO_LIST);
+	g_type_ensure (E_TYPE_SOURCE_OFFLINE);
+	g_type_ensure (E_TYPE_SOURCE_OPENPGP);
+	g_type_ensure (E_TYPE_SOURCE_REFRESH);
+	g_type_ensure (E_TYPE_SOURCE_RESOURCE);
+	g_type_ensure (E_TYPE_SOURCE_SECURITY);
+	g_type_ensure (E_TYPE_SOURCE_SELECTABLE);
+	g_type_ensure (E_TYPE_SOURCE_SMIME);
+	g_type_ensure (E_TYPE_SOURCE_TASK_LIST);
+	g_type_ensure (E_TYPE_SOURCE_WEBDAV);
 }
 
 static void



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