diff options
author | Simon van der Linden <svdlinden@src.gnome.org> | 2009-11-07 16:43:35 +0100 |
---|---|---|
committer | Simon van der Linden <svdlinden@src.gnome.org> | 2009-11-09 13:41:14 +0100 |
commit | 000f7c36e667c6e078e3370769ea868e56a1b4ee (patch) | |
tree | 87663b933462f0a376ed686b430141659f0f2bc1 /gobject/pygobject.c | |
parent | bfd3100a580b8bea9db25b8bb7443fb8c3dbe1cc (diff) | |
download | pygobject-000f7c36e667c6e078e3370769ea868e56a1b4ee.tar.gz pygobject-000f7c36e667c6e078e3370769ea868e56a1b4ee.tar.xz pygobject-000f7c36e667c6e078e3370769ea868e56a1b4ee.zip |
Add capabilities to import wrappers from pygi
At instance creation for boxed and pointers, at lookup for objects,
when the gtype has no wrapper yet, a wrapper may be imported from pygi.
The feature is turned on at configure time by --enable-pygi.
Because we couldn't create a circular build dependency, PyGI's import function and
API definition had to be copied in this tree.
Diffstat (limited to 'gobject/pygobject.c')
-rw-r--r-- | gobject/pygobject.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c index b4274e1..222280b 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -29,6 +29,8 @@ #include "pyginterface.h" #include "pygparamspec.h" +#include "pygi-external.h" + static void pygobject_dealloc(PyGObject *self); static int pygobject_traverse(PyGObject *self, visitproc visit, void *arg); @@ -871,6 +873,14 @@ pygobject_lookup_class(GType gtype) py_type = g_type_get_qdata(gtype, pygobject_class_key); if (py_type == NULL) { py_type = g_type_get_qdata(gtype, pyginterface_type_key); + + if (py_type == NULL) { + py_type = (PyTypeObject *)pygi_type_import_by_g_type(gtype); + if (py_type == NULL) { + PyErr_Clear(); + } + } + if (py_type == NULL) { py_type = pygobject_new_with_interfaces(gtype); g_type_set_qdata(gtype, pyginterface_type_key, py_type); |