GObject port for BonoboUIEngine + BonoboUIXml (fwd)



Thanks Martin.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot

---------- Forwarded message ----------
Date: 19 Jul 2001 00:17:16 +0200
From: Martin Baulig <martin home-of-linux org>
To: michael ximian com
Subject: GObject port for BonoboUIEngine + BonoboUIXml

Hi Michael,

here's the GObject port for BonoboUIEngine and BonoboUIXml:

===
2001-07-19  Martin Baulig  <baulig suse de>

	* bonobo/bonobo-ui-engine.[ch]: Ported to GObject.
	* bonobo/bonobo-ui-xml.[ch]: Ported to GObject.

===

Index: bonobo-ui-engine.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-ui-engine.c,v
retrieving revision 1.21
diff -u -u -r1.21 bonobo-ui-engine.c
--- bonobo-ui-engine.c	2001/07/12 15:58:33	1.21
+++ bonobo-ui-engine.c	2001/07/18 22:11:50
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <gtk/gtksignal.h>
+#include <gobject/gsignal.h>
 
 #include <bonobo/bonobo-widget.h>
 #include <bonobo/bonobo-ui-xml.h>
@@ -30,7 +30,7 @@
 
 #define PARENT_TYPE gtk_object_get_type ()
 
-static GtkObjectClass *parent_class = NULL;
+static GObjectClass *parent_class = NULL;
 
 enum {
 	ADD_HINT,
@@ -419,7 +419,7 @@
 }
 
 static void
-replace_override_fn (GtkObject      *object,
+replace_override_fn (GObject        *object,
 		     BonoboUINode   *new,
 		     BonoboUINode   *old,
 		     BonoboUIEngine *engine)
@@ -547,7 +547,7 @@
 }
 
 static void
-override_fn (GtkObject      *object,
+override_fn (GObject        *object,
 	     BonoboUINode   *new,
 	     BonoboUINode   *old,
 	     BonoboUIEngine *engine)
@@ -563,7 +563,7 @@
 }
 
 static void
-reinstate_fn (GtkObject      *object,
+reinstate_fn (GObject        *object,
 	      BonoboUINode   *node,
 	      BonoboUIEngine *engine)
 {
@@ -579,7 +579,7 @@
 }
 
 static void
-rename_fn (GtkObject      *object,
+rename_fn (GObject        *object,
 	   BonoboUINode   *node,
 	   BonoboUIEngine *engine)
 {
@@ -590,7 +590,7 @@
 }
 
 static void
-remove_fn (GtkObject      *object,
+remove_fn (GObject        *object,
 	   BonoboUINode   *node,
 	   BonoboUIEngine *engine)
 {
@@ -1300,7 +1300,7 @@
 	g_return_if_fail (component_name != NULL);
 	g_return_if_fail (BONOBO_IS_UI_ENGINE (engine));
 
-	gtk_object_ref (GTK_OBJECT (engine));
+	g_object_ref (G_OBJECT (engine));
 
 	component = sub_component_objref (engine, component_name);
 
@@ -1326,7 +1326,7 @@
 		CORBA_exception_free (&ev);
 	}
 
-	gtk_object_unref (GTK_OBJECT (engine));
+	g_object_unref (G_OBJECT (engine));
 }
 
 static void
@@ -1540,7 +1540,7 @@
 	if (!component_name) /* Auto-created entry, no-one can listen to it */
 		return;
 
-	gtk_object_ref (GTK_OBJECT (engine));
+	g_object_ref (G_OBJECT (engine));
 
 	component = sub_component_objref (engine, component_name);
 
@@ -1566,7 +1566,7 @@
 		CORBA_exception_free (&ev);
 	}
 
-	gtk_object_unref (GTK_OBJECT (engine));
+	g_object_unref (G_OBJECT (engine));
 }
 
 static void
@@ -1609,17 +1609,17 @@
 	engine = BONOBO_UI_ENGINE (object);
 	priv = engine->priv;
 
-	gtk_object_unref (GTK_OBJECT (priv->config));
+	g_object_unref (G_OBJECT (priv->config));
 
 	while (priv->components)
 		sub_component_destroy (
 			engine, priv->components->data);
 
