summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/format/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/format/format.c')
-rw-r--r--plugins/pychrysa/format/format.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/plugins/pychrysa/format/format.c b/plugins/pychrysa/format/format.c
index fb8b249..22ade20 100644
--- a/plugins/pychrysa/format/format.c
+++ b/plugins/pychrysa/format/format.c
@@ -576,26 +576,16 @@ PyTypeObject *get_python_binary_format_type(void)
bool register_python_binary_format(PyObject *module)
{
PyTypeObject *py_bin_format_type; /* Type Python 'BinFormat' */
- int ret; /* Bilan d'un appel */
PyObject *dict; /* Dictionnaire du module */
py_bin_format_type = get_python_binary_format_type();
- py_bin_format_type->tp_base = &PyGObject_Type;
- py_bin_format_type->tp_basicsize = py_bin_format_type->tp_base->tp_basicsize;
-
APPLY_ABSTRACT_FLAG(py_bin_format_type);
- if (PyType_Ready(py_bin_format_type) != 0)
- return false;
-
- Py_INCREF(py_bin_format_type);
- ret = PyModule_AddObject(module, "BinFormat", (PyObject *)py_bin_format_type);
- if (ret != 0) return false;
-
dict = PyModule_GetDict(module);
- pygobject_register_class(dict, "BinFormat", G_TYPE_BIN_FORMAT, py_bin_format_type,
- Py_BuildValue("(O)", py_bin_format_type->tp_base));
+
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_FORMAT, py_bin_format_type, &PyGObject_Type))
+ return false;
return true;