diff options
Diffstat (limited to 'plugins/pychrysalide/analysis/loading.c')
-rw-r--r-- | plugins/pychrysalide/analysis/loading.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/plugins/pychrysalide/analysis/loading.c b/plugins/pychrysalide/analysis/loading.c index fca9929..77ff7fa 100644 --- a/plugins/pychrysalide/analysis/loading.c +++ b/plugins/pychrysalide/analysis/loading.c @@ -31,6 +31,7 @@ #include <analysis/loading.h> +#include "../access.h" #include "../helpers.h" @@ -92,7 +93,7 @@ PyTypeObject *get_python_content_explorer_type(void) /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide...ContentExplorer'. * * * @@ -102,17 +103,24 @@ PyTypeObject *get_python_content_explorer_type(void) * * ******************************************************************************/ -bool register_python_content_explorer(PyObject *module) +bool ensure_python_content_explorer_is_registered(void) { - PyTypeObject *py_content_explorer_type; /* Type 'ContentExplorer' */ + PyTypeObject *type; /* Type 'ContentExplorer' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_content_explorer_type = get_python_content_explorer_type(); + type = get_python_content_explorer_type(); + + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis"); + + dict = PyModule_GetDict(module); - dict = PyModule_GetDict(module); + if (!register_class_for_pygobject(dict, G_TYPE_CONTENT_EXPLORER, type, &PyGObject_Type)) + return false; - if (!register_class_for_pygobject(dict, G_TYPE_CONTENT_EXPLORER, py_content_explorer_type, &PyGObject_Type)) - return false; + } return true; @@ -169,7 +177,7 @@ PyTypeObject *get_python_content_resolver_type(void) /****************************************************************************** * * -* Paramètres : module = module dont la définition est à compléter. * +* Paramètres : - * * * * Description : Prend en charge l'objet 'pychrysalide...ContentResolver'. * * * @@ -179,17 +187,24 @@ PyTypeObject *get_python_content_resolver_type(void) * * ******************************************************************************/ -bool register_python_content_resolver(PyObject *module) +bool ensure_python_content_resolver_is_registered(void) { - PyTypeObject *py_content_resolver_type; /* Type 'ContentResolver' */ + PyTypeObject *type; /* Type 'ContentResolver' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_content_resolver_type = get_python_content_resolver_type(); + type = get_python_content_resolver_type(); + + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.analysis"); + + dict = PyModule_GetDict(module); - dict = PyModule_GetDict(module); + if (!register_class_for_pygobject(dict, G_TYPE_CONTENT_RESOLVER, type, &PyGObject_Type)) + return false; - if (!register_class_for_pygobject(dict, G_TYPE_CONTENT_RESOLVER, py_content_resolver_type, &PyGObject_Type)) - return false; + } return true; |