diff options
Diffstat (limited to 'plugins/pychrysalide')
-rw-r--r-- | plugins/pychrysalide/plugin.c | 37 |
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; |