summaryrefslogtreecommitdiffstats
path: root/gio/goutputstream.override
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-01-20 15:29:23 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-01-20 15:29:23 +0000
commit702ed9b73e4f596aadf86cdfbf3655cee97b4cb6 (patch)
treeac70db328b47db266c01f4e9488d6dae4d00b2b8 /gio/goutputstream.override
parent5df2f97e4db1dfefc1ff933758e9b580d796c53c (diff)
downloadpygobject-702ed9b73e4f596aadf86cdfbf3655cee97b4cb6.tar.gz
pygobject-702ed9b73e4f596aadf86cdfbf3655cee97b4cb6.tar.xz
pygobject-702ed9b73e4f596aadf86cdfbf3655cee97b4cb6.zip
Split out overrides into more files. Fix up module description in comment
2008-01-20 Johan Dahlin <johan@gnome.org> * gio/Makefile.am: * gio/ginputstream.override: * gio/gio.override: * gio/giomodule.c: * gio/goutputstream.override: * gio/gvolumemonitor.override: * gio/unix.override: * gio/unixmodule.c: Split out overrides into more files. Fix up module description in comment svn path=/trunk/; revision=741
Diffstat (limited to 'gio/goutputstream.override')
-rw-r--r--gio/goutputstream.override60
1 files changed, 60 insertions, 0 deletions
diff --git a/gio/goutputstream.override b/gio/goutputstream.override
new file mode 100644
index 0000000..f7ad2e1
--- /dev/null
+++ b/gio/goutputstream.override
@@ -0,0 +1,60 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * goutputstream.override: module overrides for GOutputStream
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+%%
+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);
+}