summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/loading.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
commitfb315963527f6412273829f09513325e446eb6c9 (patch)
tree361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/analysis/loading.c
parent36945bffa2ca648b58c99905ebf9b1b536a9188a (diff)
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/loading.c')
-rw-r--r--plugins/pychrysalide/analysis/loading.c43
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;