summaryrefslogtreecommitdiffstats
path: root/gio
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 13:30:24 +0100
committerGian Mario Tagliaretti <gianmt@gnome.org>2010-01-01 13:30:24 +0100
commitca436fe7785fd24b0f0e65f2f8c9fa6478277682 (patch)
treeed7ae480a90d39f458e44a5557274dcc71c09d66 /gio
parentf72c5e451dfaeb01b3c3d9243fed2732d3620462 (diff)
downloadpygobject-ca436fe7785fd24b0f0e65f2f8c9fa6478277682.tar.gz
pygobject-ca436fe7785fd24b0f0e65f2f8c9fa6478277682.tar.xz
pygobject-ca436fe7785fd24b0f0e65f2f8c9fa6478277682.zip
Wrap gio.File.create_readwrite_async() and add a test
Diffstat (limited to 'gio')
-rw-r--r--gio/gfile.override51
1 files changed, 51 insertions, 0 deletions
diff --git a/gio/gfile.override b/gio/gfile.override
index 6469d22..998b309 100644
--- a/gio/gfile.override
+++ b/gio/gfile.override
@@ -956,6 +956,57 @@ _wrap_g_file_create_async(PyGObject *self, PyObject *args, PyObject *kwargs)
return NULL;
}
%%
+override g_file_create_readwrite_async kwargs
+static PyObject *
+_wrap_g_file_create_readwrite_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 = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OiOO:File.create_readwrite_async",
+ kwlist,
+ &notify->callback,
+ &flags, &io_priority,
+ &pycancellable,
+ &notify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_create_readwrite_async(G_FILE(self->obj), flags, io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
override g_file_replace_async kwargs
static PyObject *
_wrap_g_file_replace_async(PyGObject *self, PyObject *args, PyObject *kwargs)