summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/gui
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/gui')
-rw-r--r--plugins/pychrysa/gui/editem.c16
-rw-r--r--plugins/pychrysa/gui/panels/log.c14
-rw-r--r--plugins/pychrysa/gui/panels/panel.c14
3 files changed, 7 insertions, 37 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;
}
diff --git a/plugins/pychrysa/gui/panels/log.c b/plugins/pychrysa/gui/panels/log.c
index ba68fe9..fcf5ac5 100644
--- a/plugins/pychrysa/gui/panels/log.c
+++ b/plugins/pychrysa/gui/panels/log.c
@@ -183,28 +183,18 @@ PyTypeObject *get_python_log_panel_type(void)
bool register_python_log_panel(PyObject *module)
{
PyTypeObject *py_log_panel_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_log_panel_type = get_python_log_panel_type();
- py_log_panel_type->tp_base = get_python_panel_item_type();
- py_log_panel_type->tp_basicsize = py_log_panel_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_log_panel_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_LOG_PANEL, py_log_panel_type, get_python_panel_item_type()))
return false;
if (!define_python_log_constants(py_log_panel_type))
return false;
- Py_INCREF(py_log_panel_type);
- ret = PyModule_AddObject(module, "LogPanel", (PyObject *)py_log_panel_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "LogPanel", G_TYPE_LOG_PANEL, py_log_panel_type,
- Py_BuildValue("(O)", py_log_panel_type->tp_base));
-
return true;
}
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index bfdfb5f..0e15fb1 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -226,28 +226,18 @@ static bool py_panel_item_define_constants(PyTypeObject *obj_type)
bool register_python_panel_item(PyObject *module)
{
PyTypeObject *py_panel_item_type; /* Type Python 'LoadedBinary' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_panel_item_type = get_python_panel_item_type();
- py_panel_item_type->tp_base = get_python_editor_item_type();
- py_panel_item_type->tp_basicsize = py_panel_item_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_panel_item_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, py_panel_item_type, get_python_editor_item_type()))
return false;
if (!py_panel_item_define_constants(py_panel_item_type))
return false;
- Py_INCREF(py_panel_item_type);
- ret = PyModule_AddObject(module, "PanelItem", (PyObject *)py_panel_item_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "PanelItem", G_TYPE_PANEL_ITEM, py_panel_item_type,
- Py_BuildValue("(O)", py_panel_item_type->tp_base));
-
return true;
}