summaryrefslogtreecommitdiffstats
path: root/gio/gfile.override
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@src.gnome.org>2008-07-14 21:47:31 +0000
committerGian Mario Tagliaretti <gianmt@src.gnome.org>2008-07-14 21:47:31 +0000
commitd0aaac8f4c57bb759712936a8d612f826fd87fde (patch)
treeea6b5010fe249a5b250f79f8a737be5765d7b9aa /gio/gfile.override
parent0220bbda1afbfb2b8e9abe1ff07b193a49cbb4d8 (diff)
downloadpygobject-d0aaac8f4c57bb759712936a8d612f826fd87fde.tar.gz
pygobject-d0aaac8f4c57bb759712936a8d612f826fd87fde.tar.xz
pygobject-d0aaac8f4c57bb759712936a8d612f826fd87fde.zip
wrap File.load_contents_async and File.load_contents_finish with docsstrings and a test
svn path=/trunk/; revision=802
Diffstat (limited to 'gio/gfile.override')
-rw-r--r--gio/gfile.override74
1 files changed, 72 insertions, 2 deletions
diff --git a/gio/gfile.override b/gio/gfile.override
index a9c4a33..49b12aa 100644
--- a/gio/gfile.override
+++ b/gio/gfile.override
@@ -170,12 +170,83 @@ _wrap_g_file_load_contents(PyGObject *self,
return Py_None;
}
}
+%%
+override g_file_load_contents_async kwargs
+static PyObject *
+_wrap_g_file_load_contents_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ PyGAsyncRequestNotify *notify;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:File.load_contents_async",
+ kwlist,
+ &notify->callback,
+ &pycancellable,
+ &notify->data))
+
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ g_file_load_contents_async(G_FILE(self->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override g_file_load_contents_finish kwargs
+static PyObject *
+_wrap_g_file_load_contents_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "res", NULL };
+ PyGObject *res;
+ gchar *contents, *etag_out;
+ gsize lenght;
+ GError *error = NULL;
+ gboolean ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:File.load_contents_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &res))
+ return NULL;
+
+ ret = g_file_load_contents_finish(G_FILE(self->obj),
+ G_ASYNC_RESULT(res->obj), &contents,
+ &lenght, &etag_out, &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret)
+ return Py_BuildValue("(sks)", contents, lenght, etag_out);
+ else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
/* GFile.append_to_async */
/* GFile.create_async */
/* GFile.enumerate_children_async */
/* GFile.eject_mountable */
/* GFile.find_enclosing_mount_async */
-/* GFile.load_contents_async */
/* GFile.mount_enclosing_volume */
/* GFile.mount_mountable */
/* GFile.query_info_async */
@@ -191,7 +262,6 @@ _wrap_g_file_load_contents(PyGObject *self,
/* GFile.query_writable_namespaces: No ArgType for GFileAttributeInfoList* */
/* GFile.set_attribute: No ArgType for gpointer */
/* GFile.set_attributes_finish: No ArgType for GFileInfo** */
-/* GFile.load_contents_finish: No ArgType for char** */
/* GFile.load_partial_contents_finish: No ArgType for char** */
/* GFile.replace_contents: No ArgType for char** */
/* GFile.replace_contents_finish: No ArgType for char** */