summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/glibext/codebuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/glibext/codebuffer.c')
-rw-r--r--plugins/pychrysa/glibext/codebuffer.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/plugins/pychrysa/glibext/codebuffer.c b/plugins/pychrysa/glibext/codebuffer.c
index 9d9bc96..efe3141 100644
--- a/plugins/pychrysa/glibext/codebuffer.c
+++ b/plugins/pychrysa/glibext/codebuffer.c
@@ -32,6 +32,7 @@
#include "../arch/vmpa.h"
+#include "../helpers.h"
@@ -146,25 +147,15 @@ PyTypeObject *get_python_code_buffer_type(void)
bool register_python_code_buffer(PyObject *module)
{
PyTypeObject *py_code_buffer_type; /* Type Python 'CodeBuffer' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_code_buffer_type = get_python_code_buffer_type();
- py_code_buffer_type->tp_base = &PyGObject_Type;
- py_code_buffer_type->tp_basicsize = py_code_buffer_type->tp_base->tp_basicsize;
+ dict = PyModule_GetDict(module);
- if (PyType_Ready(py_code_buffer_type) != 0)
+ if (!register_class_for_pygobject(dict, G_TYPE_CODE_BUFFER, py_code_buffer_type, &PyGObject_Type))
return false;
- Py_INCREF(py_code_buffer_type);
- ret = PyModule_AddObject(module, "CodeBuffer", (PyObject *)py_code_buffer_type);
- if (ret != 0) return false;
-
- dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "CodeBuffer", G_TYPE_CODE_BUFFER, py_code_buffer_type,
- Py_BuildValue("(O)", py_code_buffer_type->tp_base));
-
return true;
}