[Galago-commits] r2334 - in trunk/libgalago: . libgalago

galago-commits at freedesktop.org galago-commits at freedesktop.org
Sun Nov 20 03:05:06 PST 2005


Author: chipx86
Date: 2005-11-20 03:04:39 -0800 (Sun, 20 Nov 2005)
New Revision: 2334

Modified:
   trunk/libgalago/ChangeLog
   trunk/libgalago/libgalago/galago-object.c
   trunk/libgalago/libgalago/galago-object.h
Log:
Tip of the day: Don't use a private structure for a class. Store the data in the class itself. Otherwise it seems there are issues.


Modified: trunk/libgalago/ChangeLog
===================================================================
--- trunk/libgalago/ChangeLog	2005-11-20 10:54:39 UTC (rev 2333)
+++ trunk/libgalago/ChangeLog	2005-11-20 11:04:39 UTC (rev 2334)
@@ -1,3 +1,10 @@
+Sun Nov 20 03:03:46 PST 2005  Christian Hammond <chipx86 at chipx86.com>
+
+	* libgalago/galago-object.c:
+	* libgalago/galago-object.h:
+	  - Tip of the day: Don't use a private structure for a class. Store the
+	    data in the class itself. Otherwise it seems there are issues.
+
 Sun Nov 20 02:53:50 PST 2005  Christian Hammond <chipx86 at chipx86.com>
 
 	* tests/check-libgalago.c:

Modified: trunk/libgalago/libgalago/galago-object.c
===================================================================
--- trunk/libgalago/libgalago/galago-object.c	2005-11-20 10:54:39 UTC (rev 2333)
+++ trunk/libgalago/libgalago/galago-object.c	2005-11-20 11:04:39 UTC (rev 2334)
@@ -35,11 +35,6 @@
 	gboolean watched : 1;
 };
 
-struct _GalagoObjectClassPrivate
-{
-	gchar *dbus_signature;
-};
-
 enum
 {
 	PROP_0,
@@ -73,8 +68,6 @@
 
 	parent_class = g_type_class_peek_parent(klass);
 
-	klass->priv = g_new0(GalagoObjectClassPrivate, 1);
-
 	klass->dbus_message_append = NULL;
 	klass->dbus_message_get    = NULL;
 	klass->dbus_push_full      = NULL;
@@ -207,10 +200,10 @@
 		return NULL;
 	}
 
-	if (klass->priv->dbus_signature == NULL)
+	if (klass->dbus_signature == NULL)
 	{
 		char *sig = klass->dbus_get_signature();
-		klass->priv->dbus_signature =
+		klass->dbus_signature =
 			g_strconcat(DBUS_STRUCT_BEGIN_CHAR_AS_STRING,
 						sig,
 						DBUS_STRUCT_END_CHAR_AS_STRING,
@@ -220,7 +213,7 @@
 
 	g_type_class_unref(klass);
 
-	return klass->priv->dbus_signature;
+	return klass->dbus_signature;
 }
 
 void

Modified: trunk/libgalago/libgalago/galago-object.h
===================================================================
--- trunk/libgalago/libgalago/galago-object.h	2005-11-20 10:54:39 UTC (rev 2333)
+++ trunk/libgalago/libgalago/galago-object.h	2005-11-20 11:04:39 UTC (rev 2334)
@@ -27,10 +27,9 @@
 #define DBUS_API_SUBJECT_TO_CHANGE
 #include <dbus/dbus.h>
 
-typedef struct _GalagoObjectClass         GalagoObjectClass;
-typedef struct _GalagoObjectClassPrivate  GalagoObjectClassPrivate;
-typedef struct _GalagoObject              GalagoObject;
-typedef struct _GalagoObjectPrivate       GalagoObjectPrivate;
+typedef struct _GalagoObjectClass   GalagoObjectClass;
+typedef struct _GalagoObject        GalagoObject;
+typedef struct _GalagoObjectPrivate GalagoObjectPrivate;
 
 /**
  * An object.
@@ -56,9 +55,8 @@
 	GObjectClass parent_class;
 
 	const char *dbus_interface;
+	const char *dbus_signature;
 
-	GalagoObjectClassPrivate *priv;
-
 	/* Virtual functions */
 	void (*dbus_message_append)(DBusMessageIter *iter,
 								const GalagoObject *object);



More information about the galago-commits mailing list