pygobject r758 - in trunk: . gio
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r758 - in trunk: . gio
- Date: Sun, 6 Apr 2008 17:23:37 +0100 (BST)
Author: johan
Date: Sun Apr 6 17:23:37 2008
New Revision: 758
URL: http://svn.gnome.org/viewvc/pygobject?rev=758&view=rev
Log:
2008-04-06 Johan Dahlin <johan gnome org>
* Makefile.am:
* gio/gfileenumerator.override (_wrap_g_file_enumerator_tp_iter):
Implement the python iteration protocol on GFileEnumerator
Added:
trunk/gio/gfileenumerator.override
Modified:
trunk/ChangeLog
trunk/gio/Makefile.am
Modified: trunk/gio/Makefile.am
==============================================================================
--- trunk/gio/Makefile.am (original)
+++ trunk/gio/Makefile.am Sun Apr 6 17:23:37 2008
@@ -36,6 +36,7 @@
GIO_OVERRIDES = \
gio.override \
gfile.override \
+ gfileenumerator.override \
ginputstream.override \
goutputstream.override \
gvolumemonitor.override
Added: trunk/gio/gfileenumerator.override
==============================================================================
--- (empty file)
+++ trunk/gio/gfileenumerator.override Sun Apr 6 17:23:37 2008
@@ -0,0 +1,49 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * 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-slot GFileEnumerator.tp_iter
+static PyObject*
+_wrap_g_file_enumerator_tp_iter(PyGObject *self)
+{
+ return (PyObject *) self;
+}
+%%
+override-slot GFileEnumerator.tp_iternext
+static PyObject*
+_wrap_g_file_enumerator_tp_iternext(PyGObject *iter)
+{
+ GFileInfo *file_info;
+ GError *error = NULL;
+
+ file_info = g_file_enumerator_next_file(G_FILE_ENUMERATOR(iter->obj),
+ NULL,
+ &error);
+ if (pyg_error_check(&error)) {
+ return NULL;
+ }
+ if (!file_info) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return NULL;
+ }
+
+ return pygobject_new((GObject*)file_info);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]