diff options
| author | Benjamin Otte <in7y118@public.uni-hamburg.de> | 2005-05-17 17:58:35 +0000 |
|---|---|---|
| committer | Johan Dahlin <zilch@src.gnome.org> | 2005-05-17 17:58:35 +0000 |
| commit | 8d58ce9078bc56613b0e4d37c4858bdc4e5b85ec (patch) | |
| tree | 99c7d705e1c031e2f638f092781dc075465e98d2 | |
| parent | 02f815401f09b07bccfce01d3a5abb19b3a34095 (diff) | |
| download | pygobject-8d58ce9078bc56613b0e4d37c4858bdc4e5b85ec.tar.gz pygobject-8d58ce9078bc56613b0e4d37c4858bdc4e5b85ec.tar.xz pygobject-8d58ce9078bc56613b0e4d37c4858bdc4e5b85ec.zip | |
reviewed by: Johan Dahlin <jdahlin@async.com.br>
2005-05-17 Benjamin Otte <in7y118@public.uni-hamburg.de>
reviewed by: Johan Dahlin <jdahlin@async.com.br>
* gobject/gobjectmodule.c: (pyg_register_class_init),
(pyg_run_class_init): Allow multiple calls to
pyg_register_class_init, fixes #304353
| -rw-r--r-- | gobject/gobjectmodule.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 89819c6..8c10bac 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -868,12 +868,17 @@ add_properties (GType instance_type, PyObject *properties) static void pyg_register_class_init(GType gtype, PyGClassInitFunc class_init) { - g_type_set_qdata(gtype, pygobject_class_init_key, class_init); + GSList *list; + + list = g_type_get_qdata(gtype, pygobject_class_init_key); + list = g_slist_prepend(list, class_init); + g_type_set_qdata(gtype, pygobject_class_init_key, list); } static int pyg_run_class_init(GType gtype, gpointer gclass, PyTypeObject *pyclass) { + GSList *list; PyGClassInitFunc class_init; GType parent_type; int rv; @@ -881,11 +886,18 @@ pyg_run_class_init(GType gtype, gpointer gclass, PyTypeObject *pyclass) parent_type = g_type_parent(gtype); if (parent_type) { rv = pyg_run_class_init(parent_type, gclass, pyclass); - if (rv) return rv; + if (rv) + return rv; + } + + list = g_type_get_qdata(gtype, pygobject_class_init_key); + for (; list; list = list->next) { + class_init = list->data; + rv = class_init(gclass, pyclass); + if (rv) + return rv; } - class_init = g_type_get_qdata(gtype, pygobject_class_init_key); - if (class_init) - return class_init(gclass, pyclass); + return 0; } |
