derived pointer type diffs



Here's the diffs to add a derive-a-pointer-type function to glib
and make GtkCTree use it. As we expected, they are utterly trivial
since pointer derivation was already possible.

OK to commmit?
                                        Owen

Index: gobject/gvaluetypes.c
===================================================================
RCS file: /cvs/gnome/glib/gobject/gvaluetypes.c,v
retrieving revision 1.14
diff -u -r1.14 gvaluetypes.c
--- gobject/gvaluetypes.c	2001/10/12 16:42:48	1.14
+++ gobject/gvaluetypes.c	2001/11/03 18:40:44
@@ -872,3 +872,29 @@
 
   return contents;
 }
+
+GType
+g_pointer_type_register_static (const gchar *name)
+{
+  static const GTypeInfo type_info = {
+    0,			/* class_size */
+    NULL,		/* base_init */
+    NULL,		/* base_finalize */
+    NULL,		/* class_init */
+    NULL,		/* class_finalize */
+    NULL,		/* class_data */
+    0,			/* instance_size */
+    0,			/* n_preallocs */
+    NULL,		/* instance_init */
+    NULL		/* value_table */
+  };
+  GType type;
+
+  g_return_val_if_fail (name != NULL, 0);
+  g_return_val_if_fail (g_type_from_name (name) == 0, 0);
+
+  type = g_type_register_static (G_TYPE_POINTER, name, &type_info, 0);
+
+  return type;
+}
+
Index: gobject/gvaluetypes.h
===================================================================
RCS file: /cvs/gnome/glib/gobject/gvaluetypes.h,v
retrieving revision 1.12
diff -u -r1.12 gvaluetypes.h
--- gobject/gvaluetypes.h	2001/10/11 02:43:04	1.12
+++ gobject/gvaluetypes.h	2001/11/03 18:40:44
@@ -87,6 +87,9 @@
 gpointer	      g_value_get_pointer	(const GValue *value);
 
 
+/* Convenience for registering new pointer types */
+GType                 g_pointer_type_register_static (const gchar *name);
+
 /* debugging aid, describe value contents as string */
 gchar*                g_strdup_value_contents   (const GValue *value);
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2530
diff -u -r1.2530 ChangeLog
--- ChangeLog	2001/11/03 00:44:34	1.2530
+++ ChangeLog	2001/11/03 19:16:48
@@ -1,3 +1,10 @@
+Sat Nov  3 13:57:21 2001  Owen Taylor  <otaylor redhat com>
+
+	* gtk/gtkctree.c: Convert GTK_TYPE_CTREE_NODE to pointer
+	derivation instead of boxed derivation.
+
+	* gtk/gtkmarshal.list: Remove some now unused marshallers.
+
 2001-11-03  Tor Lillqvist  <tml iki fi>
 
 	* modules/input/Makefile.am: Use -no-undefined on Windows. Look
Index: gtk/gtkctree.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkctree.c,v
retrieving revision 1.94
diff -u -r1.94 gtkctree.c
--- gtk/gtkctree.c	2001/10/27 00:41:11	1.94
+++ gtk/gtkctree.c	2001/11/03 19:16:50
@@ -432,45 +432,45 @@
 		    GTK_RUN_FIRST,
 		    GTK_CLASS_TYPE (object_class),
 		    GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_select_row),
-		    gtk_marshal_VOID__BOXED_INT,
+		    gtk_marshal_VOID__POINTER_INT,
 		    GTK_TYPE_NONE, 2,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE,
+		    GTK_TYPE_CTREE_NODE,
 		    GTK_TYPE_INT);
   ctree_signals[TREE_UNSELECT_ROW] =
     gtk_signal_new ("tree_unselect_row",
 		    GTK_RUN_FIRST,
 		    GTK_CLASS_TYPE (object_class),
 		    GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_unselect_row),
-		    gtk_marshal_VOID__BOXED_INT,
+		    gtk_marshal_VOID__POINTER_INT,
 		    GTK_TYPE_NONE, 2,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE,
+		    GTK_TYPE_CTREE_NODE,
 		    GTK_TYPE_INT);
   ctree_signals[TREE_EXPAND] =
     gtk_signal_new ("tree_expand",
 		    GTK_RUN_LAST,
 		    GTK_CLASS_TYPE (object_class),
 		    GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_expand),
-		    gtk_marshal_VOID__BOXED,
+		    gtk_marshal_VOID__POINTER,
 		    GTK_TYPE_NONE, 1,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE);
+		    GTK_TYPE_CTREE_NODE);
   ctree_signals[TREE_COLLAPSE] =
     gtk_signal_new ("tree_collapse",
 		    GTK_RUN_LAST,
 		    GTK_CLASS_TYPE (object_class),
 		    GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_collapse),
-		    gtk_marshal_VOID__BOXED,
+		    gtk_marshal_VOID__POINTER,
 		    GTK_TYPE_NONE, 1,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE);
+		    GTK_TYPE_CTREE_NODE);
   ctree_signals[TREE_MOVE] =
     gtk_signal_new ("tree_move",
 		    GTK_RUN_LAST,
 		    GTK_CLASS_TYPE (object_class),
 		    GTK_SIGNAL_OFFSET (GtkCTreeClass, tree_move),
-		    gtk_marshal_VOID__BOXED_BOXED_BOXED,
+		    gtk_marshal_VOID__POINTER_POINTER_POINTER,
 		    GTK_TYPE_NONE, 3,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE,
-		    GTK_TYPE_CTREE_NODE | G_SIGNAL_TYPE_STATIC_SCOPE);
+		    GTK_TYPE_CTREE_NODE,
+		    GTK_TYPE_CTREE_NODE,
+		    GTK_TYPE_CTREE_NODE);
   ctree_signals[CHANGE_FOCUS_ROW_EXPANSION] =
     gtk_signal_new ("change_focus_row_expansion",
 		    GTK_RUN_LAST | GTK_RUN_ACTION,
@@ -6126,30 +6126,13 @@
     }
 }
 
-/* dummy boxed type definition, used so that the GtkCTreeNode signal
- * arguments have a reasonable type.
- */
-static gpointer
-ctree_node_copy (gpointer boxed)
-{
-  return boxed;
-}
-
-static void
-ctree_node_free (gpointer boxed)
-{
-  /* nothing */
-}
-
 GType
 gtk_ctree_node_get_type (void)
 {
   static GType our_type = 0;
   
   if (our_type == 0)
-    our_type = g_boxed_type_register_static ("GtkCTreeNode",
-                                             (GBoxedCopyFunc)ctree_node_copy,
-                                             (GBoxedFreeFunc)ctree_node_free);
+    our_type = g_pointer_type_register_static ("GtkCTreeNode");
 
   return our_type;
 }
Index: gtk/gtkmarshal.list
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmarshal.list,v
retrieving revision 1.40
diff -u -r1.40 gtkmarshal.list
--- gtk/gtkmarshal.list	2001/11/01 21:50:58	1.40
+++ gtk/gtkmarshal.list	2001/11/03 19:16:50
@@ -44,12 +44,10 @@
 VOID:BOOLEAN,BOOLEAN,BOOLEAN
 VOID:BOXED
 VOID:BOXED,BOXED
-VOID:BOXED,BOXED,BOXED
 VOID:BOXED,BOXED,POINTER
 VOID:BOXED,POINTER
 VOID:BOXED,OBJECT
 VOID:BOXED,STRING,INT
-VOID:BOXED,INT
 VOID:BOXED,UINT
 VOID:BOXED,UINT,FLAGS
 VOID:BOXED,UINT,UINT


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