diff options
| author | Johan Dahlin <johan@gnome.org> | 2008-07-27 09:35:57 +0000 |
|---|---|---|
| committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-27 09:35:57 +0000 |
| commit | 5ffb6e17bf5ea51abe9c9f440e7cfdd8920d143a (patch) | |
| tree | 869b1650717b1dac5490aa889683f01ecc0479ea /gobject/pygparamspec.c | |
| parent | 2c1fecd16f1cc8943455cf3d573cf441162a8969 (diff) | |
| download | pygobject-5ffb6e17bf5ea51abe9c9f440e7cfdd8920d143a.tar.gz pygobject-5ffb6e17bf5ea51abe9c9f440e7cfdd8920d143a.tar.xz pygobject-5ffb6e17bf5ea51abe9c9f440e7cfdd8920d143a.zip | |
Use PYGLIB_DEFINE_TYPE macro and move struct field initialization to the
2008-07-27 Johan Dahlin <johan@gnome.org>
* gobject/pygboxed.c (pygobject_boxed_register_types):
* gobject/pygenum.c (pygobject_enum_register_types):
* gobject/pygflags.c (pygobject_flags_register_types):
* gobject/pygobject.c (pygobject_object_register_types):
* gobject/pygparamspec.c (pygobject_paramspec_register_types):
* gobject/pygpointer.c (pygobject_pointer_register_types):
* gobject/pygtype.c (pygobject_type_register_types):
Use PYGLIB_DEFINE_TYPE macro and move struct field initialization
to the registration methods.
svn path=/trunk/; revision=883
Diffstat (limited to 'gobject/pygparamspec.c')
| -rw-r--r-- | gobject/pygparamspec.c | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/gobject/pygparamspec.c b/gobject/pygparamspec.c index 8a62141..a6e225e 100644 --- a/gobject/pygparamspec.c +++ b/gobject/pygparamspec.c @@ -25,9 +25,13 @@ # include <config.h> #endif +#include <pyglib.h> + #include "pygobject-private.h" #include "pygparamspec.h" +PYGLIB_DEFINE_TYPE("gobject.GParamSpec", PyGParamSpec_Type, PyGParamSpec); + static int pyg_param_spec_compare(PyGParamSpec *self, PyGParamSpec *v) { @@ -355,28 +359,6 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) return NULL; } -PyTypeObject PyGParamSpec_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "gobject.GParamSpec", - sizeof(PyGParamSpec), - 0, - (destructor)pyg_param_spec_dealloc, - (printfunc)0, - (getattrfunc)pyg_param_spec_getattr, - (setattrfunc)0, - (cmpfunc)pyg_param_spec_compare, - (reprfunc)pyg_param_spec_repr, - 0, - 0, - 0, - (hashfunc)pyg_param_spec_hash, - (ternaryfunc)0, - (reprfunc)0, - 0L,0L,0L,0L, - NULL -}; - /** * pyg_param_spec_new: * @pspec: a GParamSpec. @@ -403,6 +385,12 @@ void pygobject_paramspec_register_types(PyObject *d) { PyGParamSpec_Type.ob_type = &PyType_Type; + PyGParamSpec_Type.tp_dealloc = (destructor)pyg_param_spec_dealloc; + PyGParamSpec_Type.tp_getattr = (getattrfunc)pyg_param_spec_getattr; + PyGParamSpec_Type.tp_compare = (cmpfunc)pyg_param_spec_compare; + PyGParamSpec_Type.tp_repr = (reprfunc)pyg_param_spec_repr; + PyGParamSpec_Type.tp_hash = (hashfunc)pyg_param_spec_hash; + if (PyType_Ready(&PyGParamSpec_Type)) return; PyDict_SetItemString(d, "GParamSpec", (PyObject *)&PyGParamSpec_Type); |
