summaryrefslogtreecommitdiffstats
path: root/gio/gvolume.override
diff options
context:
space:
mode:
Diffstat (limited to 'gio/gvolume.override')
-rw-r--r--gio/gvolume.override25
1 files changed, 19 insertions, 6 deletions
diff --git a/gio/gvolume.override b/gio/gvolume.override
index 310a849..9afe19d 100644
--- a/gio/gvolume.override
+++ b/gio/gvolume.override
@@ -30,7 +30,8 @@ _wrap_g_volume_mount(PyGObject *self,
"cancellable", "user_data", NULL };
PyGIONotify *notify;
PyObject *py_flags = NULL;
- PyGObject *mount_operation;
+ PyGObject *py_mount_operation = NULL;
+ GMountOperation *mount_operation = NULL;
PyGObject *py_cancellable = NULL;
GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
GCancellable *cancellable;
@@ -38,16 +39,28 @@ _wrap_g_volume_mount(PyGObject *self,
notify = pygio_notify_new();
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "O!O|OOO:Volume.mount",
+ "OO|OOO:Volume.mount",
kwlist,
- &PyGMountOperation_Type,
- &mount_operation,
+ &py_mount_operation,
&notify->callback,
&py_flags,
&py_cancellable,
&notify->data))
goto error;
-
+
+ if ((PyObject *)py_mount_operation == Py_None)
+ mount_operation = NULL;
+
+ else if (py_mount_operation && pygobject_check(py_mount_operation,
+ &PyGMountOperation_Type))
+ mount_operation = G_MOUNT_OPERATION(py_mount_operation->obj);
+
+ else if (py_mount_operation) {
+ PyErr_SetString(PyExc_TypeError,
+ "mount_operation should be a GMountOperation or None");
+ return NULL;
+ }
+
if (!pygio_notify_callback_is_valid(notify))
goto error;
@@ -62,7 +75,7 @@ _wrap_g_volume_mount(PyGObject *self,
g_volume_mount(G_VOLUME(self->obj),
flags,
- G_MOUNT_OPERATION(mount_operation->obj),
+ mount_operation,
cancellable,
(GAsyncReadyCallback)async_result_callback_marshal,
notify);