summaryrefslogtreecommitdiff
path: root/plugins/pychrysa
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-08-29 22:30:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-08-29 22:30:58 (GMT)
commit6ba73df8224dc2a88fe5f37a331960936758036e (patch)
tree3db220cc946f3a23887016f3922fe94545e27620 /plugins/pychrysa
parentd91239074b9042988d08093948059096942bdcfc (diff)
Skipped the link to the global reference space when loading plugins.
Diffstat (limited to 'plugins/pychrysa')
-rw-r--r--plugins/pychrysa/plugin.c15
-rw-r--r--plugins/pychrysa/plugin.h2
-rw-r--r--plugins/pychrysa/pychrysa.c12
-rw-r--r--plugins/pychrysa/pychrysa.h2
4 files changed, 14 insertions, 17 deletions
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index 651de7d..7d44f10 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -71,7 +71,7 @@ static void g_python_plugin_init(GPythonPlugin *);
static bool g_python_plugin_read_interface(GPythonPlugin *);
/* Procède à l'initialisation du greffon. */
-static bool g_python_plugin_do_init(GPythonPlugin *, GObject *);
+static bool g_python_plugin_do_init(GPythonPlugin *);
/* Procède à l'extinction du greffon. */
static bool g_python_plugin_do_exit(GPythonPlugin *, GObject *);
@@ -141,7 +141,6 @@ static void g_python_plugin_init(GPythonPlugin *plugin)
* *
* Paramètres : modname = nom du module à charger. *
* filename = chemin d'accès au code Python à charger. *
-* ref = espace de référencement global. *
* *
* Description : Crée un greffon à partir de code Python. *
* *
@@ -151,7 +150,7 @@ static void g_python_plugin_init(GPythonPlugin *plugin)
* *
******************************************************************************/
-GPluginModule *g_python_plugin_new(const char *modname, const char *filename, GObject *ref)
+GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
{
GPythonPlugin *result; /* Structure à retourner */
PyObject *name; /* Chemin d'accès pour Python */
@@ -346,7 +345,7 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename, GO
/* Conclusion */
- if (!g_plugin_module_load(G_PLUGIN_MODULE(result), ref))
+ if (!g_plugin_module_load(G_PLUGIN_MODULE(result)))
goto gppn_bad_plugin;
return G_PLUGIN_MODULE(result);
@@ -485,18 +484,18 @@ static bool g_python_plugin_read_interface(GPythonPlugin *plugin)
* *
******************************************************************************/
-static bool g_python_plugin_do_init(GPythonPlugin *plugin, GObject *ref)
+static bool g_python_plugin_do_init(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));
+ args = Py_None;
+ Py_INCREF(args);
value = run_python_method(plugin->instance, "init", args);
- result = PyObject_IsTrue(value);
+ result = (value != NULL && PyObject_IsTrue(value));
Py_XDECREF(value);
Py_DECREF(args);
diff --git a/plugins/pychrysa/plugin.h b/plugins/pychrysa/plugin.h
index 04b65ef..ca451a8 100644
--- a/plugins/pychrysa/plugin.h
+++ b/plugins/pychrysa/plugin.h
@@ -57,7 +57,7 @@ typedef struct _GPythonPluginClass GPythonPluginClass;
GType g_python_plugin_get_type(void);
/* Crée un greffon à partir de code Python. */
-GPluginModule *g_python_plugin_new(const char *, const char *, GObject *);
+GPluginModule *g_python_plugin_new(const char *, const char *);
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c
index a404c1a..e9efc54 100644
--- a/plugins/pychrysa/pychrysa.c
+++ b/plugins/pychrysa/pychrysa.c
@@ -74,7 +74,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 *plugin, GObject *);
+static bool load_python_plugins(GPluginModule *);
@@ -402,7 +402,6 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
/******************************************************************************
* *
* Paramètres : plugin = instance représentant le greffon Python d'origine. *
-* ref = espace de référencement global. *
* *
* Description : Charge autant de greffons composés en Python que possible. *
* *
@@ -412,7 +411,7 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
* *
******************************************************************************/
-static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
+static bool load_python_plugins(GPluginModule *plugin)
{
char *paths; /* Emplacements de greffons */
char *save; /* Sauvegarde pour ré-entrance */
@@ -468,7 +467,7 @@ static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
filename = stradd(filename, G_DIR_SEPARATOR_S);
filename = stradd(filename, entry->d_name);
- pyplugin = g_python_plugin_new(modname, filename, ref);
+ pyplugin = g_python_plugin_new(modname, filename);
if (pyplugin == NULL)
g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
@@ -499,7 +498,6 @@ static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
/******************************************************************************
* *
* Paramètres : plugin = greffon à manipuler. *
-* ref = espace de référencement global. *
* *
* Description : Prend acte du chargement du greffon. *
* *
@@ -509,7 +507,7 @@ static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
* *
******************************************************************************/
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
{
bool result; /* Bilan à retourner */
DIR *dir; /* Répertoire à parcourir */
@@ -548,7 +546,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
PySys_SetArgv(0, (wchar_t *[]) { NULL });
- result = load_python_plugins(plugin, ref);
+ result = load_python_plugins(plugin);
cpi_done:
diff --git a/plugins/pychrysa/pychrysa.h b/plugins/pychrysa/pychrysa.h
index 594d362..51d0470 100644
--- a/plugins/pychrysa/pychrysa.h
+++ b/plugins/pychrysa/pychrysa.h
@@ -89,7 +89,7 @@ PyMODINIT_FUNC initpychrysa(void);
PyMODINIT_FUNC PyInit_pychrysalide(void);
/* Prend acte du chargement du greffon. */
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *, GObject *);
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *);