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/pygflags.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/pygflags.c')
-rw-r--r-- | gobject/pygflags.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/gobject/pygflags.c b/gobject/pygflags.c index 0085560..3108378 100644 --- a/gobject/pygflags.c +++ b/gobject/pygflags.c @@ -31,6 +31,8 @@ GQuark pygflags_class_key; +PYGLIB_DEFINE_TYPE("gobject.GFlags", PyGFlags_Type, PyGFlags); + #define GET_INT_VALUE(x) (((PyIntObject*)x)->ob_ival) static PyObject * @@ -459,53 +461,18 @@ static PyNumberMethods pyg_flags_as_number = { 0, /* nb_inplace_true_divide */ }; -PyTypeObject PyGFlags_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "gobject.GFlags", - sizeof(PyGFlags), - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)pyg_flags_repr, /* tp_repr */ - &pyg_flags_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)pyg_flags_repr, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)pyg_flags_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - pyg_flags_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - pyg_flags_new, /* tp_new */ -}; - void pygobject_flags_register_types(PyObject *d) { pygflags_class_key = g_quark_from_static_string("PyGFlags::class"); PyGFlags_Type.tp_base = &PyInt_Type; + PyGFlags_Type.tp_repr = (reprfunc)pyg_flags_repr; + PyGFlags_Type.tp_as_number = &pyg_flags_as_number; + PyGFlags_Type.tp_str = (reprfunc)pyg_flags_repr; + PyGFlags_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE; + PyGFlags_Type.tp_richcompare = (richcmpfunc)pyg_flags_richcompare; + PyGFlags_Type.tp_getset = pyg_flags_getsets; + PyGFlags_Type.tp_new = pyg_flags_new; PYGOBJECT_REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS); } |