summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/pychrysa.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-27 20:44:31 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-27 20:44:31 (GMT)
commit4b1367d2fee7be0789744e1db35d6f9200b29163 (patch)
tree3b22581bf6a6d2da6d73a7fef30540282808ecb7 /plugins/pychrysalide/pychrysa.c
parentf6490769c12dbb3b7766c7e6861284b8fee9f9e6 (diff)
Updated the API in order to allow Python plugins to rely on native plugins.
Diffstat (limited to 'plugins/pychrysalide/pychrysa.c')
-rw-r--r--plugins/pychrysalide/pychrysa.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/plugins/pychrysalide/pychrysa.c b/plugins/pychrysalide/pychrysa.c
index 7772592..ff36dab 100644
--- a/plugins/pychrysalide/pychrysa.c
+++ b/plugins/pychrysalide/pychrysa.c
@@ -64,7 +64,7 @@
DEFINE_CHRYSALIDE_CONTAINER_PLUGIN("PyChrysalide", "Provides bindings to Python", "0.1.0",
- EMPTY_PG_LIST(.required), AL(PGA_PLUGIN_INIT, PGA_PLUGIN_EXIT));
+ EMPTY_PG_LIST(.required), AL(PGA_PLUGIN_INIT, PGA_PLUGIN_EXIT, PGA_NATIVE_LOADED));
/* Note la nature du chargement */
@@ -93,7 +93,7 @@ static bool is_current_abi_suitable(void);
static bool set_version_for_gtk_namespace(const char *);
/* Charge autant de greffons composés en Python que possible. */
-static bool load_python_plugins(GPluginModule *);
+static void load_python_plugins(GPluginModule *);
@@ -452,13 +452,13 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
* *
* Description : Charge autant de greffons composés en Python que possible. *
* *
-* Retour : true. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-static bool load_python_plugins(GPluginModule *plugin)
+static void load_python_plugins(GPluginModule *plugin)
{
char *paths; /* Emplacements de greffons */
char *save; /* Sauvegarde pour ré-entrance */
@@ -545,8 +545,6 @@ static bool load_python_plugins(GPluginModule *plugin)
}
- return true;
-
}
@@ -618,11 +616,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
* En mode autonome, le shell Python remonte bien l'erreur par contre.
*/
- if (_chrysalide_module == NULL)
- result = false;
-
- else
- result = load_python_plugins(plugin);
+ result = (_chrysalide_module != NULL);
_main_tstate = PyThreadState_Get();
@@ -656,6 +650,32 @@ G_MODULE_EXPORT void chrysalide_plugin_exit(GPluginModule *plugin)
/******************************************************************************
* *
+* Paramètres : plugin = greffon à manipuler. *
+* action = type d'action attendue. *
+* *
+* Description : Accompagne la fin du chargement des modules natifs. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+G_MODULE_EXPORT void chrysalide_plugin_on_native_loaded(GPluginModule *plugin, PluginAction action)
+{
+ if (!_standalone)
+ PyEval_AcquireLock();
+
+ load_python_plugins(plugin);
+
+ if (!_standalone)
+ PyEval_ReleaseLock();
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit les informations du thread principal. *