pygobject r741 - in trunk: . gio
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r741 - in trunk: . gio
- Date: Sun, 20 Jan 2008 15:29:23 +0000 (GMT)
Author: johan
Date: Sun Jan 20 15:29:23 2008
New Revision: 741
URL: http://svn.gnome.org/viewvc/pygobject?rev=741&view=rev
Log:
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
Added:
trunk/gio/ginputstream.override
trunk/gio/goutputstream.override
trunk/gio/gvolumemonitor.override
Modified:
trunk/ChangeLog
trunk/gio/Makefile.am
trunk/gio/gio.override
trunk/gio/giomodule.c
trunk/gio/unix.override
trunk/gio/unixmodule.c
Modified: trunk/gio/Makefile.am
==============================================================================
--- trunk/gio/Makefile.am (original)
+++ trunk/gio/Makefile.am Sun Jan 20 15:29:23 2008
@@ -33,10 +33,16 @@
EXTRA_DIST =
# gio module
-GIO_DEFS = gio.defs gio-types.defs gio.override
+GIO_OVERRIDES = \
+ gio.override \
+ ginputstream.override \
+ goutputstream.override \
+ gvolumemonitor.override
+
+GIO_DEFS = gio.defs gio-types.defs $(GIO_OVERRIDES)
CLEANFILES += gio.c
-EXTRA_DIST += $(GIO_DEFS) gio.override
-gio.c: $(GIO_DEFS) gio.override
+EXTRA_DIST += $(GIO_DEFS) $(GIO_OVERRIDES)
+gio.c: $(GIO_DEFS) $(GIO_OVERRIDES)
_gio_la_CFLAGS = $(GIO_CFLAGS)
_gio_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gio
_gio_la_LIBADD = $(GIO_LIBS)
Added: trunk/gio/ginputstream.override
==============================================================================
--- (empty file)
+++ trunk/gio/ginputstream.override Sun Jan 20 15:29:23 2008
@@ -0,0 +1,155 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * ginputstream.override: module overrides for GInputStream
+ *
+ * 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_input_stream_read kwargs
+static PyObject *
+_wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "count", "cancellable", NULL };
+ PyGObject *pycancellable = NULL;
+ PyObject *v;
+
+ GCancellable *cancellable;
+ long count = -1;
+ GError *error = NULL;
+ size_t bytesread, buffersize, chunksize;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|iO!:InputStream.read",
+ kwlist, &count,
+ &PyGCancellable_Type, &pycancellable))
+ return NULL;
+
+ buffersize = BUFSIZE;
+
+ cancellable = pycancellable ? G_CANCELLABLE(pycancellable->obj) : NULL;
+
+ v = PyString_FromStringAndSize((char *)NULL, buffersize);
+ if (v == NULL)
+ return NULL;
+
+ bytesread = 0;
+ for (;;)
+ {
+ pyg_begin_allow_threads;
+ errno = 0;
+ chunksize = g_input_stream_read(G_INPUT_STREAM(self->obj),
+ PyString_AS_STRING((PyStringObject *)v) + bytesread,
+ buffersize - bytesread, cancellable,
+ &error);
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ {
+ Py_DECREF(v);
+ return NULL;
+ }
+ else if (chunksize == 0)
+ {
+ PyErr_SetFromErrno(PyExc_IOError);
+ Py_DECREF(v);
+ return NULL;
+ }
+
+ bytesread += chunksize;
+ if (bytesread < buffersize)
+ break;
+
+ if (count < 0)
+ {
+ buffersize += BUFSIZE;
+ if (_PyString_Resize(&v, buffersize) < 0)
+ return NULL;
+ }
+ else
+ /* Got what was requested. */
+ break;
+ }
+
+ if (bytesread != buffersize)
+ _PyString_Resize(&v, bytesread);
+
+ return v;
+}
+%%
+override g_input_stream_read_async kwargs
+static PyObject *
+_wrap_g_input_stream_read_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "count", "io_priority", "cancellable", "callback",
+ "user_data", NULL };
+ 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,
+ "iiOO|O:InputStream.read_async",
+ kwlist, &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);
+
+ notify->buffer = PyString_FromStringAndSize((char *)NULL, count);
+ if (notify->buffer == NULL)
+ return NULL;
+
+ g_input_stream_read_async(G_INPUT_STREAM(self->obj),
+ PyString_AS_STRING((PyStringObject *)notify->buffer),
+ count,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
Modified: trunk/gio/gio.override
==============================================================================
--- trunk/gio/gio.override (original)
+++ trunk/gio/gio.override Sun Jan 20 15:29:23 2008
@@ -1,4 +1,28 @@
-/* -*- Mode: C; c-basic-offset: 4 -*- */
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * giomodule.c: module wrapping the GIO library
+ *
+ * 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
+ */
+%%
+modulename gio
+%%
+import gobject.GObject as PyGObject_Type
%%
headers
#define NO_IMPORT_PYGOBJECT
@@ -60,79 +84,16 @@
pyg_gil_state_release(state);
}
-
-%%
-modulename gio
%%
-import gobject.GObject as PyGObject_Type
+include
+ ginputstream.override
+ goutputstream.override
+ gvolumemonitor.override
%%
ignore-glob
*_get_type
*free
%%
-override g_volume_monitor_get_connected_drives noargs
-static PyObject *
-_wrap_g_volume_monitor_get_connected_drives (PyGObject *self)
-{
- GList *list, *l;
- PyObject *ret;
-
- list = g_volume_monitor_get_connected_drives (G_VOLUME_MONITOR (self->obj));
-
- ret = PyList_New(0);
- for (l = list; l; l = l->next) {
- GDrive *drive = l->data;
- PyObject *item = pygobject_new((GObject *)drive);
- PyList_Append(ret, item);
- Py_DECREF(item);
- }
- g_list_free(list);
-
- return ret;
-}
-%%
-override g_volume_monitor_get_volumes noargs
-static PyObject *
-_wrap_g_volume_monitor_get_volumes (PyGObject *self)
-{
- GList *list, *l;
- PyObject *ret;
-
- list = g_volume_monitor_get_volumes (G_VOLUME_MONITOR (self->obj));
-
- ret = PyList_New(0);
- for (l = list; l; l = l->next) {
- GVolume *volume = l->data;
- PyObject *item = pygobject_new((GObject *)volume);
- PyList_Append(ret, item);
- Py_DECREF(item);
- }
- g_list_free(list);
-
- return ret;
-}
-%%
-override g_volume_monitor_get_mounts noargs
-static PyObject *
-_wrap_g_volume_monitor_get_mounts (PyGObject *self)
-{
- GList *list, *l;
- PyObject *ret;
-
- list = g_volume_monitor_get_mounts (G_VOLUME_MONITOR (self->obj));
-
- ret = PyList_New(0);
- for (l = list; l; l = l->next) {
- GMount *mount = l->data;
- PyObject *item = pygobject_new((GObject *)mount);
- PyList_Append(ret, item);
- Py_DECREF(item);
- }
- g_list_free(list);
-
- return ret;
-}
-%%
override g_drive_get_volumes noargs
static PyObject *
_wrap_g_drive_get_volumes (PyGObject *self)
@@ -200,177 +161,6 @@
return ret;
}
%%
-override g_input_stream_read kwargs
-static PyObject *
-_wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "count", "cancellable", NULL };
- PyGObject *pycancellable = NULL;
- PyObject *v;
-
- GCancellable *cancellable;
- long count = -1;
- GError *error = NULL;
- size_t bytesread, buffersize, chunksize;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "|iO!:InputStream.read",
- kwlist, &count,
- &PyGCancellable_Type, &pycancellable))
- return NULL;
-
- buffersize = BUFSIZE;
-
- cancellable = pycancellable ? G_CANCELLABLE(pycancellable->obj) : NULL;
-
- v = PyString_FromStringAndSize((char *)NULL, buffersize);
- if (v == NULL)
- return NULL;
-
- bytesread = 0;
- for (;;)
- {
- pyg_begin_allow_threads;
- errno = 0;
- chunksize = g_input_stream_read(G_INPUT_STREAM(self->obj),
- PyString_AS_STRING((PyStringObject *)v) + bytesread,
- buffersize - bytesread, cancellable,
- &error);
- pyg_end_allow_threads;
-
- if (pyg_error_check(&error))
- {
- Py_DECREF(v);
- return NULL;
- }
- else if (chunksize == 0)
- {
- PyErr_SetFromErrno(PyExc_IOError);
- Py_DECREF(v);
- return NULL;
- }
-
- bytesread += chunksize;
- if (bytesread < buffersize)
- break;
-
- if (count < 0)
- {
- buffersize += BUFSIZE;
- if (_PyString_Resize(&v, buffersize) < 0)
- return NULL;
- }
- else
- /* Got what was requested. */
- break;
- }
-
- if (bytesread != buffersize)
- _PyString_Resize(&v, bytesread);
-
- return v;
-}
-%%
-override g_input_stream_read_async kwargs
-static PyObject *
-_wrap_g_input_stream_read_async(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "count", "io_priority", "cancellable", "callback",
- "user_data", NULL };
- 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,
- "iiOO|O:InputStream.read_async",
- kwlist, &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);
-
- notify->buffer = PyString_FromStringAndSize((char *)NULL, count);
- if (notify->buffer == NULL)
- return NULL;
-
- g_input_stream_read_async(G_INPUT_STREAM(self->obj),
- PyString_AS_STRING((PyStringObject *)notify->buffer),
- count,
- io_priority,
- cancellable,
- (GAsyncReadyCallback)async_result_callback_marshal,
- notify);
-
- 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);
-}
-%%
define GSimpleAsyncResult.get_buffer noargs
static PyObject *
_wrap_g_simple_async_result_get_buffer(PyGObject *self)
Modified: trunk/gio/giomodule.c
==============================================================================
--- trunk/gio/giomodule.c (original)
+++ trunk/gio/giomodule.c Sun Jan 20 15:29:23 2008
@@ -1,5 +1,5 @@
/* -*- Mode: C; c-basic-offset: 4 -*-
- * pygtk- Python bindings for the GTK toolkit.
+ * pygobject - Python bindings for GObject
* Copyright (C) 2008 Johan Dahlin
*
* giomodule.c: module wrapping the GIO library
Added: trunk/gio/goutputstream.override
==============================================================================
--- (empty file)
+++ trunk/gio/goutputstream.override Sun Jan 20 15:29:23 2008
@@ -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);
+}
Added: trunk/gio/gvolumemonitor.override
==============================================================================
--- (empty file)
+++ trunk/gio/gvolumemonitor.override Sun Jan 20 15:29:23 2008
@@ -0,0 +1,84 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gvolumemonitor.override: module overrides for GVolumeMonitor
+ *
+ * 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_volume_monitor_get_connected_drives noargs
+static PyObject *
+_wrap_g_volume_monitor_get_connected_drives (PyGObject *self)
+{
+ GList *list, *l;
+ PyObject *ret;
+
+ list = g_volume_monitor_get_connected_drives (G_VOLUME_MONITOR (self->obj));
+
+ ret = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ GDrive *drive = l->data;
+ PyObject *item = pygobject_new((GObject *)drive);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ g_list_free(list);
+
+ return ret;
+}
+%%
+override g_volume_monitor_get_volumes noargs
+static PyObject *
+_wrap_g_volume_monitor_get_volumes (PyGObject *self)
+{
+ GList *list, *l;
+ PyObject *ret;
+
+ list = g_volume_monitor_get_volumes (G_VOLUME_MONITOR (self->obj));
+
+ ret = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ GVolume *volume = l->data;
+ PyObject *item = pygobject_new((GObject *)volume);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ g_list_free(list);
+
+ return ret;
+}
+%%
+override g_volume_monitor_get_mounts noargs
+static PyObject *
+_wrap_g_volume_monitor_get_mounts (PyGObject *self)
+{
+ GList *list, *l;
+ PyObject *ret;
+
+ list = g_volume_monitor_get_mounts (G_VOLUME_MONITOR (self->obj));
+
+ ret = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ GMount *mount = l->data;
+ PyObject *item = pygobject_new((GObject *)mount);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ g_list_free(list);
+
+ return ret;
+}
Modified: trunk/gio/unix.override
==============================================================================
--- trunk/gio/unix.override (original)
+++ trunk/gio/unix.override Sun Jan 20 15:29:23 2008
@@ -1,4 +1,24 @@
-/* -*- Mode: C; c-basic-offset: 4 -*- */
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * unixmodule.c: module wrapping the GIO UNIX library
+ *
+ * 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
+ */
%%
headers
#define NO_IMPORT_PYGOBJECT
Modified: trunk/gio/unixmodule.c
==============================================================================
--- trunk/gio/unixmodule.c (original)
+++ trunk/gio/unixmodule.c Sun Jan 20 15:29:23 2008
@@ -1,8 +1,8 @@
/* -*- Mode: C; c-basic-offset: 4 -*-
- * pygtk- Python bindings for the GTK toolkit.
+ * pygobject - Python bindings for GObject
* Copyright (C) 2008 Johan Dahlin
*
- * giomodule.c: module wrapping the GIO library
+ * unixmodule.c: module wrapping the GIO UNIX library
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]