-	gtk_object_unref (GTK_OBJECT (priv->tree));
+	g_object_unref (G_OBJECT (priv->tree));
 	priv->tree = NULL;
 
 	for (l = priv->syncs; l; l = l->next)
-		gtk_object_unref (GTK_OBJECT (l->data));
+		g_object_unref (G_OBJECT (l->data));
 	g_slist_free (priv->syncs);
 	priv->syncs = NULL;
 
@@ -1638,49 +1638,50 @@
 static void
 class_init (BonoboUIEngineClass *engine_class)
 {
-	GtkObjectClass *object_class;
-	GObjectClass *gobject_class;
+	GObjectClass *object_class;
 
-	parent_class = gtk_type_class (PARENT_TYPE);
+	parent_class = g_type_class_peek_parent (engine_class);
 
-	object_class = GTK_OBJECT_CLASS (engine_class);
-	gobject_class = G_OBJECT_CLASS (engine_class);
-	gobject_class->finalize = impl_finalize;
+	object_class = G_OBJECT_CLASS (engine_class);
+	object_class->finalize = impl_finalize;
 
 	engine_class->emit_verb_on  = impl_emit_verb_on;
 	engine_class->emit_event_on = impl_emit_event_on;
 
 	signals [ADD_HINT]
-		= gtk_signal_new ("add_hint",
-				  GTK_RUN_LAST,
-				  GTK_CLASS_TYPE (object_class),
-				  GTK_SIGNAL_OFFSET (BonoboUIEngineClass, add_hint),
-				  gtk_marshal_VOID__STRING,
-				  GTK_TYPE_NONE, 1, GTK_TYPE_STRING);
-
+		= g_signal_new ("add_hint",
+				G_TYPE_FROM_CLASS (object_class),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (BonoboUIEngineClass, add_hint),
+				NULL, NULL,
+				g_cclosure_marshal_VOID__STRING,
+				G_TYPE_NONE, 1, G_TYPE_STRING);
 	signals [REMOVE_HINT]
-		= gtk_signal_new ("remove_hint",
-				  GTK_RUN_LAST,
-				  GTK_CLASS_TYPE (object_class),
-				  GTK_SIGNAL_OFFSET (BonoboUIEngineClass, remove_hint),
-				  gtk_marshal_VOID__VOID,
-				  GTK_TYPE_NONE, 0);
+		= g_signal_new ("remove_hint",
+				G_TYPE_FROM_CLASS (object_class),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (BonoboUIEngineClass, remove_hint),
+				NULL, NULL,
+				g_cclosure_marshal_VOID__VOID,
+				G_TYPE_NONE, 0);
 
 	signals [EMIT_VERB_ON]
-		= gtk_signal_new ("emit_verb_on",
-				  GTK_RUN_LAST,
-				  GTK_CLASS_TYPE (object_class),
-				  GTK_SIGNAL_OFFSET (BonoboUIEngineClass, emit_verb_on),
-				  gtk_marshal_VOID__POINTER,
-				  GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+		= g_signal_new ("emit_verb_on",
+				G_TYPE_FROM_CLASS (object_class),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (BonoboUIEngineClass, emit_verb_on),
+				NULL, NULL,
+				g_cclosure_marshal_VOID__POINTER,
+				G_TYPE_NONE, 1, G_TYPE_POINTER);
 
 	signals [EMIT_EVENT_ON]
-		= gtk_signal_new ("emit_event_on",
-				  GTK_RUN_LAST,
-				  GTK_CLASS_TYPE (object_class),
-				  GTK_SIGNAL_OFFSET (BonoboUIEngineClass, emit_event_on),
-				  bonobo_marshal_VOID__POINTER_STRING,
-				  GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_STRING);
+		= g_signal_new ("emit_event_on",
+				G_TYPE_FROM_CLASS (object_class),
+				G_SIGNAL_RUN_LAST,
+				G_STRUCT_OFFSET (BonoboUIEngineClass, emit_event_on),
+				NULL, NULL,
+				bonobo_marshal_VOID__POINTER_STRING,
+				G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
 }
 
 static void
@@ -1696,24 +1697,26 @@
 		g_str_hash, g_str_equal);
 }
 
