diff options
| author | Johan Dahlin <jdahlin@async.com.br> | 2005-06-21 16:12:05 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2005-06-21 16:12:05 +0000 |
| commit | 9efdc381329d8e656fe0b3a49f76af9647b18bbb (patch) | |
| tree | b4866e7c55880a02f4fd62678d135cbc4ac396fd /gobject | |
| parent | 805b507053ce9223c589368325aa54037135c418 (diff) | |
| download | pygobject-9efdc381329d8e656fe0b3a49f76af9647b18bbb.tar.gz pygobject-9efdc381329d8e656fe0b3a49f76af9647b18bbb.tar.xz pygobject-9efdc381329d8e656fe0b3a49f76af9647b18bbb.zip | |
Try to register unknown enums and flags on the fly. Fixes #308536, patch
2005-06-21 Johan Dahlin <jdahlin@async.com.br>
* gobject/pygparamspec.c: (pygenum_from_pspec),
(pygflags_from_pspec): Try to register unknown enums and flags on the fly.
Fixes #308536, patch by Edward Hervey
* gobject/pygflags.c: (pyg_flags_add): Make module optional.
Diffstat (limited to 'gobject')
| -rw-r--r-- | gobject/pygflags.c | 1 | ||||
| -rw-r--r-- | gobject/pygparamspec.c | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/gobject/pygflags.c b/gobject/pygflags.c index 2f12324..51dd59a 100644 --- a/gobject/pygflags.c +++ b/gobject/pygflags.c @@ -194,7 +194,6 @@ pyg_flags_add (PyObject * module, GFlagsClass *eclass; int i; - g_return_val_if_fail(module != NULL, NULL); g_return_val_if_fail(typename != NULL, NULL); g_return_val_if_fail(g_type_is_a(gtype, G_TYPE_FLAGS), NULL); diff --git a/gobject/pygparamspec.c b/gobject/pygparamspec.c index 28f9f47..13a526c 100644 --- a/gobject/pygparamspec.c +++ b/gobject/pygparamspec.c @@ -71,7 +71,9 @@ pygenum_from_pspec(GParamSpec *pspec) enum_type = G_ENUM_CLASS_TYPE(enum_pspec->enum_class); pyclass = (PyObject*)g_type_get_qdata(enum_type, pygenum_class_key); if (pyclass == NULL) { - pyclass = Py_None; + pyclass = pyg_enum_add(NULL, g_type_name(enum_type), NULL, enum_type); + if (pyclass == NULL) + pyclass = Py_None; } Py_INCREF(pyclass); @@ -89,7 +91,9 @@ pygflags_from_pspec(GParamSpec *pspec) flag_type = G_FLAGS_CLASS_TYPE(flag_pspec->flags_class); pyclass = (PyObject*)g_type_get_qdata(flag_type, pygflags_class_key); if (pyclass == NULL) { - pyclass = Py_None; + pyclass = pyg_flags_add(NULL, g_type_name(flag_type), NULL, flag_type); + if (pyclass == NULL) + pyclass = Py_None; } Py_INCREF(pyclass); return pyclass; |
