summaryrefslogtreecommitdiffstats
path: root/gio/gmemoryoutputstream.override
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2009-06-08 13:30:15 +0200
committerGian Mario Tagliaretti <gianmt@gnome.org>2009-06-09 00:10:09 +0200
commit6eb5e3988cbddb4afb3d5747364d6eb80370bb78 (patch)
tree69b8dc499f5fb4dbc3907240f57dc41d573ed0ed /gio/gmemoryoutputstream.override
parentdfbdf23633a772e78b47b0e7b0c3e3b87855d9ff (diff)
downloadpygobject-6eb5e3988cbddb4afb3d5747364d6eb80370bb78.tar.gz
pygobject-6eb5e3988cbddb4afb3d5747364d6eb80370bb78.tar.xz
pygobject-6eb5e3988cbddb4afb3d5747364d6eb80370bb78.zip
Split overrides for gio.MemoryOutputStream
Diffstat (limited to 'gio/gmemoryoutputstream.override')
-rw-r--r--gio/gmemoryoutputstream.override45
1 files changed, 45 insertions, 0 deletions
diff --git a/gio/gmemoryoutputstream.override b/gio/gmemoryoutputstream.override
new file mode 100644
index 0000000..7614045
--- /dev/null
+++ b/gio/gmemoryoutputstream.override
@@ -0,0 +1,45 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gmemoryoutputstream.override: module overrides for GMemoryOutputStream
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+override g_memory_output_stream_new noargs
+static int
+_wrap_g_memory_output_stream_new(PyGObject *self)
+{
+ self->obj = (GObject *)g_memory_output_stream_new(NULL, 0, g_realloc, g_free);
+
+ if (!self->obj) {
+ PyErr_SetString(PyExc_RuntimeError, "could not create gio.MemoryOutputStream object");
+ return -1;
+ }
+
+ pygobject_register_wrapper((PyObject *)self);
+ return 0;
+}
+%%
+override g_memory_output_stream_get_data noargs
+static PyObject *
+_wrap_g_memory_output_stream_get_data(PyGObject *self)
+{
+ GMemoryOutputStream *stream = G_MEMORY_OUTPUT_STREAM(self->obj);
+ return PyString_FromStringAndSize(g_memory_output_stream_get_data(stream),
+ g_seekable_tell(G_SEEKABLE(stream)));
+}