summaryrefslogtreecommitdiffstats
path: root/gobject/gobjectmodule.c
diff options
context:
space:
mode:
authorJohan Dahlin <zilch@src.gnome.org>2004-04-10 22:03:46 +0000
committerJohan Dahlin <zilch@src.gnome.org>2004-04-10 22:03:46 +0000
commite886c978845ddffff0e39ca1cf33b31c467aab2c (patch)
tree9e220872a986645b3d30d8681984708875fea9ed /gobject/gobjectmodule.c
parent01eb05a5e5cd38b35814b3f9780ed48f2b95a769 (diff)
downloadpygobject-e886c978845ddffff0e39ca1cf33b31c467aab2c.tar.gz
pygobject-e886c978845ddffff0e39ca1cf33b31c467aab2c.tar.xz
pygobject-e886c978845ddffff0e39ca1cf33b31c467aab2c.zip
New function. (pygobject_lookup_class): Modify so we're not traversing
* pygobject.c (pygobject_new_with_interfaces): New function. (pygobject_lookup_class): Modify so we're not traversing parents for unknown types but instead creating new types when they're not registered. We're also using pygobject_new_with_interfaces so interfaces gets attached correctly. Partial fix for bug 129032 * gobjectmodule.c: Add quark and attach the PyTypeObject for GInterfaces. * pygobject-private.h: Make PyGInterface_Type and pyginterface_type_key public
Diffstat (limited to 'gobject/gobjectmodule.c')
-rw-r--r--gobject/gobjectmodule.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index bea061e..5bf7242 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -27,6 +27,8 @@
#include "pygobject-private.h"
static PyObject *gerror_exc = NULL;
+static const gchar *pyginterface_type_id = "PyGInterface::type";
+GQuark pyginterface_type_key = 0;
static void pyg_flags_add_constants(PyObject *module, GType flags_type,
const gchar *strip_prefix);
@@ -234,7 +236,7 @@ pyg_interface_init(PyObject *self, PyObject *args, PyObject *kwargs)
return -1;
}
-static PyTypeObject PyGInterface_Type = {
+PyTypeObject PyGInterface_Type = {
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
"gobject.GInterface", /* tp_name */
@@ -300,6 +302,9 @@ pyg_register_interface(PyObject *dict, const gchar *class_name,
type->ob_type = &PyType_Type;
type->tp_base = &PyGInterface_Type;
+ if (!pyginterface_type_key)
+ pyginterface_type_key = g_quark_from_static_string(pyginterface_type_id);
+
if (PyType_Ready(type) < 0) {
g_warning("could not ready `%s'", type->tp_name);
return;
@@ -311,7 +316,10 @@ pyg_register_interface(PyObject *dict, const gchar *class_name,
Py_DECREF(o);
}
+ g_type_set_qdata(gtype, pyginterface_type_key, type);
+
PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type);
+
}
/* -------------- GMainContext objects ---------------------------- */