diff options
Diffstat (limited to 'plugins/pychrysa/gui/panels')
-rw-r--r-- | plugins/pychrysa/gui/panels/log.c | 14 | ||||
-rw-r--r-- | plugins/pychrysa/gui/panels/panel.c | 14 |
2 files changed, 4 insertions, 24 deletions
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; } |