pygobject r761 - in trunk: . gio
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r761 - in trunk: . gio
- Date: Sun, 6 Apr 2008 17:26:32 +0100 (BST)
Author: johan
Date: Sun Apr 6 17:26:32 2008
New Revision: 761
URL: http://svn.gnome.org/viewvc/pygobject?rev=761&view=rev
Log:
2008-04-06 Johan Dahlin <johan gnome org>
* gio/goutputstream.override:
(_wrap_g_output_stream_write_asyn,_wrap_g_output_stream_close_async):
* gio/ginputstream.override (async_result_callback_marshal_read):
Add wrappers.
Modified:
trunk/ChangeLog
trunk/gio/ginputstream.override
trunk/gio/goutputstream.override
Modified: trunk/gio/ginputstream.override
==============================================================================
--- trunk/gio/ginputstream.override (original)
+++ trunk/gio/ginputstream.override Sun Apr 6 17:26:32 2008
@@ -234,3 +234,57 @@
/* FIXME: Should we refcount the buffer here? */
return buffer;
}
+%%
+override g_input_stream_close_async kwargs
+static PyObject *
+_wrap_g_input_stream_close_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "io_priority", "cancellable",
+ "callback", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable;
+ GCancellable *cancellable;
+ PyGAsyncRequestNotify *notify;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "iOO|O:InputStream.close_async",
+ kwlist,
+ &io_priority,
+ &pycancellable,
+ ¬ify->callback,
+ ¬ify->data))
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if ((PyObject*)pycancellable == Py_None)
+ cancellable = NULL;
+ else if (pygobject_check(pycancellable, &PyGCancellable_Type))
+ cancellable = G_CANCELLABLE(pycancellable->obj);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, "cancellable should be a gio.Cancellable");
+ 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);
+
+ g_input_stream_close_async(G_INPUT_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
Modified: trunk/gio/goutputstream.override
==============================================================================
--- trunk/gio/goutputstream.override (original)
+++ trunk/gio/goutputstream.override Sun Apr 6 17:26:32 2008
@@ -58,3 +58,115 @@
return PyInt_FromLong(written);
}
+%%
+override g_output_stream_write_async kwargs
+static PyObject *
+_wrap_g_output_stream_write_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "buffer", "io_priority", "cancellable",
+ "callback", "user_data", NULL };
+ gchar *buffer;
+ long count = -1;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable;
+ GCancellable *cancellable;
+ PyGAsyncRequestNotify *notify;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s#iOO|O:OutputStream.write_async",
+ kwlist, &buffer, &count,
+ &io_priority,
+ &pycancellable,
+ ¬ify->callback,
+ ¬ify->data))
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if ((PyObject*)pycancellable == Py_None)
+ cancellable = NULL;
+ else if (pygobject_check(pycancellable, &PyGCancellable_Type))
+ cancellable = G_CANCELLABLE(pycancellable->obj);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, "cancellable should be a gio.Cancellable");
+ 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);
+
+ g_output_stream_write_async(G_OUTPUT_STREAM(self->obj),
+ buffer,
+ count,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override g_output_stream_close_async kwargs
+static PyObject *
+_wrap_g_output_stream_close_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "io_priority", "cancellable",
+ "callback", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable;
+ GCancellable *cancellable;
+ PyGAsyncRequestNotify *notify;
+
+ notify = g_slice_new0(PyGAsyncRequestNotify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "iOO|O:OutputStream.close_async",
+ kwlist,
+ &io_priority,
+ &pycancellable,
+ ¬ify->callback,
+ ¬ify->data))
+ {
+ g_slice_free(PyGAsyncRequestNotify, notify);
+ return NULL;
+ }
+
+ if ((PyObject*)pycancellable == Py_None)
+ cancellable = NULL;
+ else if (pygobject_check(pycancellable, &PyGCancellable_Type))
+ cancellable = G_CANCELLABLE(pycancellable->obj);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, "cancellable should be a gio.Cancellable");
+ 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);
+
+ g_output_stream_close_async(G_OUTPUT_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]