evolution-data-server r9992 - in trunk/calendar: . libedata-cal



Author: rburton
Date: Thu Jan 29 17:25:52 2009
New Revision: 9992
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9992&view=rev

Log:
2009-01-29  Ross Burton  <ross linux intel com>

	* libedata-cal/e-cal-backend.c:
	* libedata-cal/e-cal-backend.h:
	Use G_DEFINE_TYPE.


Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/libedata-cal/e-cal-backend.c
   trunk/calendar/libedata-cal/e-cal-backend.h

Modified: trunk/calendar/libedata-cal/e-cal-backend.c
==============================================================================
--- trunk/calendar/libedata-cal/e-cal-backend.c	(original)
+++ trunk/calendar/libedata-cal/e-cal-backend.c	Thu Jan 29 17:25:52 2009
@@ -30,6 +30,8 @@
 
 
 
+G_DEFINE_TYPE (ECalBackend, e_cal_backend, G_TYPE_OBJECT);
+
 /* Private part of the CalBackend structure */
 struct _ECalBackendPrivate {
 	/* The source for this backend */
@@ -59,6 +61,9 @@
 
 #define E_CAL_BACKEND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), E_TYPE_CAL_BACKEND, ECalBackendPrivate))
 
+/* For convenience */
+#define CLASS(backend) (E_CAL_BACKEND_GET_CLASS(backend))
+
 /* Property IDs */
 enum props {
 	PROP_0,
@@ -76,46 +81,10 @@
 };
 static guint e_cal_backend_signals[LAST_SIGNAL];
 
-static void e_cal_backend_class_init (ECalBackendClass *class);
-static void e_cal_backend_init (ECalBackend *backend);
 static void e_cal_backend_finalize (GObject *object);
 
-#define CLASS(backend) (E_CAL_BACKEND_CLASS (G_OBJECT_GET_CLASS (backend)))
-
-static GObjectClass *parent_class;
-
 
 
-/**
- * e_cal_backend_get_type:
- *
- * Registers the #ECalBackend class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the #ECalBackend class.
- **/
-GType
-e_cal_backend_get_type (void)
-{
-	static GType e_cal_backend_type = 0;
-
-	if (!e_cal_backend_type) {
-		static GTypeInfo info = {
-                        sizeof (ECalBackendClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) e_cal_backend_class_init,
-                        NULL, NULL,
-                        sizeof (ECalBackend),
-                        0,
-                        (GInstanceInitFunc) e_cal_backend_init,
-                };
-		e_cal_backend_type = g_type_register_static (G_TYPE_OBJECT, "ECalBackend", &info, 0);
-	}
-
-	return e_cal_backend_type;
-}
-
 static void
 e_cal_backend_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
@@ -192,8 +161,6 @@
 {
 	GObjectClass *object_class;
 
-	parent_class = (GObjectClass *) g_type_class_peek_parent (class);
-
 	object_class = (GObjectClass *) class;
 
 	object_class->set_property = e_cal_backend_set_property;
@@ -310,7 +277,7 @@
 	g_free (priv->uri);
 	g_object_unref (priv->source);
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (e_cal_backend_parent_class)->finalize (object);
 }
 
 

Modified: trunk/calendar/libedata-cal/e-cal-backend.h
==============================================================================
--- trunk/calendar/libedata-cal/e-cal-backend.h	(original)
+++ trunk/calendar/libedata-cal/e-cal-backend.h	Thu Jan 29 17:25:52 2009
@@ -42,6 +42,7 @@
 				     ECalBackendClass))
 #define E_IS_CAL_BACKEND(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_BACKEND))
 #define E_IS_CAL_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_BACKEND))
+#define E_CAL_BACKEND_GET_CLASS(obj) (E_CAL_BACKEND_CLASS (G_OBJECT_GET_CLASS (obj)))
 
 typedef struct _ECalBackendPrivate ECalBackendPrivate;
 



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