From 3869f3ca63ee3bcb2e3b643b2d7f2e9ff86a2d09 Mon Sep 17 00:00:00 2001 From: Gian Mario Tagliaretti Date: Sun, 29 Mar 2009 15:47:09 +0000 Subject: should accept None for mount_operation. 2009-03-29 Gian Mario Tagliaretti * gio/gvolume.override: (_wrap_g_volume_mount) should accept None for mount_operation. svn path=/trunk/; revision=1040 --- ChangeLog | 5 +++++ gio/gvolume.override | 25 +++++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b6baf0..bac7561 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-03-29 Gian Mario Tagliaretti + + * gio/gvolume.override: (_wrap_g_volume_mount) should accept None + for mount_operation. + 2009-03-29 Gian Mario Tagliaretti * gio/gvolume.override: Swap kwargs names to reflect the code. 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, ¬ify->callback, &py_flags, &py_cancellable, ¬ify->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); -- cgit