diff options
Diffstat (limited to 'plugins/pychrysa/glibext/configuration.c')
-rw-r--r-- | plugins/pychrysa/glibext/configuration.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/plugins/pychrysa/glibext/configuration.c b/plugins/pychrysa/glibext/configuration.c index fd35b19..b35806a 100644 --- a/plugins/pychrysa/glibext/configuration.c +++ b/plugins/pychrysa/glibext/configuration.c @@ -31,6 +31,9 @@ #include <glibext/configuration.h> +#include "../helpers.h" + + /* ---------------------------- ELEMENT DE CONFIGURATION ---------------------------- */ @@ -574,29 +577,19 @@ static bool py_config_param_define_constants(PyObject *dict) bool register_python_config_param(PyObject *module) { - PyTypeObject *py_config_param_type; /* Type Python 'ConfigParam' */ - int ret; /* Bilan d'un appel */ + PyTypeObject *py_config_param_type; /* Type Python 'ConfigParam' */ PyObject *dict; /* Dictionnaire du module */ py_config_param_type = get_python_config_param_type(); - py_config_param_type->tp_base = &PyGObject_Type; - py_config_param_type->tp_basicsize = py_config_param_type->tp_base->tp_basicsize; + dict = PyModule_GetDict(module); - if (PyType_Ready(py_config_param_type) != 0) + if (!register_class_for_pygobject(dict, G_TYPE_CFG_PARAM, py_config_param_type, &PyGObject_Type)) return false; if (!py_config_param_define_constants(py_config_param_type->tp_dict)) return false; - Py_INCREF(py_config_param_type); - ret = PyModule_AddObject(module, "ConfigParam", (PyObject *)py_config_param_type); - if (ret != 0) return false; - - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "ConfigParam", G_TYPE_CFG_PARAM, py_config_param_type, - Py_BuildValue("(O)", py_config_param_type->tp_base)); - return true; } @@ -779,7 +772,7 @@ PyTypeObject *get_python_config_param_iterator_type(void) bool register_python_config_param_iterator(PyObject *module) { - PyTypeObject *py_config_param_iterator_type; /* Type Python 'ConfigParamIterator' */ + PyTypeObject *py_config_param_iterator_type;/* Type Python 'Cnf...Iter'*/ int ret; /* Bilan d'un appel */ py_config_param_iterator_type = get_python_config_param_iterator_type(); @@ -1158,24 +1151,17 @@ PyTypeObject *get_python_generic_config_type(void) bool register_python_generic_config(PyObject *module) { PyTypeObject *py_generic_config_type; /* Type Python 'GenConfig' */ - int ret; /* Bilan d'un appel */ PyObject *dict; /* Dictionnaire du module */ py_generic_config_type = get_python_generic_config_type(); - py_generic_config_type->tp_base = &PyGObject_Type; - py_generic_config_type->tp_basicsize = py_generic_config_type->tp_base->tp_basicsize; - if (PyType_Ready(py_generic_config_type) != 0) return false; - Py_INCREF(py_generic_config_type); - ret = PyModule_AddObject(module, "GenConfig", (PyObject *)py_generic_config_type); - if (ret != 0) return false; - dict = PyModule_GetDict(module); - pygobject_register_class(dict, "GenConfig", G_TYPE_GEN_CONFIG, py_generic_config_type, - Py_BuildValue("(O)", py_generic_config_type->tp_base)); + + if (!register_class_for_pygobject(dict, G_TYPE_GEN_CONFIG, py_generic_config_type, &PyGObject_Type)) + return false; return true; |