summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-23 09:24:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-23 09:24:34 (GMT)
commitdf6298b8f0f2144ad8e975ab0b0b30cc73ee9b5c (patch)
tree714fe10115f7c7e785072ff40071039712f6b5b3 /plugins/pychrysalide
parent1e46553615fa6a7057a7c46c249485365b4c147c (diff)
Fix the Python scripts loading.
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r--plugins/pychrysalide/plugin.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c
index f8b4fc8..57891a6 100644
--- a/plugins/pychrysalide/plugin.c
+++ b/plugins/pychrysalide/plugin.c
@@ -80,7 +80,7 @@ static bool g_python_plugin_read_interface(GPythonPlugin *);
static bool g_python_plugin_do_init(GPythonPlugin *);
/* Procède à l'extinction du greffon. */
-static bool g_python_plugin_do_exit(GPythonPlugin *, GObject *);
+static bool g_python_plugin_do_exit(GPythonPlugin *);
/* Procède à une opération liée à un contenu binaire. */
static void g_python_plugin_handle_binary_content(const GPythonPlugin *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
@@ -557,18 +557,20 @@ static bool g_python_plugin_read_interface(GPythonPlugin *plugin)
static bool g_python_plugin_do_init(GPythonPlugin *plugin)
{
bool result; /* Bilan à retourner */
- PyObject *args; /* Arguments pour l'appel */
PyObject *value; /* Valeur obtenue */
- args = Py_None;
- Py_INCREF(args);
+ if (!has_python_method(plugin->instance, "init"))
+ result = true;
- value = run_python_method(plugin->instance, "init", args);
+ else
+ {
+ value = run_python_method(plugin->instance, "init", NULL);
- result = (value != NULL && PyObject_IsTrue(value));
+ result = (value != NULL && PyObject_IsTrue(value));
- Py_XDECREF(value);
- Py_DECREF(args);
+ Py_XDECREF(value);
+
+ }
return result;
@@ -578,7 +580,6 @@ static bool g_python_plugin_do_init(GPythonPlugin *plugin)
/******************************************************************************
* *
* Paramètres : plugin = greffon à initialiser. *
-* ref = espace de référencement global. *
* *
* Description : Procède à l'extinction du greffon. *
* *
@@ -588,21 +589,23 @@ static bool g_python_plugin_do_init(GPythonPlugin *plugin)
* *
******************************************************************************/
-static bool g_python_plugin_do_exit(GPythonPlugin *plugin, GObject *ref)
+static bool g_python_plugin_do_exit(GPythonPlugin *plugin)
{
bool result; /* Bilan à retourner */
- PyObject *args; /* Arguments pour l'appel */
PyObject *value; /* Valeur obtenue */
- args = PyTuple_New(1);
- PyTuple_SetItem(args, 0, pygobject_new(ref));
+ if (!has_python_method(plugin->instance, "exit"))
+ result = true;
- value = run_python_method(plugin->instance, "exit", args);
+ else
+ {
+ value = run_python_method(plugin->instance, "exit", NULL);
- result = PyObject_IsTrue(value);
+ result = (value != NULL && PyObject_IsTrue(value));
- Py_XDECREF(value);
- Py_DECREF(args);
+ Py_XDECREF(value);
+
+ }
return result;