summaryrefslogtreecommitdiffstats
path: root/gio
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-19 11:40:22 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-19 11:40:22 +0000
commit4d0b9fa9f506eb2888b51458668b6d7c542d8e08 (patch)
treee9a6be94877074509f149d4e6d121964f97d7899 /gio
parent629d93eae54072b0fea062c7e286ef932843add7 (diff)
downloadpygobject-4d0b9fa9f506eb2888b51458668b6d7c542d8e08.tar.gz
pygobject-4d0b9fa9f506eb2888b51458668b6d7c542d8e08.tar.xz
pygobject-4d0b9fa9f506eb2888b51458668b6d7c542d8e08.zip
Bind gio.Mount.unmount, gio.File.mount_mountable,
2008-07-19 Johan Dahlin <johan@gnome.org> * gio/gfile.override: * gio/gio.defs: * gio/gio.override: * tests/test_gio.py: Bind gio.Mount.unmount, gio.File.mount_mountable, gio.File.unmount_mountable and gio.File.mount_enclosing_volume. Add documents and tests. svn path=/trunk/; revision=837
Diffstat (limited to 'gio')
-rw-r--r--gio/gfile.override176
-rw-r--r--gio/gio.defs46
-rw-r--r--gio/gio.override55
3 files changed, 272 insertions, 5 deletions
diff --git a/gio/gfile.override b/gio/gfile.override
index 4a12e0d..9fcb883 100644
--- a/gio/gfile.override
+++ b/gio/gfile.override
@@ -300,19 +300,189 @@ _wrap_g_file_enumerate_children_async(PyGObject *self, PyObject *args, PyObject
Py_INCREF(Py_None);
return Py_None;
}
+%%
+override g_file_mount_mountable kwargs
+static PyObject *
+_wrap_g_file_mount_mountable(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGAsyncRequestNotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OOO:File.mount_mountable",
+ kwlist,
+ &PyGMountOperation_Type,
+ &mount_operation,
+ &notify->callback,
+ &py_flags,
+ &py_cancellable,
+ &notify->data))
+
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if (!PyCallable_Check(notify->callback))
+ {
+ PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+ Py_INCREF(notify->callback);
+ Py_XINCREF(notify->data);
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ return NULL;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ g_file_mount_mountable(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override g_file_unmount_mountable kwargs
+static PyObject *
+_wrap_g_file_unmount_mountable(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGAsyncRequestNotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *py_cancellable = NULL;
+ GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:File.unmount_mountable",
+ kwlist,
+ &notify->callback,
+ &py_flags,
+ &py_cancellable,
+ &notify->data))
+
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if (!PyCallable_Check(notify->callback))
+ {
+ PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+ Py_INCREF(notify->callback);
+ Py_XINCREF(notify->data);
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ return NULL;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ g_file_unmount_mountable(G_FILE(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override g_file_mount_enclosing_volume kwargs
+static PyObject *
+_wrap_g_file_mount_enclosing_volume(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGAsyncRequestNotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OOO:File.mount_enclosing_volume",
+ kwlist,
+ &PyGMountOperation_Type,
+ &mount_operation,
+ &notify->callback,
+ &py_flags,
+ &py_cancellable,
+ &notify->data))
+
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if (!PyCallable_Check(notify->callback))
+ {
+ PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+ Py_INCREF(notify->callback);
+ Py_XINCREF(notify->data);
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ return NULL;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ g_file_mount_enclosing_volume(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
/* GFile.append_to_async */
/* GFile.create_async */
/* GFile.eject_mountable */
/* GFile.find_enclosing_mount_async */
-/* GFile.mount_enclosing_volume */
-/* GFile.mount_mountable */
/* GFile.query_info_async */
/* GFile.replace_async */
/* GFile.replace_contents_async */
/* GFile.set_attributes_async */
/* GFile.set_display_name_async */
-/* GFile.unmount_mountable */
/* GFile.load_partial_contents_async: No ArgType for GFileReadMoreCallback */
/* GFile.copy: No ArgType for GFileProgressCallback */
/* GFile.move: No ArgType for GFileProgressCallback */
diff --git a/gio/gio.defs b/gio/gio.defs
index 4d07293..7a225d0 100644
--- a/gio/gio.defs
+++ b/gio/gio.defs
@@ -1843,6 +1843,19 @@
)
(define-method mount_enclosing_volume
+ (docstring
+"F.mount_enclosing_volume(mount_operaetion, callback, cancellable, user_data])\n"
+"Starts a mount_operation, mounting the volume that contains\n"
+"the file location.\n"
+"\n"
+"When this operation has completed, callback will be called with\n"
+"user_user data, and the operation can be finalized with\n"
+"gio.File.mount_enclosing_volume_finish().\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled\n"
+"by triggering the cancellable object from another thread.\n"
+"If the operation was cancelled, the error gio.ERROR_CANCELLED\n"
+"will be returned.")
(of-object "GFile")
(c-name "g_file_mount_enclosing_volume")
(return-type "none")
@@ -1865,6 +1878,18 @@
)
(define-method mount_mountable
+ (docstring
+"F.mount_mountable(mount_operation, callback, [flags, cancellable, user_data])\n"
+"Mounts a file of type gio.FILE_TYPE_MOUNTABLE. Using mount_operation,\n"
+"you can request callbacks when, for instance, passwords are needed\n"
+"during authentication.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled by\n"
+" triggering the cancellable object from another thread. If the\n"
+"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n"
+"\n"
+"When the operation is finished, callback will be called. You can then\n"
+"call g_file_mount_mountable_finish() to get the result of the operation.\n")
(of-object "GFile")
(c-name "g_file_mount_mountable")
(return-type "none")
@@ -1887,6 +1912,17 @@
)
(define-method unmount_mountable
+ (docstring
+"F.unmount_mountable(callback, [flags, cancellable, user_data])\n"
+"Unmounts a file of type gio.FILE_TYPE_MOUNTABLE.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled by\n"
+"triggering the cancellable object from another thread. If the\n"
+"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n"
+"\n"
+"When the operation is finished, callback will be called. You can\n"
+"then call g_file_unmount_mountable_finish() to get the\n"
+"result of the operation.\n")
(of-object "GFile")
(c-name "g_file_unmount_mountable")
(return-type "none")
@@ -3435,6 +3471,12 @@
)
(define-method unmount
+ (docstring
+"M.unmount(callback, [flags, cancellable, user_data])\n"
+"Unmounts a mount. This is an asynchronous operation, and is finished\n"
+"by calling gio.Mount.unmount_finish() with the mount and gio.AsyncResults\n"
+"data returned in the callback."
+)
(of-object "GMount")
(c-name "g_mount_unmount")
(return-type "none")
@@ -3695,10 +3737,10 @@
"S.write_async(buffer, callback [,io_priority] [,cancellable] [,user_data])\n"
"\n"
"Request an asynchronous write of count bytes from buffer into the stream.\n"
-" When the operation is finished callback will be called. You can then call \n"
+"When the operation is finished callback will be called. You can then call\n"
"gio.OutputStream.write_finish() to get the result of the operation.\n"
"On success, the number of bytes written will be passed to the callback.\n"
-"It is not an error if this is not the same as the requested size, as it can \n"
+"It is not an error if this is not the same as the requested size, as it can\n"
"happen e.g. on a partial I/O error, but generally tries to write as many \n"
"bytes as requested.\n"
"For the synchronous, blocking version of this function, see "
diff --git a/gio/gio.override b/gio/gio.override
index 6c896fd..51b10da 100644
--- a/gio/gio.override
+++ b/gio/gio.override
@@ -213,3 +213,58 @@ _wrap_g_content_type_guess(PyGObject *self, PyObject *args, PyObject *kwargs)
PyBool_FromLong(result_uncertain));
return PyString_FromString(type);
}
+%%
+override g_mount_unmount kwargs
+static PyObject *
+_wrap_g_mount_unmount(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGAsyncRequestNotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:GMount.unmount",
+ kwlist,
+ &notify->callback,
+ &py_flags,
+ &py_cancellable,
+ &notify->data))
+
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if (!PyCallable_Check(notify->callback))
+ {
+ PyErr_SetString(PyExc_TypeError, "callback argument not callable");
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+ Py_INCREF(notify->callback);
+ Py_XINCREF(notify->data);
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ return NULL;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ g_mount_unmount(G_MOUNT(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}