-GtkType
+GType
 bonobo_ui_engine_get_type (void)
 {
-	static GtkType type = 0;
+	static GType type = 0;
 
 	if (type == 0) {
-		static const GtkTypeInfo info = {
-			"BonoboUIEngine",
-			sizeof (BonoboUIEngine),
+		GTypeInfo info = {
 			sizeof (BonoboUIEngineClass),
-			(GtkClassInitFunc)  class_init,
-			(GtkObjectInitFunc) init,
-			/* reserved_1 */ NULL,
-			/* reserved_2 */ NULL,
-			(GtkClassInitFunc) NULL,
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) class_init,
+			NULL, /* class_finalize */
+			NULL, /* class_data */
+			sizeof (BonoboUIEngine),
+			0, /* n_preallocs */
+			(GInstanceInitFunc) init
 		};
-
-		type = gtk_type_unique (PARENT_TYPE, &info);
+		
+		type = g_type_register_static (PARENT_TYPE, "BonoboUIEngine",
+					       &info, 0);
 	}
 
 	return type;
@@ -1764,20 +1767,20 @@
 
 	build_skeleton (priv->tree);
 
-	gtk_signal_connect (GTK_OBJECT (priv->tree), "override",
-			    (GtkSignalFunc) override_fn, engine);
+	g_signal_connect (G_OBJECT (priv->tree), "override",
+			  (GtkSignalFunc) override_fn, engine);
 
-	gtk_signal_connect (GTK_OBJECT (priv->tree), "replace_override",
-			    (GtkSignalFunc) replace_override_fn, engine);
+	g_signal_connect (G_OBJECT (priv->tree), "replace_override",
+			  (GtkSignalFunc) replace_override_fn, engine);
 
-	gtk_signal_connect (GTK_OBJECT (priv->tree), "reinstate",
-			    (GtkSignalFunc) reinstate_fn, engine);
+	g_signal_connect (G_OBJECT (priv->tree), "reinstate",
+			  (GtkSignalFunc) reinstate_fn, engine);
 
-	gtk_signal_connect (GTK_OBJECT (priv->tree), "rename",
-			    (GtkSignalFunc) rename_fn, engine);
+	g_signal_connect (G_OBJECT (priv->tree), "rename",
+			  (GtkSignalFunc) rename_fn, engine);
 
-	gtk_signal_connect (GTK_OBJECT (priv->tree), "remove",
-			    (GtkSignalFunc) remove_fn, engine);
+	g_signal_connect (G_OBJECT (priv->tree), "remove",
+			  (GtkSignalFunc) remove_fn, engine);
 
 	return engine;
 }
@@ -1794,7 +1797,7 @@
 BonoboUIEngine *
 bonobo_ui_engine_new (GObject *view)
 {
-	BonoboUIEngine *engine = gtk_type_new (BONOBO_TYPE_UI_ENGINE);
+	BonoboUIEngine *engine = g_object_new (BONOBO_TYPE_UI_ENGINE, NULL);
 
 	return bonobo_ui_engine_construct (engine, view);
 }
@@ -2062,7 +2065,7 @@
 
 			node = bonobo_ui_engine_widget_get_node (b->data);
 			g_message ("Widget type '%s' with node: '%s'",
-				   GTK_CLASS_NAME (GTK_OBJECT_GET_CLASS (b->data)),
+				   G_OBJECT_CLASS_NAME (b->data),
 				   node ? bonobo_ui_xml_make_path (node) : "NULL");
 		}
 	}
