summaryrefslogtreecommitdiffstats
path: root/gobject/pygtype.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2006-04-29 18:49:45 +0000
committerJohan Dahlin <johan@src.gnome.org>2006-04-29 18:49:45 +0000
commit96a9e4a5b55cde0cc1b13a583dbb28b14fbce46c (patch)
treed7e27e251da05d9ae7df89a52fc9308000c68007 /gobject/pygtype.c
parentc9fe8615db8d42e4da9bc83525f6167291cbb217 (diff)
downloadpygobject-96a9e4a5b55cde0cc1b13a583dbb28b14fbce46c.tar.gz
pygobject-96a9e4a5b55cde0cc1b13a583dbb28b14fbce46c.tar.xz
pygobject-96a9e4a5b55cde0cc1b13a583dbb28b14fbce46c.zip
Fix #154845, add tests and a private method.
* gobject/pygtype.c (gclosure_from_pyfunc): * gobject/pygobject.c (pygobject_disconnect_by_func) (pygobject_handler_block_by_func) (pygobject_handler_unblock_by_func): * tests/test_signal.py (TestEmissionHook._callback): Fix #154845, add tests and a private method.
Diffstat (limited to 'gobject/pygtype.c')
-rw-r--r--gobject/pygtype.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gobject/pygtype.c b/gobject/pygtype.c
index a1400a0..296f48f 100644
--- a/gobject/pygtype.c
+++ b/gobject/pygtype.c
@@ -1306,6 +1306,21 @@ pyg_signal_class_closure_get(void)
return closure;
}
+GClosure *
+gclosure_from_pyfunc(PyGObject *object, PyObject *func)
+{
+ GSList *l;
+
+ for (l = object->closures; l; l = l->next) {
+ PyGClosure *pyclosure = l->data;
+ if (PyFunction_GetClosure(pyclosure->callback) ==
+ PyFunction_GetClosure(func)) {
+ return (GClosure*)pyclosure;
+ }
+ }
+ return NULL;
+}
+
/* ----- __doc__ descriptor for GObject and GInterface ----- */
static void