summaryrefslogtreecommitdiffstats
path: root/gobject/pygobject.c
diff options
context:
space:
mode:
authorGustavo J. A. M. Carneiro <gjc@src.gnome.org>2006-05-28 13:50:05 +0000
committerGustavo J. A. M. Carneiro <gjc@src.gnome.org>2006-05-28 13:50:05 +0000
commite6ef557a9ba22f8b8afb0e772c206589dbbb0b9a (patch)
tree03460d07784d97ed236a3882bdb22b0c38e07611 /gobject/pygobject.c
parent79df3f5f4b6113d07ab40522f30c83f2fab17410 (diff)
downloadpygobject-e6ef557a9ba22f8b8afb0e772c206589dbbb0b9a.tar.gz
pygobject-e6ef557a9ba22f8b8afb0e772c206589dbbb0b9a.tar.xz
pygobject-e6ef557a9ba22f8b8afb0e772c206589dbbb0b9a.zip
gobject.new fix for 'subsubtype' case
Diffstat (limited to 'gobject/pygobject.c')
-rw-r--r--gobject/pygobject.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gobject/pygobject.c b/gobject/pygobject.c
index f6307ac..1451148 100644
--- a/gobject/pygobject.c
+++ b/gobject/pygobject.c
@@ -739,9 +739,10 @@ pygobject_lookup_class(GType gtype)
}
/**
- * pygobject_new:
+ * pygobject_new_full:
* @obj: a GObject instance.
* @sink: whether to sink any floating reference found on the GObject.
+ * @g_class: the GObjectClass
*
* This function gets a reference to a wrapper for the given GObject
* instance. If a wrapper has already been created, a new reference
@@ -751,7 +752,7 @@ pygobject_lookup_class(GType gtype)
* Returns: a reference to the wrapper for the GObject.
*/
PyObject *
-pygobject_new_full(GObject *obj, gboolean sink)
+pygobject_new_full(GObject *obj, gboolean sink, gpointer g_class)
{
PyGObject *self;
@@ -766,7 +767,11 @@ pygobject_new_full(GObject *obj, gboolean sink)
Py_INCREF(self);
} else {
/* create wrapper */
- PyTypeObject *tp = pygobject_lookup_class(G_OBJECT_TYPE(obj));
+ PyTypeObject *tp;
+ if (g_class)
+ tp = pygobject_lookup_class(G_OBJECT_CLASS_TYPE(g_class));
+ else
+ tp = pygobject_lookup_class(G_OBJECT_TYPE(obj));
/* need to bump type refcount if created with
pygobject_new_with_interfaces(). fixes bug #141042 */
if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE)
@@ -792,10 +797,11 @@ pygobject_new_full(GObject *obj, gboolean sink)
return (PyObject *)self;
}
+
PyObject *
pygobject_new(GObject *obj)
{
- return pygobject_new_full(obj, TRUE);
+ return pygobject_new_full(obj, TRUE, NULL);
}
static void