From bcaf62aab7e7dca0e9c8bbc5e45c848b96830d3e Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Tue, 18 Sep 2001 10:05:22 +0000 Subject: export this function. 2001-09-18 James Henstridge * pygobject.h (pyg_type_wrapper_new): export this function. * codegen/argtypes.py (GTypeArg.write_return): wrap GType return values as PyGTypeWrappers rather than ints. * codegen/codegen.py (write_source): pass the typecode macros to pygobject_register_class and pyg_register_interface rather than references to the get_type functions. * pygobject.h (_PyGObject_Functions): fix up prototypes. * gobjectmodule.c (check_bases): check if the base class is an extensionclass before poking around in class->bases. (pyg_type_*): don't bother storing the _get_type() function for lazy initialisation. Instead, just store the GType. Also, remove code for coercing them into numbers. (pygobject_register_class): take the type, rather that get_type routine as an argument. (pyg_register_interface): same here. (pyg_type_from_object): don't accept types that convert to ints as being equivalent to GTypes. (pyg_register_boxed): set the __gtype__ attribute to a PyGTypeWrapper. (pyg_type_register): set __gtype__ to a PyGTypeWrapper. (pyg_type_name): use pyg_type_from_name (pyg_type_from_name): return a PyGTypeWrapper object. (pyg_type_parent): update. (pyg_type_is_a): update. (pyg_type_children): update. (pyg_type_interfaces): update. (initgobject): set __gtype__ attributes to PyGTypeWrapper objects. (initgobject): make type constants PyGTypeWrapper objects. --- gobject/pygobject.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'gobject/pygobject.h') diff --git a/gobject/pygobject.h b/gobject/pygobject.h index db8e284..16fd37a 100644 --- a/gobject/pygobject.h +++ b/gobject/pygobject.h @@ -30,14 +30,16 @@ typedef struct { struct _PyGObject_Functions { void (* register_class)(PyObject *dict, const gchar *class_name, - GType (* get_type)(void), - PyExtensionClass *ec, PyObject *bases); + GType type, PyExtensionClass *ec, PyObject *bases); void (* register_wrapper)(PyObject *self); PyExtensionClass *(* lookup_class)(GType type); PyObject *(* new)(GObject *obj); GClosure *(* closure_new)(PyObject *callback, PyObject *extra_args, PyObject *swap_data); + GType (* type_from_object)(PyObject *obj); + PyObject *(* type_wrapper_new)(GType type); + gint (* enum_get_value)(GType enum_type, PyObject *obj, gint *val); gint (* flags_get_value)(GType flag_type, PyObject *obj, gint *val); void (* register_boxed_custom)(GType boxed_type, @@ -47,8 +49,7 @@ struct _PyGObject_Functions { PyObject *(* value_as_pyobject)(const GValue *value); void (* register_interface)(PyObject *dict, const gchar *class_name, - GType (* get_type)(void), - PyExtensionClass *ec); + GType type, PyExtensionClass *ec); PyExtensionClass *boxed_type; void (* register_boxed)(PyObject *dict, const gchar *class_name, @@ -76,6 +77,7 @@ struct _PyGObject_Functions *_PyGObject_API; #define pygobject_new (_PyGObject_API->new) #define pyg_closure_new (_PyGObject_API->closure_new) #define pyg_type_from_object (_PyGObject_API->type_from_object) +#define pyg_type_wrapper_new (_PyGObject_API->type_wrapper_new) #define pyg_enum_get_value (_PyGObject_API->enum_get_value) #define pyg_flags_get_value (_PyGObject_API->flags_get_value) #define pyg_register_boxed_custom (_PyGObject_API->register_boxed_custom) -- cgit