summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/gui/editem.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-07-30 10:57:08 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-07-30 10:57:08 (GMT)
commitfb1d26845908d131b1c92d7d7cd1bc402b656ca4 (patch)
treea6c6a30482ce97dfe7b985116877bb0ce8b7b0a0 /plugins/pychrysa/gui/editem.c
parent7b8eed3f8207fe9b629165f8230e38ee620900ea (diff)
Registered properly the PyGObject wrappers for Python classes.
Diffstat (limited to 'plugins/pychrysa/gui/editem.c')
-rw-r--r--plugins/pychrysa/gui/editem.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/plugins/pychrysa/gui/editem.c b/plugins/pychrysa/gui/editem.c
index e2289b0..495e5e4 100644
--- a/plugins/pychrysa/gui/editem.c
+++ b/plugins/pychrysa/gui/editem.c
@@ -439,26 +439,16 @@ PyTypeObject *get_python_editor_item_type(void)
bool register_python_editor_item(PyObject *module)
{
- PyTypeObject *py_editor_item_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
+ PyTypeObject *py_editor_item_type; /* Type Python 'LoadedBinary' */
PyObject *dict; /* Dictionnaire du module */
py_editor_item_type = get_python_editor_item_type();
- py_editor_item_type->tp_base = &PyGObject_Type;
- py_editor_item_type->tp_basicsize = py_editor_item_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_editor_item_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_EDITOR_ITEM, py_editor_item_type, &PyGObject_Type))
return false;
- Py_INCREF(py_editor_item_type);
- ret = PyModule_AddObject(module, "EditorItem", (PyObject *)py_editor_item_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "EditorItem", G_TYPE_EDITOR_ITEM, py_editor_item_type,
- Py_BuildValue("(O)", py_editor_item_type->tp_base));
-
return true;
}