summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-03-09 18:04:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-03-09 18:04:49 (GMT)
commitdc8a2b19dbb32bfe49b1ff6640cc609238b392ca (patch)
tree2103c99baeb3b792bc82fc3db28bd16ecf72b70e /plugins
parentf8f804cf7ff9a62404b843cf303c762101572784 (diff)
Stored and loaded panels attributes using the global configuration.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysa/gui/panels/panel.c21
-rw-r--r--plugins/python/welcome/panel.py3
-rw-r--r--plugins/python/welcome/plugin.py4
3 files changed, 20 insertions, 8 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;
diff --git a/plugins/python/welcome/panel.py b/plugins/python/welcome/panel.py
index 7b46c57..a577c8c 100644
--- a/plugins/python/welcome/panel.py
+++ b/plugins/python/welcome/panel.py
@@ -19,7 +19,8 @@ class WelcomePanel(PanelItem):
content = self._build_panel_content()
- super(WelcomePanel, self).__init__(PanelItem.PIP_SINGLETON, 'Welcome', 'First commands', content, 'N')
+ super(WelcomePanel, self).__init__(PanelItem.PIP_SINGLETON, 'Welcome', 'First commands', \
+ content, False, 'N')
def _build_panel_content(self):
diff --git a/plugins/python/welcome/plugin.py b/plugins/python/welcome/plugin.py
index 8a9f9a2..a26c93b 100644
--- a/plugins/python/welcome/plugin.py
+++ b/plugins/python/welcome/plugin.py
@@ -30,7 +30,7 @@ class WelcomePlugin(PluginModule):
self._panel = WelcomePanel()
- self._panel.dock()
- self._panel.register()
+ #self._panel.dock()
+ #self._panel.register()
return True