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.c64
1 files changed, 14 insertions, 50 deletions
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index e713cc0..3170a66 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -32,91 +32,56 @@
#include "../editem.h"
+#include "../../quirks.h"
-/* Crée un nouvel objet Python de type 'PanelItem'. */
-#if 0
-static PyObject *py_panel_item_new(PyTypeObject *, PyObject *, PyObject *);
-#endif
+/* Initialise une instance sur la base du dérivé de GObject. */
+static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds);
/* Place un panneau dans l'ensemble affiché. */
static PyObject *py_panel_item_dock(PyObject *, PyObject *);
-#if 0
/******************************************************************************
* *
-* Paramètres : type = type de l'objet à instancier. *
+* Paramètres : self = objet à initialiser (théoriquement). *
* args = arguments fournis à l'appel. *
* kwds = arguments de type key=val fournis. *
* *
-* Description : Crée un nouvel objet Python de type 'PanelItem'. *
+* Description : Initialise une instance sur la base du dérivé de GObject. *
* *
-* Retour : Instance Python mise en place. *
+* Retour : 0. *
* *
* Remarques : - *
* *
******************************************************************************/
-static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
{
- PyObject *result; /* Instance à retourner */
const char *name; /* Désignation humaine */
const char *lname; /* Nom version longue */
PyGObject *widget; /* Composant visuel du panneau */
const char *path; /* Placement à l'affichage */
int ret; /* Bilan de lecture des args. */
- GEditorItem *item; /* Version GLib du format */
+ GEditorItem *item; /* Elément de l'éditeur */
ret = PyArg_ParseTuple(args, "ssOs", &name, &lname, &widget, &path);
- if (!ret) Py_RETURN_NONE;
+ if (!ret) return -1;
item = g_panel_item_new(get_internal_ref(), name, lname,
GTK_WIDGET(pygobject_get(widget)), path);
- result = _py_panel_item_from_c(G_PANEL_ITEM(item), type);
- g_object_unref(item);
+ /* Enregistrement auprès de PyGObject */
- return result;
+ ((PyGObject *)self)->obj = G_OBJECT(item);
-}
-
-
-
-/******************************************************************************
-* *
-* Paramètres : item = instance existante GLib. *
-* type = éventuel type final de l'instance Python imposé. *
-* *
-* Description : Crée un nouvel objet Python de type 'PanelItem'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyObject *_py_panel_item_from_c(GPanelItem *item, PyTypeObject *type)
-{
- PyObject *module; /* Module d'appartenance */
-
- if (type == NULL)
- {
- module = PyImport_ImportModule("pychrysalide.gui.panels");
- type = (PyTypeObject *)PyObject_GetAttrString(module, "PanelItem");
- Py_DECREF(module);
- /* FIXME : type refcount ? */
- }
- else Py_INCREF(type);
-
- pychrysalide_set_instance_data(G_OBJECT(item), type);
+ pygobject_register_wrapper(self);
- return pygobject_new(G_OBJECT(item));
+ return 0;
}
-#endif
/******************************************************************************
@@ -185,8 +150,7 @@ PyTypeObject *get_python_panel_item_type(void)
.tp_methods = py_panel_item_methods,
.tp_getset = py_panel_item_getseters,
- //.tp_new = (newfunc)py_panel_item_new,
- //.tp_init = (initproc)pychrysalide_allow_args_for_gobjects
+ .tp_init = (initproc)py_panel_item_init
};