@@ -2075,7 +2078,7 @@
 {
 #ifdef WIDGET_SYNC_DEBUG
 	fprintf (stderr, "Syncing ('%s') on node '%s'\n",
-		 gtk_type_name (GTK_OBJECT (sync)->klass->type),
+		 G_OBJECT_CLASS_NAME (sync),
 		 bonobo_ui_xml_make_path (node));
 #endif
 	if (bonobo_ui_node_parent (node) == engine->priv->tree->root)
@@ -2531,8 +2534,8 @@
 bonobo_ui_engine_add_hint (BonoboUIEngine   *engine,
 			   const char       *str)
 {
-	gtk_signal_emit (GTK_OBJECT (engine),
-			 signals [ADD_HINT], str);
+	g_signal_emit (G_OBJECT (engine),
+		       signals [ADD_HINT], 0, str);
 }
 
 /**
@@ -2544,8 +2547,8 @@
 void
 bonobo_ui_engine_remove_hint (BonoboUIEngine *engine)
 {
-	gtk_signal_emit (GTK_OBJECT (engine),
-			 signals [REMOVE_HINT]);
+	g_signal_emit (G_OBJECT (engine),
+		       signals [REMOVE_HINT], 0);
 }
 
 /**
@@ -2559,8 +2562,8 @@
 bonobo_ui_engine_emit_verb_on (BonoboUIEngine   *engine,
 			       BonoboUINode     *node)
 {
-	gtk_signal_emit (GTK_OBJECT (engine),
-			 signals [EMIT_VERB_ON], node);
+	g_signal_emit (G_OBJECT (engine),
+		       signals [EMIT_VERB_ON], 0, node);
 }
 
 /**
@@ -2576,9 +2579,9 @@
 				BonoboUINode     *node,
 				const char       *state)
 {
-	gtk_signal_emit (GTK_OBJECT (engine),
-			 signals [EMIT_EVENT_ON],
-			 node, state);
+	g_signal_emit (G_OBJECT (engine),
+		       signals [EMIT_EVENT_ON], 0,
+		       node, state);
 }
 
 #define WIDGET_NODE_KEY "BonoboUIEngine:NodeKey"
@@ -2594,8 +2597,8 @@
 {
 	g_return_val_if_fail (widget != NULL, NULL);
 	
-	return gtk_object_get_data (GTK_OBJECT (widget),
-				    WIDGET_NODE_KEY);
+	return g_object_get_data (G_OBJECT (widget),
+				  WIDGET_NODE_KEY);
 }
 
 /**
@@ -2610,8 +2613,8 @@
 				     BonoboUINode *node)
 {
 	if (widget)
-		gtk_object_set_data (GTK_OBJECT (widget),
-				     WIDGET_NODE_KEY, node);
+		g_object_set_data (G_OBJECT (widget),
+				   WIDGET_NODE_KEY, node);
 }
 
 /**
@@ -2712,8 +2715,8 @@
 {
 	BonoboUINode *node = bonobo_ui_engine_widget_get_node (widget);
 
-	gtk_signal_emit (GTK_OBJECT (engine),
-			 signals [EMIT_VERB_ON], node);
+	g_signal_emit (G_OBJECT (engine),
+		       signals [EMIT_VERB_ON], 0, node);
 }
 
 /**
@@ -2733,8 +2736,8 @@
 {
 	BonoboUINode *node = bonobo_ui_engine_widget_get_node (widget);
 
-	gtk_signal_emit (GTK_OBJECT (engine),
-			 signals [EMIT_EVENT_ON], node, state);
+	g_signal_emit (G_OBJECT (engine),
+		       signals [EMIT_EVENT_ON], 0, node, state);
 }
 
 /**
Index: bonobo-ui-engine.h
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-ui-engine.h,v
retrieving revision 1.9
diff -u -u -r1.9 bonobo-ui-engine.h
--- bonobo-ui-engine.h	2001/07/07 16:28:38	1.9
+++ bonobo-ui-engine.h	2001/07/18 22:11:50
@@ -29,21 +29,21 @@
 G_BEGIN_DECLS
 
 #define BONOBO_TYPE_UI_ENGINE            (bonobo_ui_engine_get_type ())
-#define BONOBO_UI_ENGINE(obj)            (GTK_CHECK_CAST ((obj), BONOBO_TYPE_UI_ENGINE, BonoboUIEngine))
-#define BONOBO_UI_ENGINE_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_UI_ENGINE, BonoboUIEngineClass))
-#define BONOBO_IS_UI_ENGINE(obj)         (GTK_CHECK_TYPE ((obj), BONOBO_TYPE_UI_ENGINE))
-#define BONOBO_IS_UI_ENGINE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), BONOBO_TYPE_UI_ENGINE))
+#define BONOBO_UI_ENGINE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), BONOBO_TYPE_UI_ENGINE, BonoboUIEngine))
+#define BONOBO_UI_ENGINE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BONOBO_TYPE_UI_ENGINE, BonoboUIEngineClass))
+#define BONOBO_IS_UI_ENGINE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BONOBO_TYPE_UI_ENGINE))
+#define BONOBO_IS_UI_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), BONOBO_TYPE_UI_ENGINE))
 
 typedef struct _BonoboUIEnginePrivate BonoboUIEnginePrivate;
 
 struct _BonoboUIEngine {
-	GtkObject parent;
+	GObject parent;
 
 	BonoboUIEnginePrivate *priv;
 };
 
 typedef struct {
-	GtkObjectClass parent_class;
+	GObjectClass parent_class;
 
 	/* Signals */
 	void (*add_hint)      (BonoboUIEngine *engine,
Index: bonobo-ui-xml.h
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-ui-xml.h,v
retrieving revision 1.22
diff -u -u -r1.22 bonobo-ui-xml.h
--- bonobo-ui-xml.h	2001/02/16 21:59:27	1.22
+++ bonobo-ui-xml.h	2001/07/18 22:11:50
@@ -10,15 +10,15 @@
 #ifndef _BONOBO_UI_XML_H_
 #define _BONOBO_UI_XML_H_
 
-#include <gtk/gtkobject.h>
+#include <gobject/gobject.h>
 #include <bonobo/bonobo-ui-node.h>
 #include <bonobo/bonobo-ui-engine.h>
 
 #define BONOBO_UI_XML_TYPE        (bonobo_ui_xml_get_type ())
-#define BONOBO_UI_XML(o)          (GTK_CHECK_CAST ((o), BONOBO_UI_XML_TYPE, BonoboUIXml))
-#define BONOBO_UI_XML_CLASS(k)    (GTK_CHECK_CLASS_CAST((k), BONOBO_UI_XML_TYPE, BonoboUIXmlClass))
-#define BONOBO_IS_UI_XML(o)       (GTK_CHECK_TYPE ((o), BONOBO_UI_XML_TYPE))
-#define BONOBO_IS_UI_XML_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), BONOBO_UI_XML_TYPE))
+#define BONOBO_UI_XML(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), BONOBO_UI_XML_TYPE, BonoboUIXml))
+#define BONOBO_UI_XML_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST ((k), BONOBO_UI_XML_TYPE, BonoboUIXmlClass))
+#define BONOBO_IS_UI_XML(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), BONOBO_UI_XML_TYPE))
+#define BONOBO_IS_UI_XML_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), BONOBO_UI_XML_TYPE))
 
 typedef struct _BonoboUIXml BonoboUIXml;
 
@@ -43,7 +43,7 @@
 						    gpointer          user_data);
 
 struct _BonoboUIXml {
-	GtkObject              object;
+	GObject                object;
 
 	BonoboUIXmlCompareFn   compare;
 	BonoboUIXmlDataNewFn   data_new;
@@ -59,7 +59,7 @@
 };
 
 typedef struct {
-	GtkObjectClass         object_klass;
+	GObjectClass           object_klass;
 
 	void                 (*override)          (BonoboUINode *new_node,
 						   BonoboUINode *old_node);
Index: bonobo-ui-xml.c
===================================================================
RCS file: /cvs/gnome/libbonoboui/bonobo/bonobo-ui-xml.c,v
retrieving revision 1.55
diff -u -u -r1.55 bonobo-ui-xml.c
--- bonobo-ui-xml.c	2001/04/23 23:18:59	1.55
+++ bonobo-ui-xml.c	2001/07/18 22:11:51
@@ -9,7 +9,7 @@
  */
 #include "config.h"
 #include <string.h>
-#include <gtk/gtksignal.h>
+#include <gobject/gsignal.h>
 #include <bonobo/bonobo-ui-xml.h>
 #include <bonobo/bonobo-marshal.h>
 
@@ -37,7 +37,7 @@
 #define XML_NODE(x) ((xmlNode*)(x))
 #define BNODE(x)    ((BonoboUINode*)(x))
 
-static GtkObjectClass *bonobo_ui_xml_parent_class;
+static GObjectClass *bonobo_ui_xml_parent_class;
 
 enum {
 	OVERRIDE,
@@ -437,8 +437,8 @@
 
 	if (override) {
 
-		gtk_signal_emit (GTK_OBJECT (tree),
-				 signals [OVERRIDE], new, old);
+		g_signal_emit (G_OBJECT (tree),
+			       signals [OVERRIDE], 0, new, old);
 
 		data->overridden = g_slist_prepend (old_data->overridden, old);
 		prune_overrides_by_id (tree, data, data->id);
@@ -447,8 +447,8 @@
 			data->id = old_data->id;
 
 		data->overridden = old_data->overridden;
-		gtk_signal_emit (GTK_OBJECT (tree),
-				 signals [REPLACE_OVERRIDE], new, old);
+		g_signal_emit (G_OBJECT (tree),
+			       signals [REPLACE_OVERRIDE], 0, new, old);
 
 /*		fprintf (stderr, "Replace override of '%s' '%s' with '%s' '%s'",
 			 old->name, bonobo_ui_node_get_attr (old, "name"),
@@ -505,7 +505,7 @@
 		data->overridden = NULL;
 
 		/* Fire remove while still in tree */
-		gtk_signal_emit (GTK_OBJECT (tree), signals [REMOVE], node);
+		g_signal_emit (G_OBJECT (tree), signals [REMOVE], 0, node);
 		
 		/* Move children across */
 		move_children (node, old);
@@ -516,7 +516,7 @@
 		/* Mark dirty */
 		bonobo_ui_xml_set_dirty (tree, old);
 
-		gtk_signal_emit (GTK_OBJECT (tree), signals [REINSTATE], old);
+		g_signal_emit (G_OBJECT (tree), signals [REINSTATE], 0, old);
 
 		watch_update (tree, old);
 
@@ -529,13 +529,13 @@
 		/* Mark dirty */
 		bonobo_ui_xml_set_dirty (tree, node);
 		
-		gtk_signal_emit (GTK_OBJECT (tree), signals [RENAME], node);
+		g_signal_emit (G_OBJECT (tree), signals [RENAME], 0, node);
 		return;
 	} else {
 		/* Mark parent & up dirty */
 		bonobo_ui_xml_set_dirty (tree, node);
 
-		gtk_signal_emit (GTK_OBJECT (tree), signals [REMOVE], node);
+		g_signal_emit (G_OBJECT (tree), signals [REMOVE], 0, node);
 	}
 
 /*		fprintf (stderr, "destroying node '%s' '%s'\n",
@@ -1049,7 +1049,7 @@
 }
 
 static void
-bonobo_ui_xml_destroy (GtkObject *object)
+bonobo_ui_xml_finalize (GObject *object)
 {
 	BonoboUIXml *tree = BONOBO_UI_XML (object);
 
@@ -1072,47 +1072,57 @@
 static void
 bonobo_ui_xml_class_init (BonoboUIXmlClass *klass)
 {
-	GtkObjectClass *object_class = (GtkObjectClass *) klass;
+	GObjectClass *object_class = (GObjectClass *) klass;
 	
-	bonobo_ui_xml_parent_class = gtk_type_class (
-		gtk_object_get_type ());
+	bonobo_ui_xml_parent_class = g_type_class_peek_parent (klass);
 
-	object_class->destroy = bonobo_ui_xml_destroy;
+	object_class->finalize = bonobo_ui_xml_finalize;
 
-	signals [OVERRIDE] = gtk_signal_new (
-		"override", GTK_RUN_FIRST,
-		GTK_CLASS_TYPE (object_class),
-		GTK_SIGNAL_OFFSET (BonoboUIXmlClass, override),
-		bonobo_marshal_VOID__POINTER_POINTER,
-		GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER);
-
-	signals [REPLACE_OVERRIDE] = gtk_signal_new (
-		"replace_override", GTK_RUN_FIRST,
-		GTK_CLASS_TYPE (object_class),
-		GTK_SIGNAL_OFFSET (BonoboUIXmlClass, replace_override),
-		bonobo_marshal_VOID__POINTER_POINTER,
-		GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER);
-
-	signals [REINSTATE] = gtk_signal_new (
-		"reinstate", GTK_RUN_FIRST,
-		GTK_CLASS_TYPE (object_class),
-		GTK_SIGNAL_OFFSET (BonoboUIXmlClass, reinstate),
-		gtk_marshal_VOID__POINTER,
-		GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
-	signals [RENAME] = gtk_signal_new (
-		"rename", GTK_RUN_FIRST,
-		GTK_CLASS_TYPE (object_class),
-		GTK_SIGNAL_OFFSET (BonoboUIXmlClass, rename),
-		gtk_marshal_VOID__POINTER,
-		GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
-	signals [REMOVE] = gtk_signal_new (
-		"remove", GTK_RUN_FIRST,
-		GTK_CLASS_TYPE (object_class),
-		GTK_SIGNAL_OFFSET (BonoboUIXmlClass, remove),
-		gtk_marshal_VOID__POINTER,
-		GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+	signals [OVERRIDE] =
+		g_signal_new ("override",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (BonoboUIXmlClass, override),
+			      NULL, NULL,
+			      bonobo_marshal_VOID__POINTER_POINTER,
+			      G_TYPE_NONE, 2,
+			      G_TYPE_POINTER, G_TYPE_POINTER);
+	signals [REPLACE_OVERRIDE] =
+		g_signal_new ("replace_override",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (BonoboUIXmlClass, replace_override),
+			      NULL, NULL,
+			      bonobo_marshal_VOID__POINTER_POINTER,
+			      G_TYPE_NONE, 2,
+			      G_TYPE_POINTER, G_TYPE_POINTER);
+	signals [REINSTATE] =
+		g_signal_new ("reinstate",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (BonoboUIXmlClass, reinstate),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_POINTER);
+	signals [RENAME] =
+		g_signal_new ("rename",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (BonoboUIXmlClass, rename),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_POINTER);
+	signals [REMOVE] =
+		g_signal_new ("remove",
+			      G_TYPE_FROM_CLASS (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (BonoboUIXmlClass, remove),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__POINTER,
+			      G_TYPE_NONE, 1,
+			      G_TYPE_POINTER);
 }
 
 /**
@@ -1120,24 +1130,26 @@
  *
  * Returns the GtkType for the BonoboCmdModel class.
  */
-GtkType
+GType
 bonobo_ui_xml_get_type (void)
 {
-	static GtkType type = 0;
+	static GType type = 0;
 
 	if (!type) {
-		GtkTypeInfo info = {
-			"BonoboUIXml",
-			sizeof (BonoboUIXml),
+		GTypeInfo info = {
 			sizeof (BonoboUIXmlClass),
-			(GtkClassInitFunc) bonobo_ui_xml_class_init,
-			(GtkObjectInitFunc) NULL,
-			NULL, /* reserved 1 */
-			NULL, /* reserved 2 */
-			(GtkClassInitFunc) NULL
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) bonobo_ui_xml_class_init,
+			NULL, /* class_finalize */
+			NULL, /* class_data */
+			sizeof (BonoboUIXml),
+			0, /* n_preallocs */
+			(GInstanceInitFunc) NULL
 		};
 
-		type = gtk_type_unique (gtk_object_get_type (), &info);
+		type = g_type_register_static (G_TYPE_OBJECT, "BonoboUIXml",
+					       &info, 0);
 	}
 
 	return type;
@@ -1153,7 +1165,7 @@
 {
 	BonoboUIXml *tree;
 
-	tree = gtk_type_new (BONOBO_UI_XML_TYPE);
+	tree = g_object_new (BONOBO_UI_XML_TYPE, NULL);
 
 	tree->compare = compare;
 	tree->data_new = data_new;

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)


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