Re: Interface macro usage



On Tue, 2002-01-08 at 06:41, Tim Janik wrote:

> if you'd provide a patch (cvs diff -up) and post it here, that'd be
> much apprechiated.

Attached. Let me know if you want me to commit.

While I'm whining about stuff... I also tripped over this little gem:

typedef struct _GdkRectangle GtkAllocation;

Referencing incomplete, out of namespace types seems a bit off, and it
forces me to parse both the gdk and gtk namespaces in one pass which is
something I'd rather not do.  It's fairly gratuitous, but would it be
okay to change this to:

typedef GdkRectangle GtkAllocation;

Mike
Index: gtkcelleditable.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcelleditable.h,v
retrieving revision 1.2
diff -u -p -r1.2 gtkcelleditable.h
--- gtkcelleditable.h	2001/09/18 22:49:01	1.2
+++ gtkcelleditable.h	2002/01/09 04:35:23
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
 #define GTK_CELL_EDITABLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_EDITABLE, GtkCellEditable))
 #define GTK_CELL_EDITABLE_CLASS(obj)      (G_TYPE_CHECK_CLASS_CAST ((obj), GTK_TYPE_CELL_EDITABLE, GtkCellEditableIface))
 #define GTK_IS_CELL_EDITABLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_EDITABLE))
-#define GTK_CELL_EDITABLE_GET_IFACE(obj)  ((GtkCellEditableIface *)g_type_interface_peek (((GTypeInstance *) GTK_CELL_EDITABLE (obj))->g_class, GTK_TYPE_CELL_EDITABLE))
+#define GTK_CELL_EDITABLE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_EDITABLE, GtkCellEditableIface))
 
 typedef struct _GtkCellEditable      GtkCellEditable; /* Dummy typedef */
 typedef struct _GtkCellEditableIface GtkCellEditableIface;
Index: gtktreednd.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreednd.h,v
retrieving revision 1.4
diff -u -p -r1.4 gtktreednd.h
--- gtktreednd.h	2001/11/06 19:10:02	1.4
+++ gtktreednd.h	2002/01/09 04:35:25
@@ -30,7 +30,7 @@ extern "C" {
 #define GTK_TYPE_TREE_DRAG_SOURCE            (gtk_tree_drag_source_get_type ())
 #define GTK_TREE_DRAG_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_DRAG_SOURCE, GtkTreeDragSource))
 #define GTK_IS_TREE_DRAG_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_DRAG_SOURCE))
-#define GTK_TREE_DRAG_SOURCE_GET_IFACE(obj)  ((GtkTreeDragSourceIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_DRAG_SOURCE (obj))->g_class, GTK_TYPE_TREE_DRAG_SOURCE))
+#define GTK_TREE_DRAG_SOURCE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_DRAG_SOURCE, GtkTreeDragSourceIface))
 
 typedef struct _GtkTreeDragSource      GtkTreeDragSource; /* Dummy typedef */
 typedef struct _GtkTreeDragSourceIface GtkTreeDragSourceIface;
@@ -72,7 +72,7 @@ gboolean gtk_tree_drag_source_drag_data_
 #define GTK_TYPE_TREE_DRAG_DEST            (gtk_tree_drag_dest_get_type ())
 #define GTK_TREE_DRAG_DEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_DRAG_DEST, GtkTreeDragDest))
 #define GTK_IS_TREE_DRAG_DEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_DRAG_DEST))
-#define GTK_TREE_DRAG_DEST_GET_IFACE(obj)  ((GtkTreeDragDestIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_DRAG_DEST (obj))->g_class, GTK_TYPE_TREE_DRAG_DEST))
+#define GTK_TREE_DRAG_DEST_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_DRAG_DEST, GtkTreeDragDestIface))
 
 typedef struct _GtkTreeDragDest      GtkTreeDragDest; /* Dummy typedef */
 typedef struct _GtkTreeDragDestIface GtkTreeDragDestIface;
Index: gtktreemodel.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreemodel.h,v
retrieving revision 1.35
diff -u -p -r1.35 gtktreemodel.h
--- gtktreemodel.h	2001/11/21 22:08:09	1.35
+++ gtktreemodel.h	2002/01/09 04:35:25
@@ -29,7 +29,7 @@ extern "C" {
 #define GTK_TYPE_TREE_MODEL            (gtk_tree_model_get_type ())
 #define GTK_TREE_MODEL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModel))
 #define GTK_IS_TREE_MODEL(obj)	       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_MODEL))
-#define GTK_TREE_MODEL_GET_IFACE(obj)  ((GtkTreeModelIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_MODEL (obj))->g_class, GTK_TYPE_TREE_MODEL))
+#define GTK_TREE_MODEL_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_MODEL, GtkTreeModelIface))
 
 typedef struct _GtkTreeIter         GtkTreeIter;
 typedef struct _GtkTreePath         GtkTreePath;
Index: gtktreesortable.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreesortable.h,v
retrieving revision 1.10
diff -u -p -r1.10 gtktreesortable.h
--- gtktreesortable.h	2001/11/21 22:08:09	1.10
+++ gtktreesortable.h	2002/01/09 04:35:26
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
 #define GTK_TREE_SORTABLE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortable))
 #define GTK_TREE_SORTABLE_CLASS(obj)      (G_TYPE_CHECK_CLASS_CAST ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortableIface))
 #define GTK_IS_TREE_SORTABLE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TREE_SORTABLE))
-#define GTK_TREE_SORTABLE_GET_IFACE(obj)  ((GtkTreeSortableIface *)g_type_interface_peek (((GTypeInstance *)GTK_TREE_SORTABLE (obj))->g_class, GTK_TYPE_TREE_SORTABLE))
+#define GTK_TREE_SORTABLE_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_TREE_SORTABLE, GtkTreeSortableIface))
 
 enum {
   GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1


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