diff options
author | Johan Dahlin <johan@gnome.org> | 2008-07-26 13:46:56 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-07-26 13:46:56 +0000 |
commit | 4cd2081ae3d8adacd4256742be9e90714783c242 (patch) | |
tree | c5e4fe6b3ca14cd5c994418a8f18a1d00116cfaf /glib/pygoptioncontext.c | |
parent | ec4671da7f7fe70f40dafb91a870fa644c2b9f2c (diff) | |
download | pygobject-4cd2081ae3d8adacd4256742be9e90714783c242.tar.gz pygobject-4cd2081ae3d8adacd4256742be9e90714783c242.tar.xz pygobject-4cd2081ae3d8adacd4256742be9e90714783c242.zip |
Convert the pid/mainloop/maincontext/optiongroup/optioncontext.
2008-07-26 Johan Dahlin <johan@gnome.org>
* glib/pygmaincontext.c (pyglib_maincontext_register_types):
* glib/pygmainloop.c (pyg_main_loop_init),
(pyglib_mainloop_register_types):
* glib/pygoptioncontext.c (pyg_option_context_set_main_group),
(pyglib_option_context_register_types):
* glib/pygoptiongroup.c (pyglib_option_group_register_types):
* glib/pygspawn.c (pyglib_spawn_register_types):
Convert the pid/mainloop/maincontext/optiongroup/optioncontext.
svn path=/trunk/; revision=872
Diffstat (limited to 'glib/pygoptioncontext.c')
-rw-r--r-- | glib/pygoptioncontext.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/glib/pygoptioncontext.c b/glib/pygoptioncontext.c index ea3c304..00bf7ee 100644 --- a/glib/pygoptioncontext.c +++ b/glib/pygoptioncontext.c @@ -28,6 +28,8 @@ #include "pyglib-private.h" #include "pygoptioncontext.h" +PYGLIB_DEFINE_TYPE("glib.OptionContext", PyGOptionContext_Type, PyGOptionContext) + static int pyg_option_context_init(PyGOptionContext *self, PyObject *args, @@ -201,7 +203,8 @@ pyg_option_context_set_main_group(PyGOptionContext *self, g_group = pyglib_option_group_transfer_group(group); if (g_group == NULL) { - PyErr_SetString(PyExc_RuntimeError, "Group is already in a OptionContext."); + PyErr_SetString(PyExc_RuntimeError, + "Group is already in a OptionContext."); return NULL; } @@ -277,49 +280,13 @@ static PyMethodDef pyg_option_context_methods[] = { { NULL, NULL, 0 }, }; -PyTypeObject PyGOptionContext_Type = { - PyObject_HEAD_INIT(NULL) - 0, - "gobject.OptionContext", - sizeof(PyGOptionContext), - 0, - /* methods */ - (destructor)pyg_option_context_dealloc, - (printfunc)0, - (getattrfunc)0, - (setattrfunc)0, - (cmpfunc)pyg_option_context_compare, - (reprfunc)0, - 0, - 0, - 0, - (hashfunc)0, - (ternaryfunc)0, - (reprfunc)0, - (getattrofunc)0, - (setattrofunc)0, - 0, - Py_TPFLAGS_DEFAULT, - NULL, - (traverseproc)0, - (inquiry)0, - (richcmpfunc)0, - 0, - (getiterfunc)0, - (iternextfunc)0, - pyg_option_context_methods, - 0, - 0, - NULL, - NULL, - (descrgetfunc)0, - (descrsetfunc)0, - 0, - (initproc)pyg_option_context_init, -}; - void pyglib_option_context_register_types(PyObject *d) { + PyGOptionContext_Type.tp_dealloc = (destructor)pyg_option_context_dealloc; + PyGOptionContext_Type.tp_compare = (cmpfunc)pyg_option_context_compare; + PyGOptionContext_Type.tp_flags = Py_TPFLAGS_DEFAULT; + PyGOptionContext_Type.tp_methods = pyg_option_context_methods; + PyGOptionContext_Type.tp_init = (initproc)pyg_option_context_init; PYGLIB_REGISTER_TYPE(d, PyGOptionContext_Type, "OptionContext"); } |