summaryrefslogtreecommitdiff
path: root/plugins/dex/python/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dex/python/format.c')
-rw-r--r--plugins/dex/python/format.c59
1 files changed, 5 insertions, 54 deletions
diff --git a/plugins/dex/python/format.c b/plugins/dex/python/format.c
index a406f62..a421549 100644
--- a/plugins/dex/python/format.c
+++ b/plugins/dex/python/format.c
@@ -25,6 +25,7 @@
#include "format.h"
+#include <assert.h>
#include <pygobject.h>
@@ -69,67 +70,17 @@ static PyObject *py_dex_format_new(PyTypeObject *type, PyObject *args, PyObject
{
PyObject *result; /* Instance à retourner */
PyObject *content_obj; /* Objet pour le contenu */
- PyObject *parent_obj; /* Objet pour le parent */
- PyObject *status_obj; /* Objet pour la progression */
int ret; /* Bilan de lecture des args. */
GBinContent *content; /* Instance GLib du contenu */
- GExeFormat *parent; /* Instance GLib du parent */
- GtkStatusStack *status; /* Instance GTK de suivi */
- GBinFormat *format; /* Création GLib à transmettre */
+ GExeFormat *format; /* Création GLib à transmettre */
- parent_obj = Py_None;
- status_obj = Py_None;
-
- ret = PyArg_ParseTuple(args, "O|OO", &content_obj, &parent_obj, &status_obj);
+ ret = PyArg_ParseTuple(args, "O!", get_python_binary_content_type(), &content_obj);
if (!ret) return NULL;
- ret = PyObject_IsInstance(content_obj, (PyObject *)get_python_binary_content_type());
- if (!ret)
- {
- PyErr_SetString(PyExc_TypeError, _("The first argument must be an instance of BinContent."));
- return NULL;
- }
-
content = G_BIN_CONTENT(pygobject_get(content_obj));
- if (parent_obj == Py_None)
- parent = NULL;
-
- else
- {
- ret = PyObject_IsInstance(parent_obj, (PyObject *)get_python_executable_format_type());
- if (!ret)
- {
- PyErr_SetString(PyExc_TypeError, _("The second argument must be a container format or None."));
- return NULL;
- }
-
- parent = G_EXE_FORMAT(pygobject_get(parent_obj));
-
- }
-
- if (status_obj == Py_None)
- status = NULL;
-
- else
- {
- ret = PyObject_IsInstance(status_obj, (PyObject *)get_python_binary_content_type());
- if (!ret)
- {
- PyErr_SetString(PyExc_TypeError, _("The third argument must be a status bar object or None."));
- return NULL;
- }
-
- status = GTK_STATUS_STACK(pygobject_get(status_obj));
-
- }
-
- format = g_dex_format_new(content, parent, status);
- if (format == NULL)
- {
- PyErr_SetString(PyExc_RuntimeError, _("Unable to load the DEX format."));
- return NULL;
- }
+ format = g_dex_format_new(content);
+ assert(format != NULL);
result = pygobject_new(G_OBJECT(format));