summaryrefslogtreecommitdiffstats
path: root/gio
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-01-19 19:54:46 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-01-19 19:54:46 +0000
commitab1ac2f37f6ae5b195ebfb20b1895e841d59e2d7 (patch)
tree1e98c8c05b41db6afb71e059330b74cf0d800391 /gio
parent8c1524ece22446d75b9f41e34b8281179dab1bee (diff)
downloadpygobject-ab1ac2f37f6ae5b195ebfb20b1895e841d59e2d7.tar.gz
pygobject-ab1ac2f37f6ae5b195ebfb20b1895e841d59e2d7.tar.xz
pygobject-ab1ac2f37f6ae5b195ebfb20b1895e841d59e2d7.zip
Impl.
2008-01-19 Johan Dahlin <johan@gnome.org> * gio/gio.override (_wrap_g_output_stream_write): Impl. * gio/gio.override: * gio/unix.defs: Add GUnixInputStream type and methods * tests/common.py: * tests/test_gio.py: Add GIO tests. svn path=/trunk/; revision=737
Diffstat (limited to 'gio')
-rw-r--r--gio/gio.override41
-rw-r--r--gio/unix.defs18
2 files changed, 58 insertions, 1 deletions
diff --git a/gio/gio.override b/gio/gio.override
index 78b83ed..f6df13a 100644
--- a/gio/gio.override
+++ b/gio/gio.override
@@ -265,7 +265,7 @@ _wrap_g_input_stream_read_async(PyGObject *self, PyObject *args, PyObject *kwarg
"user_data", NULL };
long count = -1;
int io_priority = G_PRIORITY_DEFAULT;
- PyGObject *pycancellable = NULL;
+ PyGObject *pycancellable;
PyObject *buffer;
GCancellable *cancellable;
PyGAsyncRequestNotify *notify;
@@ -316,3 +316,42 @@ _wrap_g_input_stream_read_async(PyGObject *self, PyObject *args, PyObject *kwarg
Py_INCREF(Py_None);
return Py_None;
}
+%%
+override g_output_stream_write kwargs
+static PyObject *
+_wrap_g_output_stream_write(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "buffer", "cancellable", NULL };
+ PyGObject *pycancellable = NULL;
+ gchar *buffer;
+ long count = 0;
+ GCancellable *cancellable;
+ GError *error = NULL;
+ gssize written;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s#|O!:OutputStream.write",
+ kwlist, &buffer, &count,
+ &PyGCancellable_Type, &pycancellable))
+ return NULL;
+
+ if (!pycancellable)
+ 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;
+ }
+
+ pyg_begin_allow_threads;
+ written = g_output_stream_write(G_OUTPUT_STREAM(self->obj),
+ buffer, count, cancellable, &error);
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ return PyInt_FromLong(written);
+}
diff --git a/gio/unix.defs b/gio/unix.defs
index 0aec7b4..2d28841 100644
--- a/gio/unix.defs
+++ b/gio/unix.defs
@@ -266,6 +266,24 @@
+;; From gunixinputstream.h
+
+(define-function unix_input_stream_get_type
+ (c-name "g_unix_input_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function unix_input_stream_new
+ (c-name "g_unix_input_stream_new")
+ (is-constructor-of "GUnixInputStream")
+ (return-type "GInputStream*")
+ (parameters
+ '("int" "fd")
+ '("gboolean" "close_fd_at_close")
+ )
+)
+
+
;; From gunixoutputstream.h
(define-function unix_output_stream_get_type