From 4e62c6450844aa49430fa450ce555370cb43dedb Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Thu, 29 Jun 2000 01:15:21 +0000 Subject: use pygobject.h. 2000-06-29 James Henstridge * gobjectmodule.c: use pygobject.h. * pygobject.h: header for modules that want to use GObject. --- gobject/gobjectmodule.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'gobject/gobjectmodule.c') diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index acdd1d5..43f5792 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1,25 +1,14 @@ /* -*- Mode: C; c-basic-offset: 4 -*- */ -#include -#include +#define _INSIDE_PYGOBJECT_ +#include "pygobject.h" #include #include -#include -#include "ExtensionClass.h" static GHashTable *class_hash; static GQuark pygobject_wrapper_key = 0; static GQuark pygobject_ownedref_key = 0; -typedef struct { - PyObject_HEAD - GObject *obj; - gboolean hasref; /* the GObject owns this reference */ - PyObject *inst_dict; /* the instance dictionary -- must be last */ -} PyGObject; - -#define pygobject_get(v) (((PyGObject *)v)->obj) - staticforward PyExtensionClass PyGObject_Type; static void pygobject_dealloc(PyGObject *self); static PyObject *pygobject_getattr(PyGObject *self, char *attr); @@ -625,6 +614,17 @@ static PyMethodDef pygobject_functions[] = { /* ----------------- gobject module initialisation -------------- */ +static struct _PyGObject_Functions functions = { + pygobject_register_class, + pygobject_register_wrapper, + pygobject_lookup_class, + pygobject_new, + pyg_enum_get_value, + pyg_flags_get_value, + pyg_value_from_pyobject, + pyg_value_as_pyobject, +}; + DL_EXPORT(void) initgobject(void) { @@ -639,6 +639,10 @@ initgobject(void) pygobject_wrapper_key = g_quark_from_static_string("py-gobject-wrapper"); pygobject_ownedref_key = g_quark_from_static_string("py-gobject-ownedref"); + /* for addon libraries ... */ + PyDict_SetItemString(d, "_PyGObject_API", + PyCObject_FromVoidPtr(&functions, NULL)); + if (PyErr_Occurred()) Py_FatalError("can't initialise module gobject"); } -- cgit