summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/gui/panels/panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/gui/panels/panel.c')
-rw-r--r--plugins/pychrysa/gui/panels/panel.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index 1246717..bfdfb5f 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -28,6 +28,7 @@
#include <pygobject.h>
+#include <core/params.h>
#include <gui/core/panels.h>
#include <gui/panels/panel.h>
@@ -69,18 +70,29 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
const char *name; /* Désignation humaine */
const char *lname; /* Nom version longue */
PyGObject *widget; /* Composant visuel du panneau */
+ int startup; /* Recommandation au démarrage */
const char *path; /* Placement à l'affichage */
int ret; /* Bilan de lecture des args. */
GPanelItem *item; /* Elément de l'éditeur */
- ret = PyArg_ParseTuple(args, "kssOs", &personality, &name, &lname, &widget, &path);
+ ret = PyArg_ParseTuple(args, "kssOps", &personality, &name, &lname, &widget, &startup, &path);
if (!ret) return -1;
item = g_panel_item_new(personality, name, lname,
- GTK_WIDGET(pygobject_get(widget)), path);
+ GTK_WIDGET(pygobject_get(widget)), startup, path);
/* FIXME ? Est-ce à l'utilisateur de s'enregistrer ? */
- register_panel_item(item, get_internal_ref());
+ register_panel_item(item, get_internal_ref(), get_main_configuration());
+
+ /**
+ * Si Python ne voit plus la variable représentant le panneau utilisée,
+ * il va la supprimer, ce qui va supprimer le composant GTK.
+ *
+ * On sera donc en situation de Use-After-Free, dont les conséquences
+ * arrivent très vite.
+ */
+ g_object_ref(GTK_WIDGET(pygobject_get(widget)));
+ Py_INCREF(self);
/* Enregistrement auprès de PyGObject */
@@ -112,8 +124,7 @@ static PyObject *py_panel_item_dock(PyObject *self, PyObject *args)
item = G_PANEL_ITEM(pygobject_get(self));
- /* FIXME : les panneaux sont incrustés d'office ! */
- //g_panel_item_dock(item);
+ g_panel_item_dock(item);
Py_RETURN_NONE;