summaryrefslogtreecommitdiff
path: root/pygobject-private.h
diff options
context:
space:
mode:
authorJames Henstridge <james@daa.com.au>2002-07-09 15:27:59 +0000
committerJames Henstridge <jamesh@src.gnome.org>2002-07-09 15:27:59 +0000
commit913c565de32302647fd996585ed8db05f705b860 (patch)
treeefdf7ea8b60f2bfacb52552e5a78388654b356f7 /pygobject-private.h
parent5290ba881aabfe377859546406c49f06467286d1 (diff)
downloadpygtk-913c565de32302647fd996585ed8db05f705b860.tar.gz
Reworking of Arjan Molenaar's (arjanmolenaar@hetnet.nl) patch from bug
2002-07-09 James Henstridge <james@daa.com.au> Reworking of Arjan Molenaar's (arjanmolenaar@hetnet.nl) patch from bug 71435. * gtk/libglade.override (connect_one): watch the closure. (connect_many): watch the closure. * gtk/gtk.override (_wrap_gtk_toolbar_append_item): watch closure for signal. (_wrap_gtk_toolbar_prepend_item): same here. (_wrap_gtk_toolbar_insert_item): same here. (_wrap_gtk_toolbar_insert_stock): same here. (_wrap_gtk_toolbar_append_element): same here. (_wrap_gtk_toolbar_prepend_element): same here. (_wrap_gtk_toolbar_insert_element): same here. * pygobject.h (_PyGObject_Functions): add pygobject_watch_closure to the list of exported functions. * pygobject.c (pygobject_watch_closure): new function to watch a closure. We perform cyclic garbage collection on watched closures. The closure will automatically be unwatched when it gets invalidated. (pygobject_traverse): traverse watched closures as well. (pygobject_clear): invalidate all watched closures (pygobject_dealloc): invalidate watched closures on dealloc too. (PyGObject_Type): register the invalidate handler. (pygobject_connect): watch the closure we connect here. (pygobject_connect_after): same here.. (pygobject_connect_object): same here. (pygobject_connect_object_after): same here. * pygtype.c (pyg_closure_new): clean up closure on invalidate, rather than finalize (on invalidate, we break references). * pygobject.h (PyGObject): add closures member to store references to PyGClosures.
Diffstat (limited to 'pygobject-private.h')
-rw-r--r--pygobject-private.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/pygobject-private.h b/pygobject-private.h
index e8b768de..816615ea 100644
--- a/pygobject-private.h
+++ b/pygobject-private.h
@@ -52,6 +52,14 @@ void pyg_register_boxed_custom(GType boxed_type,
int pyg_value_from_pyobject(GValue *value, PyObject *obj);
PyObject *pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed);
+typedef struct _PyGClosure PyGClosure;
+struct _PyGClosure {
+ GClosure closure;
+ PyObject *callback;
+ PyObject *extra_args; /* tuple of extra args to pass to callback */
+ PyObject *swap_data; /* other object for gtk_signal_connect_object */
+};
+
GClosure *pyg_closure_new(PyObject *callback, PyObject *extra_args, PyObject *swap_data);
GClosure *pyg_signal_class_closure_get(void);
@@ -68,7 +76,7 @@ void pygobject_register_class (PyObject *dict,
void pygobject_register_wrapper (PyObject *self);
PyObject * pygobject_new (GObject *obj);
PyTypeObject *pygobject_lookup_class (GType gtype);
-
+void pygobject_watch_closure (PyObject *self, GClosure *closure);
/* from pygboxed.c */
extern PyTypeObject PyGBoxed_Type;