diff options
| author | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2008-08-02 21:51:10 +0000 |
|---|---|---|
| committer | Gian Mario Tagliaretti <gianmt@src.gnome.org> | 2008-08-02 21:51:10 +0000 |
| commit | 4ae930e278b8fcb99dd85e60a9c708263ca02f74 (patch) | |
| tree | a3f1926ce539ff338441c2f89dc739f77742e2c1 /gio | |
| parent | c84375e8018d300e2ae43a932cff6948300b03c0 (diff) | |
| download | pygobject-4ae930e278b8fcb99dd85e60a9c708263ca02f74.tar.gz pygobject-4ae930e278b8fcb99dd85e60a9c708263ca02f74.tar.xz pygobject-4ae930e278b8fcb99dd85e60a9c708263ca02f74.zip | |
Wrap GFile.create_async with docs and test
svn path=/trunk/; revision=920
Diffstat (limited to 'gio')
| -rw-r--r-- | gio/gfile.override | 86 | ||||
| -rw-r--r-- | gio/gio.defs | 10 |
2 files changed, 95 insertions, 1 deletions
diff --git a/gio/gfile.override b/gio/gfile.override index 56dbfad..fb78e6e 100644 --- a/gio/gfile.override +++ b/gio/gfile.override @@ -826,8 +826,92 @@ _wrap_g_file_append_to_async(PyGObject *self, PyObject *args, PyObject *kwargs) Py_INCREF(Py_None); return Py_None; } +%% +override g_file_create_async kwargs +static PyObject * +_wrap_g_file_create_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "io_priority", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + PyGIONotify *notify; + + notify = g_slice_new0(PyGIONotify); -/* GFile.create_async */ + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OiOO:File.create_async", + kwlist, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + + { + g_slice_free(PyGIONotify, notify); + return NULL; + } + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + g_file_create_async(G_FILE(self->obj), flags, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; +} +%% +override g_file_create_async kwargs +static PyObject * +_wrap_g_file_create_async(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = { "callback", "flags", "io_priority", + "cancellable", "user_data", NULL }; + GCancellable *cancellable; + PyGObject *pycancellable = NULL; + GFileCreateFlags flags = G_FILE_CREATE_NONE; + PyObject *py_flags = NULL; + int io_priority = G_PRIORITY_DEFAULT; + PyGIONotify *notify; + + notify = g_slice_new0(PyGIONotify); + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, + "O|OiOO:File.create_async", + kwlist, + ¬ify->callback, + &flags, &io_priority, + &pycancellable, + ¬ify->data)) + + { + g_slice_free(PyGIONotify, notify); + return NULL; + } + + if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS, + py_flags, (gpointer)&flags)) + return NULL; + + if (!pygio_check_cancellable(pycancellable, &cancellable)) + return NULL; + + g_file_create_async(G_FILE(self->obj), flags, io_priority, cancellable, + (GAsyncReadyCallback)async_result_callback_marshal, + notify); + + Py_INCREF(Py_None); + return Py_None; +} /* GFile.eject_mountable */ /* GFile.find_enclosing_mount_async */ /* GFile.query_info_async */ diff --git a/gio/gio.defs b/gio/gio.defs index 0b1ff5e..d0e6f2a 100644 --- a/gio/gio.defs +++ b/gio/gio.defs @@ -1420,6 +1420,16 @@ ) (define-method create_async + (docstring + "F.create_async(callback [flags, [,io_priority [,cancellable [,user_data]]]]) -> file created\n" + "\n" + "Asynchronously creates a new file and returns an output stream for\n" + "writing to it. The file must not already exist.\n" + "For more details, see F.create() which is the synchronous\n" + "version of this call.\n" + "When the operation is finished, callback will be called. You can\n" + "then call F.create_finish() to get the result of the operation." + ) (of-object "GFile") (c-name "g_file_create_async") (return-type "none") |
