summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/glibext/configuration.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/glibext/configuration.c')
-rw-r--r--plugins/pychrysalide/glibext/configuration.c70
1 files changed, 47 insertions, 23 deletions
diff --git a/plugins/pychrysalide/glibext/configuration.c b/plugins/pychrysalide/glibext/configuration.c
index a780f73..18ed5db 100644
--- a/plugins/pychrysalide/glibext/configuration.c
+++ b/plugins/pychrysalide/glibext/configuration.c
@@ -31,6 +31,7 @@
#include <glibext/configuration.h>
+#include "../access.h"
#include "../helpers.h"
@@ -575,20 +576,27 @@ static bool py_config_param_define_constants(PyObject *dict)
* *
******************************************************************************/
-bool register_python_config_param(PyObject *module)
+bool ensure_python_config_param_is_registered(void)
{
- PyTypeObject *py_config_param_type; /* Type Python 'ConfigParam' */
+ PyTypeObject *type; /* Type Python 'ConfigParam' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_config_param_type = get_python_config_param_type();
+ type = get_python_config_param_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.glibext");
+
+ dict = PyModule_GetDict(module);
- if (!register_class_for_pygobject(dict, G_TYPE_CFG_PARAM, py_config_param_type, &PyGObject_Type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_CFG_PARAM, type, &PyGObject_Type))
+ return false;
- if (!py_config_param_define_constants(py_config_param_type->tp_dict))
- return false;
+ if (!py_config_param_define_constants(type->tp_dict))
+ return false;
+
+ }
return true;
@@ -770,21 +778,30 @@ PyTypeObject *get_python_config_param_iterator_type(void)
* *
******************************************************************************/
-bool register_python_config_param_iterator(PyObject *module)
+bool ensure_python_config_param_iterator_is_registered(void)
{
- PyTypeObject *py_config_param_iterator_type;/* Type Python 'Cnf...Iter'*/
+ PyTypeObject *type; /* Type Python 'Cnf...Iter'*/
+ PyObject *module; /* Module à recompléter */
int ret; /* Bilan d'un appel */
- py_config_param_iterator_type = get_python_config_param_iterator_type();
+ type = get_python_config_param_iterator_type();
+
+ type->tp_base = &PyBaseObject_Type;
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.glibext");
- py_config_param_iterator_type->tp_base = &PyBaseObject_Type;
+ if (PyType_Ready(type) != 0)
+ return false;
- if (PyType_Ready(py_config_param_iterator_type) != 0)
- return false;
+ Py_INCREF(type);
+ ret = PyModule_AddObject(module, "ConfigParamIterator", (PyObject *)type);
- Py_INCREF(py_config_param_iterator_type);
- ret = PyModule_AddObject(module, "ConfigParamIterator", (PyObject *)py_config_param_iterator_type);
- if (ret != 0) return false;
+ if (ret != 0)
+ return false;
+
+ }
return true;
@@ -1148,17 +1165,24 @@ PyTypeObject *get_python_generic_config_type(void)
* *
******************************************************************************/
-bool register_python_generic_config(PyObject *module)
+bool ensure_python_generic_config_is_registered(void)
{
- PyTypeObject *py_generic_config_type; /* Type Python 'GenConfig' */
+ PyTypeObject *type; /* Type Python 'GenConfig' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_generic_config_type = get_python_generic_config_type();
+ type = get_python_generic_config_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.glibext");
+
+ dict = PyModule_GetDict(module);
- dict = PyModule_GetDict(module);
+ if (!register_class_for_pygobject(dict, G_TYPE_GEN_CONFIG, type, &PyGObject_Type))
+ return false;
- if (!register_class_for_pygobject(dict, G_TYPE_GEN_CONFIG, py_generic_config_type, &PyGObject_Type))
- return false;
+ }
return true;