diff options
| author | Johan Dahlin <johan@src.gnome.org> | 2004-07-18 19:30:34 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2004-07-18 19:30:34 +0000 |
| commit | 0caf54f414b108603c1e0f57f0e31489fdc31d32 (patch) | |
| tree | befb5168c006019807ca94ce25012aab9ff50929 /gobject/gobjectmodule.c | |
| parent | 3b9951be52eeac3d76755808eafcdca864bc4e74 (diff) | |
| download | pygobject-0caf54f414b108603c1e0f57f0e31489fdc31d32.tar.gz pygobject-0caf54f414b108603c1e0f57f0e31489fdc31d32.tar.xz pygobject-0caf54f414b108603c1e0f57f0e31489fdc31d32.zip | |
New getters
* gobject/pygflags.c (pyg_flags_get_value_nicks)
(pyg_flags_get_value_names): New getters
* gobject/pygenum.c (pyg_enum_get_value_nick)
(pyg_enum_get_value_name): New getters
* gobject/gobjectmodule.c (pyg_param_spec_getattr): add enum_class
and flags_class properties.
Diffstat (limited to 'gobject/gobjectmodule.c')
| -rw-r--r-- | gobject/gobjectmodule.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 6159ca9..267ed2b 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -193,7 +193,30 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) */ Py_INCREF(Py_None); return Py_None; + } else if (!strcmp(attr, "enum_class")) { + if (G_IS_PARAM_SPEC_ENUM(self->pspec)) { + GQuark quark; + PyObject *pyclass; + + quark = g_quark_from_static_string("PyGEnum::class"); + pyclass = (PyObject*)g_type_get_qdata(G_ENUM_CLASS_TYPE(G_PARAM_SPEC_ENUM(self->pspec)->enum_class), quark); + g_assert(pyclass != NULL); + + return pyclass; + } + } else if (!strcmp(attr, "flags_class")) { + if (G_IS_PARAM_SPEC_FLAGS(self->pspec)) { + GQuark quark; + PyObject *pyclass; + + quark = g_quark_from_static_string("PyGFlags::class"); + pyclass = (PyObject*)g_type_get_qdata(G_FLAGS_CLASS_TYPE(G_PARAM_SPEC_FLAGS(self->pspec)->flags_class), quark); + g_assert(pyclass != NULL); + + return pyclass; + } } + PyErr_SetString(PyExc_AttributeError, attr); return NULL; } |
