summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/gui/panels
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-12-18 22:44:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-12-18 22:44:24 (GMT)
commitf4dbbab3190d13e61f125eea51a0ecec2ab9e897 (patch)
tree2362579b428c363e2cca94e0fa89b1e39b7a50e7 /plugins/pychrysa/gui/panels
parent64e09a6c3e39785975b5322973ed83734cedb82e (diff)
Created a proper panel for the Android permissions in the editor.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@305 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/gui/panels')
-rw-r--r--plugins/pychrysa/gui/panels/panel.c33
-rw-r--r--plugins/pychrysa/gui/panels/panel.h4
2 files changed, 20 insertions, 17 deletions
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index b1bcc61..4b982d0 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -40,7 +40,6 @@ static PyObject *py_panel_item_dock(PyObject *, PyObject *);
-
/******************************************************************************
* *
* Paramètres : type = type de l'objet à instancier. *
@@ -71,7 +70,7 @@ static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject
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));
+ result = _py_panel_item_from_c(G_PANEL_ITEM(item), type);
g_object_unref(item);
return (PyObject *)result;
@@ -79,9 +78,11 @@ static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject
}
+
/******************************************************************************
* *
* 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'. *
* *
@@ -91,14 +92,16 @@ static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject
* *
******************************************************************************/
-PyObject *py_panel_item_from_c(GPanelItem *item)
+PyObject *_py_panel_item_from_c(GPanelItem *item, PyTypeObject *type)
{
PyObject *module; /* Module d'appartenance */
- PyTypeObject *type; /* Type Python correspondant */
- module = PyImport_ImportModule("pychrysalide.gui.panels");
- type = (PyTypeObject *)PyObject_GetAttrString(module, "PanelItem");
- Py_DECREF(module);
+ if (type == NULL)
+ {
+ module = PyImport_ImportModule("pychrysalide.gui.panels");
+ type = (PyTypeObject *)PyObject_GetAttrString(module, "PanelItem");
+ Py_DECREF(module);
+ }
pychrysalide_set_instance_data(G_OBJECT(item), type);
@@ -128,7 +131,7 @@ static PyObject *py_panel_item_dock(PyObject *self, PyObject *args)
g_panel_item_dock(item);
- return Py_None;
+ Py_RETURN_NONE;
}
@@ -145,8 +148,6 @@ static PyObject *py_panel_item_dock(PyObject *self, PyObject *args)
-
-
/******************************************************************************
* *
* Paramètres : module = module dont la définition est à compléter. *
@@ -161,14 +162,14 @@ static PyObject *py_panel_item_dock(PyObject *self, PyObject *args)
bool register_python_panel_item(PyObject *module)
{
- PyObject *pygobj_mod; /* Module Python-GObject */
+ PyObject *parent_mod; /* Module Python-EditorItem */
int ret; /* Bilan d'un appel */
static PyMethodDef py_panel_item_methods[] = {
{
"dock", (PyCFunction)py_panel_item_dock,
METH_NOARGS,
- "DIsplay the panel item in the right place."
+ "Display the panel item in the right place."
},
{ NULL }
};
@@ -195,11 +196,11 @@ bool register_python_panel_item(PyObject *module)
};
- pygobj_mod = PyImport_ImportModule("gobject");
- if (pygobj_mod == NULL) return false;
+ parent_mod = PyImport_ImportModule("pychrysalide.gui");
+ if (parent_mod == NULL) return false;
- py_panel_item_type.tp_base = (PyTypeObject *)PyObject_GetAttrString(pygobj_mod, "GObject");
- Py_DECREF(pygobj_mod);
+ py_panel_item_type.tp_base = (PyTypeObject *)PyObject_GetAttrString(parent_mod, "EditorItem");
+ Py_DECREF(parent_mod);
if (PyType_Ready(&py_panel_item_type) < 0)
return false;
diff --git a/plugins/pychrysa/gui/panels/panel.h b/plugins/pychrysa/gui/panels/panel.h
index 8d06094..a7b6e0c 100644
--- a/plugins/pychrysa/gui/panels/panel.h
+++ b/plugins/pychrysa/gui/panels/panel.h
@@ -34,7 +34,9 @@
/* Crée un nouvel objet Python de type 'PanelItem'. */
-PyObject *py_panel_item_from_c(GPanelItem *);
+PyObject *_py_panel_item_from_c(GPanelItem *, PyTypeObject *);
+
+#define py_panel_item_from_c(item) _py_panel_item_from_c(item, NULL)
/* Prend en charge l'objet 'pychrysalide.gui.panels.PanelItem'. */
bool register_python_panel_item(PyObject *module);