[pygobject/pygobject-2-28] Revert "Remove gio static bindings"
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/pygobject-2-28] Revert "Remove gio static bindings"
- Date: Wed, 9 Feb 2011 17:01:09 +0000 (UTC)
commit 02ac041ba001bdda506f749e90aebc86a414d7c1
Author: Martin Pitt <martin pitt ubuntu com>
Date: Wed Feb 2 13:33:55 2011 +0100
Revert "Remove gio static bindings"
This reverts commit bca5834fc8fa342149e0eec7b396877a2abe6d33.
We still need the static gio bindings for now.
https://bugzilla.gnome.org/show_bug.cgi?id=638899
Makefile.am | 2 +-
configure.ac | 22 +-
gio/.gitignore | 3 +
gio/Makefile.am | 117 +
gio/__init__.py | 40 +
gio/gappinfo.override | 213 ++
gio/gapplaunchcontext.override | 99 +
gio/gbufferedinputstream.override | 70 +
gio/gcancellable.override | 38 +
gio/gdatainputstream.override | 250 ++
gio/gdrive.override | 347 ++
gio/gfile.override | 2215 +++++++++++
gio/gfileattribute.override | 153 +
gio/gfileenumerator.override | 184 +
gio/gfileinfo.override | 121 +
gio/gfileinputstream.override | 68 +
gio/gfileiostream.override | 68 +
gio/gfileoutputstream.override | 68 +
gio/gicon.override | 310 ++
gio/ginputstream.override | 344 ++
gio/gio-types.defs | 807 ++++
gio/gio.defs | 7465 +++++++++++++++++++++++++++++++++++++
gio/gio.override | 409 ++
gio/giomodule.c | 208 +
gio/giostream.override | 68 +
gio/gmemoryinputstream.override | 91 +
gio/gmemoryoutputstream.override | 45 +
gio/gmount.override | 454 +++
gio/goutputstream.override | 292 ++
gio/gresolver.override | 312 ++
gio/gsocket.override | 575 +++
gio/gvolume.override | 237 ++
gio/gvolumemonitor.override | 94 +
gio/pygio-utils.c | 236 ++
gio/pygio-utils.h | 49 +
gio/unix-types.defs | 55 +
gio/unix.defs | 475 +++
gio/unix.override | 62 +
gio/unixmodule.c | 52 +
tests/Makefile.am | 9 +
tests/runtests-windows.py | 3 +
tests/test_gcancellable.py | 15 +
tests/test_gicon.py | 112 +
tests/test_gio.py | 1138 ++++++
tests/test_gresolver.py | 68 +
tests/test_gsocket.py | 126 +
46 files changed, 18187 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 9d1b69f..b9b9ed3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = 1.7
-SUBDIRS = docs codegen glib gobject examples
+SUBDIRS = docs codegen glib gobject gio examples
if ENABLE_INTROSPECTION
SUBDIRS += gi
diff --git a/configure.ac b/configure.ac
index 0254e4f..8f9d46c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,10 +207,29 @@ AC_SUBST(FFI_LIBS)
AC_SUBST(LIBFFI_PC)
dnl gio
-PKG_CHECK_MODULES(GIO, gio-2.0 >= gio_required_version)
+PKG_CHECK_MODULES(GIO, gio-2.0 >= gio_required_version,
+ have_gio=true, have_gio=false)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
+# Do not build GIO if the python version >= 3.0
+# We use GI to access GIO in python 3
+AM_CONDITIONAL(BUILD_GIO, test $have_gio = true -a $build_py3k = false)
+
+if test -n "$export_dynamic"; then
+ GIO_LIBS=`echo $GIO_LIBS | sed -e "s/$export_dynamic//"`
+fi
+
+dnl giounix
+PKG_CHECK_MODULES(GIOUNIX, gio-unix-2.0 >= giounix_required_version,
+ have_giounix=true, have_giounix=false)
+AC_SUBST(GIOUNIX_CFLAGS)
+AC_SUBST(GIOUNIX_LIBS)
+AM_CONDITIONAL(BUILD_GIOUNIX, test $have_giounix = true -a $build_py3k = false)
+if test -n "$export_dynamic"; then
+ GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"`
+fi
+
AC_ARG_ENABLE(cairo,
AC_HELP_STRING([--enable-cairo], [Enable Cairo bindings using introspection information]),
enable_cairo=$enableval,
@@ -274,6 +293,7 @@ AC_CONFIG_FILES(
gi/overrides/Makefile
glib/Makefile
gobject/Makefile
+ gio/Makefile
examples/Makefile
tests/Makefile
PKG-INFO)
diff --git a/gio/.gitignore b/gio/.gitignore
new file mode 100644
index 0000000..a1224aa
--- /dev/null
+++ b/gio/.gitignore
@@ -0,0 +1,3 @@
+# Codegen output.
+gio.c
+unix.c
diff --git a/gio/Makefile.am b/gio/Makefile.am
new file mode 100644
index 0000000..b412043
--- /dev/null
+++ b/gio/Makefile.am
@@ -0,0 +1,117 @@
+AUTOMAKE_OPTIONS = 1.7
+
+PLATFORM_VERSION = 2.0
+
+INCLUDES = \
+ -I$(top_srcdir)/glib \
+ -I$(top_srcdir)/gobject \
+ $(PYTHON_INCLUDES) \
+ $(PYGOBJECT_CFLAGS) \
+ $(GIO_CFLAGS)
+
+# defs files
+defsdir = $(pkgdatadir)/$(PLATFORM_VERSION)/defs
+defs_DATA =
+
+# python
+pyexec_LTLIBRARIES =
+
+# gio extension modules
+pkgpyexecdir = $(pyexecdir)/gtk-2.0/gio
+pkgpyexec_LTLIBRARIES =
+
+# gio python scripts
+pygiodir = $(pkgpyexecdir)
+pygio_PYTHON = __init__.py
+
+# linker flags
+common_ldflags = -module -avoid-version
+if PLATFORM_WIN32
+common_ldflags += -no-undefined
+endif
+
+CLEANFILES =
+EXTRA_DIST =
+
+# gio module
+GIO_OVERRIDES = \
+ gio.override \
+ gappinfo.override \
+ gapplaunchcontext.override \
+ gbufferedinputstream.override \
+ gcancellable.override \
+ gdatainputstream.override \
+ gdrive.override \
+ gfile.override \
+ gfileattribute.override \
+ gfileenumerator.override \
+ gfileinfo.override \
+ gfileinputstream.override \
+ gfileiostream.override \
+ gfileoutputstream.override \
+ gicon.override \
+ giostream.override \
+ ginputstream.override \
+ gmemoryinputstream.override \
+ gmemoryoutputstream.override \
+ gmount.override \
+ goutputstream.override \
+ gresolver.override \
+ gsocket.override \
+ gvolume.override \
+ gvolumemonitor.override
+
+GIO_DEFS = gio.defs gio-types.defs $(GIO_OVERRIDES)
+CLEANFILES += gio.c
+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) $(top_builddir)/glib/libpyglib-2 0- PYTHON_BASENAME@.la
+_gio_la_SOURCES = \
+ giomodule.c \
+ pygio-utils.c \
+ pygio-utils.h
+nodist__gio_la_SOURCES = gio.c
+if BUILD_GIO
+pkgpyexec_LTLIBRARIES += _gio.la
+defs_DATA += $(GIO_DEFS)
+endif
+
+# giounix module
+GIOUNIX_DEFS = unix.defs unix-types.defs unix.override
+CLEANFILES += unix.c
+EXTRA_DIST += $(GIOUNIX_DEFS) unix.override
+unix.c: $(GIOUNIX_DEFS) unix.override
+unix_la_CFLAGS = $(GIOUNIX_CFLAGS)
+unix_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initunix
+unix_la_LIBADD = $(GIOUNIX_LIBS) $(PYTHON_LIBS)
+unix_la_SOURCES = unixmodule.c
+nodist_unix_la_SOURCES = unix.c
+if BUILD_GIOUNIX
+pkgpyexec_LTLIBRARIES += unix.la
+defs_DATA += $(GIOUNIX_DEFS)
+endif
+
+
+# code generator
+.defs.c:
+ (cd $(srcdir)\
+ && $(PYTHON) $(top_srcdir)/codegen/codegen.py \
+ --py_ssize_t-clean \
+ --register gio-types.defs \
+ --register unix-types.defs \
+ --override $*.override \
+ --prefix py$(*F) $*.defs) > $(*D)/gen-$(*F).c \
+ && cp $(*D)/gen-$(*F).c $(*D)/$(*F).c \
+ && rm -f $(*D)/gen-$(*F).c
+
+
+if BUILD_GIO
+all: $(pkgpyexec_LTLIBRARIES:.la=.so)
+check-local: $(pkgpyexec_LTLIBRARIES:.la=.so)
+clean-local:
+ rm -f $(pkgpyexec_LTLIBRARIES:.la=.so)
+.la.so:
+ $(LN_S) .libs/$@ $@ || true
+endif
diff --git a/gio/__init__.py b/gio/__init__.py
new file mode 100644
index 0000000..c4b02bb
--- /dev/null
+++ b/gio/__init__.py
@@ -0,0 +1,40 @@
+# -*- Mode: Python -*-
+# pygobject - Python bindings for the GObject library
+# Copyright (C) 2008 Johan Dahlin
+#
+# gio/__init__.py: initialisation file for gio module
+#
+# 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
+
+from gobject import GObjectMeta
+from _gio import *
+from _gio import \
+ _app_info_init, _install_app_info_meta, \
+ _file_init, _install_file_meta
+try:
+ import unix
+ unix # pyflakes
+except ImportError:
+ unix = None
+del _gio
+
+class GFileMeta(GObjectMeta):
+ __call__ = _file_init
+_install_file_meta(GFileMeta)
+
+class GAppInfoMeta(GObjectMeta):
+ __call__ = _app_info_init
+_install_app_info_meta(GAppInfoMeta)
diff --git a/gio/gappinfo.override b/gio/gappinfo.override
new file mode 100644
index 0000000..7f09ce8
--- /dev/null
+++ b/gio/gappinfo.override
@@ -0,0 +1,213 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ * Copyright (C) 2008 Gian Mario Tagliaretti
+ *
+ * gappinfo.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+define _install_app_info_meta
+static PyObject *
+_wrap__install_app_info_meta(PyObject *self, PyObject *args)
+{
+ PyObject *metaclass;
+
+ if (!PyArg_ParseTuple(args, "O", &metaclass))
+ return NULL;
+
+ Py_INCREF(metaclass);
+ PyGAppInfo_Type.ob_type = (PyTypeObject*)metaclass;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+define _app_info_init kwargs
+static PyObject *
+_wrap__app_info_init(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "commandline", "application_name",
+ "flags", NULL };
+ char *commandline, *application_name = NULL;
+ PyObject *py_flags = NULL;
+ GAppInfo *ret;
+ GError *error = NULL;
+ GAppInfoCreateFlags flags = G_APP_INFO_CREATE_NONE;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s|zO:gio.AppInfo",
+ kwlist,
+ &commandline, &application_name,
+ &py_flags))
+ return NULL;
+ if (py_flags && pyg_flags_get_value(G_TYPE_APP_INFO_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ return NULL;
+
+ ret = g_app_info_create_from_commandline(commandline,
+ application_name, flags, &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ /* pygobject_new handles NULL checking */
+ return pygobject_new((GObject *)ret);
+}
+%%
+override g_app_info_launch_uris kwargs
+static PyObject *
+_wrap_g_app_info_launch_uris(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "files", "launch_context", NULL };
+
+ GList *file_list = NULL;
+ PyGObject *pycontext = NULL;
+ GAppLaunchContext *ctx;
+ PyObject *pyfile_list = Py_None;
+ int ret;
+ GError *error = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|OO:gio.AppInfo.launch_uris",
+ kwlist,
+ &pyfile_list, &pycontext))
+ return NULL;
+
+ if (!pygio_check_launch_context(pycontext, &ctx))
+ return NULL;
+
+ if (pyfile_list == Py_None)
+ file_list = NULL;
+
+ else if (PySequence_Check (pyfile_list))
+ file_list = pygio_pylist_to_uri_glist(pyfile_list);
+
+ else {
+ PyErr_SetString(PyExc_TypeError,
+ "file_list should be a list of strings or None");
+ return NULL;
+ }
+
+ ret = g_app_info_launch_uris(G_APP_INFO(self->obj),
+ file_list, ctx, &error);
+
+ /* in python 3 the C strings are not internal to the Unicode string object
+ * so we now strdup when adding element to the list and must free them here
+ */
+ g_list_foreach (file_list,
+ (GFunc) g_free, NULL);
+ g_list_free(file_list);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ return PyBool_FromLong(ret);
+}
+%%
+override g_app_info_launch kwargs
+static PyObject *
+_wrap_g_app_info_launch(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "files", "launch_context", NULL };
+
+ GList *file_list = NULL;
+ PyGObject *pycontext = NULL;
+ GAppLaunchContext *ctx;
+ PyObject *pyfile_list = Py_None;
+ int ret;
+ GError *error = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|OO:gio.AppInfo.launch",
+ kwlist,
+ &pyfile_list, &pycontext))
+ return NULL;
+
+ if (!pygio_check_launch_context(pycontext, &ctx))
+ return NULL;
+
+ if (pyfile_list == Py_None)
+ file_list = NULL;
+
+ else if (PySequence_Check (pyfile_list))
+ file_list = pygio_pylist_to_gfile_glist(pyfile_list);
+
+ else {
+ PyErr_SetString(PyExc_TypeError,
+ "file_list should be a list of strings or None");
+ return NULL;
+ }
+
+ ret = g_app_info_launch(G_APP_INFO(self->obj),
+ file_list, ctx, &error);
+
+ g_list_free(file_list);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ return PyBool_FromLong(ret);
+}
+%%
+override-slot GAppInfo.tp_richcompare
+static PyObject *
+_wrap_g_app_info_tp_richcompare(PyGObject *self, PyGObject *other, int op)
+{
+ PyObject *result;
+
+ if (PyObject_TypeCheck(self, &PyGAppInfo_Type)
+ && PyObject_TypeCheck(other, &PyGAppInfo_Type)) {
+ GAppInfo *info1 = G_APP_INFO(self->obj);
+ GAppInfo *info2 = G_APP_INFO(other->obj);
+
+ switch (op) {
+ case Py_EQ:
+ result = (g_app_info_equal(info1, info2)
+ ? Py_True : Py_False);
+ break;
+ case Py_NE:
+ result = (!g_app_info_equal(info1, info2)
+ ? Py_True : Py_False);
+ break;
+ default:
+ result = Py_NotImplemented;
+ }
+ }
+ else
+ result = Py_NotImplemented;
+
+ Py_INCREF(result);
+ return result;
+}
+%%
+override-slot GAppInfo.tp_repr
+static PyObject *
+_wrap_g_app_info_tp_repr(PyGObject *self)
+{
+ const char *name = g_app_info_get_name(G_APP_INFO(self->obj));
+ gchar *representation;
+ PyObject *result;
+
+ representation = g_strdup_printf("<%s at %p: %s>",
+ self->ob_type->tp_name, self,
+ name ? name : "UNKNOWN NAME");
+
+ result = PyString_FromString(representation);
+ g_free(representation);
+ return result;
+}
diff --git a/gio/gapplaunchcontext.override b/gio/gapplaunchcontext.override
new file mode 100644
index 0000000..a10f959
--- /dev/null
+++ b/gio/gapplaunchcontext.override
@@ -0,0 +1,99 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Gian Mario Tagliaretti
+ *
+ * gapplaunchcontext.override: module overrides for GAppLaunchContext
+ *
+ * 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_app_launch_context_get_display kwargs
+static PyObject *
+_wrap_g_app_launch_context_get_display(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "info", "files", NULL };
+
+ GList *file_list = NULL;
+ PyGObject *py_info;
+ PyObject *pyfile_list;
+ gchar *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O:gio.AppLaunchContext.get_display",
+ kwlist,
+ &PyGAppInfo_Type, &py_info, &pyfile_list))
+ return NULL;
+
+ if (!PySequence_Check (pyfile_list)) {
+ PyErr_Format (PyExc_TypeError,
+ "argument must be a list or tuple of GFile objects");
+ return NULL;
+ }
+
+ file_list = pygio_pylist_to_gfile_glist(pyfile_list);
+
+ ret = g_app_launch_context_get_display(G_APP_LAUNCH_CONTEXT(self->obj),
+ G_APP_INFO(py_info->obj), file_list);
+ g_list_free(file_list);
+
+ if (ret)
+ return PyString_FromString(ret);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override g_app_launch_context_get_startup_notify_id kwargs
+static PyObject *
+_wrap_g_app_launch_context_get_startup_notify_id(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "info", "files", NULL };
+
+ GList *file_list = NULL;
+ PyGObject *py_info;
+ PyObject *pyfile_list;
+ gchar *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O:gio.AppLaunchContext.get_startup_notify_id",
+ kwlist,
+ &PyGAppInfo_Type, &py_info, &pyfile_list))
+ return NULL;
+
+ if (!PySequence_Check (pyfile_list)) {
+ PyErr_Format (PyExc_TypeError,
+ "argument must be a list or tuple of GFile objects");
+ return NULL;
+ }
+
+ file_list = pygio_pylist_to_gfile_glist(pyfile_list);
+
+ ret = g_app_launch_context_get_startup_notify_id(
+ G_APP_LAUNCH_CONTEXT(self->obj),
+ G_APP_INFO(py_info->obj), file_list);
+ g_list_free(file_list);
+
+ if (ret)
+ return PyString_FromString(ret);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
diff --git a/gio/gbufferedinputstream.override b/gio/gbufferedinputstream.override
new file mode 100644
index 0000000..047a663
--- /dev/null
+++ b/gio/gbufferedinputstream.override
@@ -0,0 +1,70 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gbufferedinputstream.override: module overrides for GBufferedInputStream
+ *
+ * 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_buffered_input_stream_fill_async kwargs
+static PyObject *
+_wrap_g_buffered_input_stream_fill_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "count", "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ long count = -1;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "lO|iOO:gio.BufferedInputStream.fill_async",
+ kwlist,
+ &count,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_buffered_input_stream_fill_async(G_BUFFERED_INPUT_STREAM(self->obj),
+ count,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gcancellable.override b/gio/gcancellable.override
new file mode 100644
index 0000000..1eefb3b
--- /dev/null
+++ b/gio/gcancellable.override
@@ -0,0 +1,38 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gcancellable.override: module overrides for GCancellable
+ *
+ * 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_cancellable_make_pollfd noargs
+static PyObject *
+_wrap_g_cancellable_make_pollfd (PyGObject *self)
+{
+ GPollFD pollfd;
+ gboolean ret;
+ PyGPollFD *pypollfd;
+
+ ret = g_cancellable_make_pollfd(G_CANCELLABLE(self->obj), &pollfd);
+
+ pypollfd = PyObject_NEW(PyGPollFD, &PyGPollFD_Type);
+ pypollfd->fd_obj = NULL;
+ pypollfd->pollfd = pollfd;
+ return (PyObject *) pypollfd;
+}
diff --git a/gio/gdatainputstream.override b/gio/gdatainputstream.override
new file mode 100644
index 0000000..92b0f99
--- /dev/null
+++ b/gio/gdatainputstream.override
@@ -0,0 +1,250 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ * Copyright (C) 2009 Paul Pogonyshev
+ *
+ * gdatainputstream.override: module overrides for GDataInputStream
+ *
+ * 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_data_input_stream_read_line kwargs
+static PyObject *
+_wrap_g_data_input_stream_read_line(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "cancellable", NULL };
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ char *line;
+ gsize length;
+ PyObject *py_line;
+ GError *error = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|O:gio.DataInputStream.read_line",
+ kwlist, &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ line = g_data_input_stream_read_line(G_DATA_INPUT_STREAM(self->obj),
+ &length, cancellable, &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ py_line = PyString_FromStringAndSize(line, length);
+ g_free(line);
+ return py_line;
+}
+
+%%
+override g_data_input_stream_read_line_async kwargs
+static PyObject *
+_wrap_g_data_input_stream_read_line_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:gio.DataInputStream.read_line_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_data_input_stream_read_line_async(G_DATA_INPUT_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+
+%%
+override g_data_input_stream_read_line_finish kwargs
+static PyObject *
+_wrap_g_data_input_stream_read_line_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GError *error = NULL;
+ gchar *line;
+ gsize length;
+ PyObject *py_line;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.DataInputStream.read_line_finish",
+ kwlist, &PyGAsyncResult_Type, &result))
+ return NULL;
+
+ line = g_data_input_stream_read_line_finish(G_DATA_INPUT_STREAM(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &length,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ py_line = PyString_FromStringAndSize(line, length);
+ g_free(line);
+ return py_line;
+}
+
+%%
+override g_data_input_stream_read_until kwargs
+static PyObject *
+_wrap_g_data_input_stream_read_until(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "stop_chars", "cancellable", NULL };
+ const char *stop_chars;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ char *line;
+ gsize length;
+ PyObject *py_line;
+ GError *error = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s|O:gio.DataInputStream.read_line",
+ kwlist, &stop_chars, &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ line = g_data_input_stream_read_until(G_DATA_INPUT_STREAM(self->obj),
+ stop_chars, &length, cancellable, &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ py_line = PyString_FromStringAndSize(line, length);
+ g_free(line);
+ return py_line;
+}
+
+%%
+override g_data_input_stream_read_until_async kwargs
+static PyObject *
+_wrap_g_data_input_stream_read_until_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "stop_chars", "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ const char *stop_chars;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|iOO:gio.DataInputStream.read_until_async",
+ kwlist,
+ &stop_chars,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_data_input_stream_read_until_async(G_DATA_INPUT_STREAM(self->obj),
+ stop_chars,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+
+%%
+override g_data_input_stream_read_until_finish kwargs
+static PyObject *
+_wrap_g_data_input_stream_read_until_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GError *error = NULL;
+ gchar *line;
+ gsize length;
+ PyObject *py_line;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.DataInputStream.read_until_finish",
+ kwlist, &PyGAsyncResult_Type, &result))
+ return NULL;
+
+ line = g_data_input_stream_read_until_finish(G_DATA_INPUT_STREAM(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &length,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ py_line = PyString_FromStringAndSize(line, length);
+ g_free(line);
+ return py_line;
+}
diff --git a/gio/gdrive.override b/gio/gdrive.override
new file mode 100644
index 0000000..7961856
--- /dev/null
+++ b/gio/gdrive.override
@@ -0,0 +1,347 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gdrive.override: module overrides for GDrive and related types
+ *
+ * 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_drive_get_volumes noargs
+static PyObject *
+_wrap_g_drive_get_volumes (PyGObject *self)
+{
+ GList *list, *l;
+ PyObject *ret;
+
+ pyg_begin_allow_threads;
+
+ list = g_drive_get_volumes (G_DRIVE (self->obj));
+
+ pyg_end_allow_threads;
+
+ 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_object_unref(volume);
+ }
+ g_list_free(list);
+
+ return ret;
+}
+%%
+override g_drive_eject kwargs
+static PyObject *
+_wrap_g_drive_eject(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:gio.Drive.eject",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (PyErr_Warn(PyExc_DeprecationWarning,
+ "gio.Drive.ejectis deprecated, \
+ use gtk.Drive.eject_with_operation instead") < 0)
+ return NULL;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_drive_eject(G_DRIVE(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_drive_poll_for_media kwargs
+static PyObject *
+_wrap_g_drive_poll_for_media(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:gio.Drive.eject",
+ kwlist,
+ ¬ify->callback,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ pyg_begin_allow_threads;
+
+ g_drive_poll_for_media(G_DRIVE(self->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ pyg_end_allow_threads;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override-slot GDrive.tp_repr
+static PyObject *
+_wrap_g_drive_tp_repr(PyGObject *self)
+{
+ char *name = g_drive_get_name(G_DRIVE(self->obj));
+ gchar *representation;
+ PyObject *result;
+
+ if (name) {
+ representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, name);
+ g_free(name);
+ }
+ else
+ representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self);
+
+ result = PyString_FromString(representation);
+ g_free(representation);
+ return result;
+}
+%%
+override g_drive_enumerate_identifiers noargs
+static PyObject *
+_wrap_g_drive_enumerate_identifiers (PyGObject *self)
+{
+ char **ids;
+ PyObject *ret;
+
+ pyg_begin_allow_threads;
+
+ ids = g_drive_enumerate_identifiers(G_DRIVE (self->obj));
+
+ pyg_end_allow_threads;
+
+ if (ids && ids[0] != NULL) {
+ ret = strv_to_pylist(ids);
+ g_strfreev (ids);
+ } else {
+ ret = Py_None;
+ Py_INCREF(ret);
+ }
+ return ret;
+}
+%%
+override g_drive_eject_with_operation kwargs
+static PyObject *
+_wrap_g_drive_eject_with_operation(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Drive.eject_with_operation",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_drive_eject_with_operation(G_DRIVE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_drive_start kwargs
+static PyObject *
+_wrap_g_drive_start(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ GDriveStartFlags flags = G_DRIVE_START_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Drive.start",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_DRIVE_START_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_drive_start(G_DRIVE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_drive_stop kwargs
+static PyObject *
+_wrap_g_drive_stop(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Drive.stop",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_drive_stop(G_DRIVE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gfile.override b/gio/gfile.override
new file mode 100644
index 0000000..1301963
--- /dev/null
+++ b/gio/gfile.override
@@ -0,0 +1,2215 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gfile.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+headers
+
+static void
+file_progress_callback_marshal(goffset current_num_bytes,
+ goffset total_num_bytes,
+ PyGIONotify *notify)
+{
+ PyObject *ret;
+ PyGILState_STATE state;
+
+ state = pyg_gil_state_ensure();
+
+ if (notify->data)
+ ret = PyObject_CallFunction(notify->callback, "(KKO)",
+ current_num_bytes,
+ total_num_bytes,
+ notify->data);
+ else
+ ret = PyObject_CallFunction(notify->callback, "(KK)",
+ current_num_bytes,
+ total_num_bytes);
+
+ if (ret == NULL)
+ {
+ PyErr_Print();
+ PyErr_Clear();
+ }
+
+ Py_XDECREF(ret);
+ pyg_gil_state_release(state);
+}
+%%
+define _install_file_meta
+static PyObject *
+_wrap__install_file_meta(PyObject *self, PyObject *args)
+{
+ PyObject *metaclass;
+
+ if (!PyArg_ParseTuple(args, "O", &metaclass))
+ return NULL;
+
+ Py_INCREF(metaclass);
+ PyGFile_Type.ob_type = (PyTypeObject*)metaclass;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+define _file_init kwargs
+static PyObject*
+_wrap__file_init(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ GFile *file;
+ Py_ssize_t n_args, n_kwargs;
+ char *arg;
+ PyObject *py_ret;
+
+ n_args = PyTuple_Size(args);
+ n_kwargs = kwargs != NULL ? PyDict_Size(kwargs) : 0;
+
+ if (n_args == 1 && n_kwargs == 0) {
+ if (!PyArg_ParseTuple(args, "s:gio.File.__init__", &arg))
+ return NULL;
+ file = g_file_new_for_commandline_arg(arg);
+ } else if (n_args == 0 && n_kwargs == 1) {
+ if (PyDict_GetItemString(kwargs, "path")) {
+ char *kwlist[] = { "path", NULL };
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s:gio.File.__init__", kwlist, &arg))
+ return NULL;
+ file = g_file_new_for_path(arg);
+ } else if (PyDict_GetItemString(kwargs, "uri")) {
+ char *kwlist[] = { "uri", NULL };
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s:gio.File.__init__", kwlist, &arg))
+ return NULL;
+ file = g_file_new_for_uri(arg);
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "gio.File() got an unexpected keyword argument '%s'",
+ "unknown");
+ return NULL;
+ }
+ } else {
+ PyErr_Format(PyExc_TypeError,
+ "gio.File() takes exactly 1 argument (%zd given)",
+ n_args + n_kwargs);
+ return NULL;
+ }
+
+ if (!file) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "could not create GFile object");
+ return NULL;
+ }
+
+ py_ret = pygobject_new((GObject *)file);
+ g_object_unref(file);
+
+ return py_ret;
+}
+%%
+override g_file_read_async kwargs
+static PyObject *
+_wrap_g_file_read_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:File.read_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_read_async(G_FILE(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_load_contents kwargs
+static PyObject *
+_wrap_g_file_load_contents(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "cancellable", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ gchar *contents, *etag_out;
+ gsize length;
+ GError *error = NULL;
+ gboolean ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|O:File.load_contents",
+ kwlist,
+ &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ pyg_begin_allow_threads;
+
+ ret = g_file_load_contents(G_FILE(self->obj), cancellable,
+ &contents, &length, &etag_out, &error);
+
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret) {
+ PyObject *pyret;
+
+ pyret = Py_BuildValue("(s#ks)", contents, length, length, etag_out);
+ g_free(contents);
+ g_free(etag_out);
+ return pyret;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_file_load_contents_async kwargs
+static PyObject *
+_wrap_g_file_load_contents_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:File.load_contents_async",
+ kwlist,
+ ¬ify->callback,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_load_contents_async(G_FILE(self->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_load_contents_finish kwargs
+static PyObject *
+_wrap_g_file_load_contents_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "res", NULL };
+ PyGObject *res;
+ gchar *contents, *etag_out;
+ gsize length;
+ GError *error = NULL;
+ gboolean ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:File.load_contents_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &res))
+ return NULL;
+
+ ret = g_file_load_contents_finish(G_FILE(self->obj),
+ G_ASYNC_RESULT(res->obj), &contents,
+ &length, &etag_out, &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret) {
+ PyObject *pyret;
+
+ pyret = Py_BuildValue("(s#ks)", contents, length, length, etag_out);
+ g_free(contents);
+ g_free(etag_out);
+ return pyret;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_file_enumerate_children_async kwargs
+static PyObject *
+_wrap_g_file_enumerate_children_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "attributes", "callback", "flags",
+ "io_priority", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ char *attributes;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE;
+ GCancellable *cancellable = NULL;
+ PyGObject *py_cancellable = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|OiOO:gio.File.enumerate_children_async",
+ kwlist,
+ &attributes,
+ ¬ify->callback,
+ &py_flags,
+ &io_priority,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_QUERY_INFO_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_enumerate_children_async(G_FILE(self->obj),
+ attributes,
+ flags,
+ io_priority,
+ (GCancellable *) cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_mount_mountable kwargs
+static PyObject *
+_wrap_g_file_mount_mountable(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "mount_operation", "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OOO:File.mount_mountable",
+ kwlist,
+ &PyGMountOperation_Type,
+ &mount_operation,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_mount_mountable(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_unmount_mountable kwargs
+static PyObject *
+_wrap_g_file_unmount_mountable(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:File.unmount_mountable",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_unmount_mountable(G_FILE(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_unmount_mountable_with_operation kwargs
+static PyObject *
+_wrap_g_file_unmount_mountable_with_operation(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:File.unmount_mountable_with_operation",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_unmount_mountable_with_operation(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_mount_enclosing_volume kwargs
+static PyObject *
+_wrap_g_file_mount_enclosing_volume(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "mount_operation", "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OOO:File.mount_enclosing_volume",
+ kwlist,
+ &PyGMountOperation_Type,
+ &mount_operation,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_mount_enclosing_volume(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_copy kwargs
+static PyObject *
+_wrap_g_file_copy(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "destination", "progress_callback",
+ "flags", "cancellable",
+ "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *destination = NULL;
+ PyGObject *py_cancellable = NULL;
+ GFileCopyFlags flags = G_FILE_COPY_NONE;
+ GCancellable *cancellable;
+ int ret;
+ GError *error = NULL;
+ GFileProgressCallback callback = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!|OOOO:File.copy",
+ kwlist,
+ &PyGFile_Type,
+ &destination,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (pygio_notify_using_optional_callback(notify)) {
+ callback = (GFileProgressCallback)file_progress_callback_marshal;
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+ }
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_COPY_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ /* No need to reference callback here, because it will be used
+ * only while this function is in progress. */
+
+ pyg_begin_allow_threads;
+
+ ret = g_file_copy(G_FILE(self->obj),
+ G_FILE(destination->obj),
+ flags,
+ cancellable,
+ callback,
+ notify,
+ &error);
+
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ goto error;
+
+ pygio_notify_free(notify);
+ return PyBool_FromLong(ret);
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_copy_async kwargs
+static PyObject *
+_wrap_g_file_copy_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "destination", "callback", "progress_callback",
+ "flags", "io_priority", "cancellable",
+ "user_data", "progress_callback_data", NULL };
+ PyGIONotify *notify, *progress_notify;
+ PyObject *py_flags = NULL;
+ PyGObject *destination = NULL;
+ PyGObject *py_cancellable = NULL;
+ GFileCopyFlags flags = G_FILE_COPY_NONE;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ GFileProgressCallback progress_callback = NULL;
+
+ /* After the creation, referencing/freeing will automatically be
+ * done on the master and the slave. */
+ notify = pygio_notify_new();
+ progress_notify = pygio_notify_new_slave(notify);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OOiOOO:File.copy_async",
+ kwlist,
+ &PyGFile_Type,
+ &destination,
+ ¬ify->callback,
+ &progress_notify->callback,
+ &py_flags,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data,
+ &progress_notify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ if (pygio_notify_using_optional_callback(progress_notify)) {
+ progress_callback = (GFileProgressCallback) file_progress_callback_marshal;
+ if (!pygio_notify_callback_is_valid_full(progress_notify, "progress_callback"))
+ goto error;
+ }
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_copy_async(G_FILE(self->obj),
+ G_FILE(destination->obj),
+ flags,
+ io_priority,
+ cancellable,
+ progress_callback,
+ progress_notify,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_move kwargs
+static PyObject *
+_wrap_g_file_move(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "destination", "progress_callback",
+ "flags", "cancellable",
+ "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *destination = NULL;
+ PyGObject *py_cancellable = NULL;
+ GFileCopyFlags flags = G_FILE_COPY_NONE;
+ GCancellable *cancellable;
+ int ret;
+ GError *error = NULL;
+ GFileProgressCallback callback = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!|OOOO:File.move",
+ kwlist,
+ &PyGFile_Type,
+ &destination,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (pygio_notify_using_optional_callback(notify)) {
+ callback = (GFileProgressCallback)file_progress_callback_marshal;
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+ }
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_COPY_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ /* No need to reference callback here, because it will be used
+ * only while this function is in progress. */
+
+ pyg_begin_allow_threads;
+
+ ret = g_file_move(G_FILE(self->obj),
+ G_FILE(destination->obj),
+ flags,
+ cancellable,
+ callback,
+ notify,
+ &error);
+
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ goto error;
+
+ pygio_notify_free(notify);
+ return PyBool_FromLong(ret);
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_set_attribute kwargs
+static char**
+pyg_strv_from_pyobject(PyObject *value, const char *exc_msg)
+{
+ gchar** strv;
+ Py_ssize_t len, i;
+ PyObject* fast_seq;
+
+ fast_seq = PySequence_Fast(value, exc_msg);
+ if (fast_seq == NULL)
+ return NULL;
+
+ len = PySequence_Length(fast_seq);
+ if (len == -1)
+ return NULL;
+
+ strv = g_malloc(sizeof(char*) * (len + 1));
+ if (strv == NULL) {
+ PyErr_NoMemory();
+ goto failure;
+ }
+
+ for (i = 0; i < len + 1; i++)
+ strv[i] = NULL;
+
+ for (i = 0; i < len; i++) {
+ PyObject* item = PySequence_Fast_GET_ITEM(fast_seq, i);
+ const char *s;
+
+ if (!PyString_Check(item)) {
+ PyErr_SetString(PyExc_TypeError, exc_msg);
+ goto failure;
+ }
+
+ s = PyString_AsString(item);
+ if (s == NULL)
+ goto failure;
+
+ strv[i] = g_strdup(s);
+ if (strv[i] == NULL) {
+ PyErr_NoMemory();
+ goto failure;
+ }
+ }
+
+ return strv;
+
+ failure:
+ g_strfreev(strv);
+ Py_XDECREF(fast_seq);
+ return NULL;
+}
+
+static PyObject *
+_wrap_g_file_set_attribute(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "attribute", "type", "value_p",
+ "flags", "cancellable", NULL };
+ GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE;
+ int ret = 0;
+ GCancellable *cancellable = NULL;
+ GError *error = NULL;
+ char *attribute;
+ PyObject *py_type = NULL, *py_flags = NULL, *value;
+ PyGObject *pycancellable = NULL;
+ GFileAttributeType type;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"sOO|OO:gio.File.set_attribute",
+ kwlist, &attribute, &py_type, &value,
+ &py_flags, &pycancellable))
+ return NULL;
+
+ if (pyg_enum_get_value(G_TYPE_FILE_ATTRIBUTE_TYPE, py_type,
+ (gpointer)&type))
+ return NULL;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_QUERY_INFO_FLAGS, py_flags,
+ (gpointer)&flags))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ switch (type) {
+ case G_FILE_ATTRIBUTE_TYPE_STRING:
+ {
+ char* s;
+ if (!PyString_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be a str when type is FILE_ATTRIBUTE_TYPE_STRING");
+ return NULL;
+ }
+
+ s = PyString_AsString(value);
+ if (s == NULL)
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ s, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING:
+ {
+ char* s;
+ if (!PyString_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be a bytes instance when type is FILE_ATTRIBUTE_TYPE_BYTE_STRING");
+ return NULL;
+ }
+
+ s = PyString_AsString(value);
+ if (s == NULL)
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ s, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_STRINGV:
+ {
+ gchar** strv;
+
+ strv = pyg_strv_from_pyobject(value, "set_attribute value must be a list of strings when type is FILE_ATTRIBUTE_TYPE_STRINGV");
+ if (strv == NULL)
+ break;
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ strv, flags, (GCancellable *) cancellable,
+ &error);
+ g_strfreev(strv);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_OBJECT:
+ {
+ GObject* obj;
+
+ if (!pygobject_check(value, &PyGObject_Type)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be a GObject instance when type is FILE_ATTRIBUTE_TYPE_OBJECT");
+ return NULL;
+ }
+
+ obj = pygobject_get(value);
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ obj, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_BOOLEAN:
+ {
+ gboolean boolval;
+
+ boolval = PyObject_IsTrue(value);
+ if (boolval == -1 && PyErr_Occurred())
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ &boolval, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_UINT32:
+ {
+ guint32 intval;
+
+ if (!PyInt_Check(value) && !PyLong_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be an int when type is FILE_ATTRIBUTE_TYPE_UINT32");
+ return NULL;
+ }
+
+ intval = PyLong_AsUnsignedLong(value);
+ if (intval == -1 && PyErr_Occurred())
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ &intval, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_INT32:
+ {
+ gint32 intval;
+
+ if (!PyInt_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be an int when type is FILE_ATTRIBUTE_TYPE_INT32");
+ return NULL;
+ }
+
+ intval = PyInt_AsLong(value);
+ if (intval == -1 && PyErr_Occurred())
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ &intval, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_UINT64:
+ {
+ guint64 intval;
+
+ if (!PyInt_Check(value) && !PyLong_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be a long int when type is FILE_ATTRIBUTE_TYPE_UINT64");
+ return NULL;
+ }
+
+ intval = PyLong_AsLongLong(value);
+ if (intval == -1 && PyErr_Occurred())
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ &intval, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_INT64:
+ {
+ gint64 intval;
+
+ if (!PyInt_Check(value) && !PyLong_Check(value)) {
+ PyErr_Format(PyExc_TypeError,
+ "set_attribute value must be a long int when type is FILE_ATTRIBUTE_TYPE_INT64");
+ return NULL;
+ }
+
+ intval = PyLong_AsUnsignedLongLong(value);
+ if (intval == -1 && PyErr_Occurred())
+ return NULL;
+
+ ret = g_file_set_attribute(G_FILE(self->obj), attribute, type,
+ &intval, flags, (GCancellable *) cancellable,
+ &error);
+ }
+ break;
+
+ case G_FILE_ATTRIBUTE_TYPE_INVALID:
+
+ default:
+ PyErr_SetString(PyExc_TypeError,
+ "Unknown type specified in set_attribute\n");
+ return NULL;
+ }
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ return PyBool_FromLong(ret);
+}
+%%
+override g_file_query_settable_attributes kwargs
+static PyObject *
+_wrap_g_file_query_settable_attributes(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "cancellable", NULL };
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable = NULL;
+ GFileAttributeInfoList *ret;
+ GError *error = NULL;
+ gint i, n_infos;
+ GFileAttributeInfo *infos;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|O:gio.File.query_settable_attributes",
+ kwlist, &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ ret = g_file_query_settable_attributes(G_FILE(self->obj),
+ (GCancellable *) cancellable,
+ &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ n_infos = ret->n_infos;
+ infos = ret->infos;
+
+ if (n_infos > 0) {
+ py_ret = PyList_New(n_infos);
+ for (i = 0; i < n_infos; i++) {
+ PyList_SetItem(py_ret, i, pyg_file_attribute_info_new(&infos[i]));
+ }
+ g_file_attribute_info_list_unref(ret);
+ return py_ret;
+
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_file_query_writable_namespaces kwargs
+static PyObject *
+_wrap_g_file_query_writable_namespaces(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "cancellable", NULL };
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable = NULL;
+ GFileAttributeInfoList *ret;
+ GError *error = NULL;
+ gint i, n_infos;
+ GFileAttributeInfo *infos;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|O:gio.File.query_writable_namespaces",
+ kwlist, &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ ret = g_file_query_writable_namespaces(G_FILE(self->obj),
+ (GCancellable *) cancellable,
+ &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ n_infos = ret->n_infos;
+ infos = ret->infos;
+
+ if (n_infos > 0) {
+ py_ret = PyList_New(n_infos);
+ for (i = 0; i < n_infos; i++) {
+ PyList_SetItem(py_ret, i, pyg_file_attribute_info_new(&infos[i]));
+ }
+ g_file_attribute_info_list_unref(ret);
+ return py_ret;
+
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_file_append_to_async kwargs
+static PyObject *
+_wrap_g_file_append_to_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "io_priority",
+ "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OiOO:File.append_to_async",
+ kwlist,
+ ¬ify->callback,
+ &py_flags, &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_append_to_async(G_FILE(self->obj), flags, io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_create_async kwargs
+static PyObject *
+_wrap_g_file_create_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "io_priority",
+ "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OiOO:File.create_async",
+ kwlist,
+ ¬ify->callback,
+ &py_flags, &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_create_async(G_FILE(self->obj), flags, io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_create_readwrite_async kwargs
+static PyObject *
+_wrap_g_file_create_readwrite_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "io_priority",
+ "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OiOO:File.create_readwrite_async",
+ kwlist,
+ ¬ify->callback,
+ &py_flags, &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_create_readwrite_async(G_FILE(self->obj), flags, io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_open_readwrite_async kwargs
+static PyObject *
+_wrap_g_file_open_readwrite_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:File.open_readwrite_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_open_readwrite_async(G_FILE(self->obj), io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_replace_readwrite_async kwargs
+static PyObject *
+_wrap_g_file_replace_readwrite_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "etag", "make_backup", "flags",
+ "io_priority", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ char *etag = NULL;
+ gboolean make_backup = TRUE;
+ PyObject *py_backup = Py_True;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|zOOiOO:File.replace_readwrite_async",
+ kwlist,
+ ¬ify->callback,
+ &etag, &py_backup,
+ &flags, &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ make_backup = PyObject_IsTrue(py_backup) ? TRUE : FALSE;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_replace_readwrite_async(G_FILE(self->obj), etag, make_backup, flags,
+ io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_replace_async kwargs
+static PyObject *
+_wrap_g_file_replace_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "etag", "make_backup", "flags",
+ "io_priority", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ char *etag = NULL;
+ gboolean make_backup = TRUE;
+ PyObject *py_backup = Py_True;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|zOOiOO:File.replace_async",
+ kwlist,
+ ¬ify->callback,
+ &etag, &py_backup,
+ &py_flags, &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ make_backup = PyObject_IsTrue(py_backup) ? TRUE : FALSE;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_replace_async(G_FILE(self->obj), etag, make_backup, flags,
+ io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_query_info_async kwargs
+static PyObject *
+_wrap_g_file_query_info_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "attributes", "callback", "flags",
+ "io_priority", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE;
+ PyObject *py_flags = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ char *attributes;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|OiOO:File.query_info_async",
+ kwlist,
+ &attributes,
+ ¬ify->callback,
+ &flags, &io_priority,
+ &pycancellable,
+ ¬ify->data)) {
+ /* To preserve compatibility with 2.16 we also allow swapped
+ * 'attributes' and 'callback'. FIXME: Remove for 3.0. */
+ static char *old_kwlist[] = { "callback", "attributes", "flags",
+ "io_priority", "cancellable", "user_data", NULL };
+ PyObject *exc_type, *exc_value, *exc_traceback;
+
+ PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "Os|OiOO:File.query_info_async",
+ old_kwlist,
+ ¬ify->callback,
+ &attributes,
+ &flags, &io_priority,
+ &pycancellable,
+ ¬ify->data)
+ || !pygio_notify_callback_is_valid(notify)) {
+ /* Report the error with new parameters. */
+ PyErr_Restore(exc_type, exc_value, exc_traceback);
+ goto error;
+ }
+
+ Py_XDECREF(exc_type);
+ Py_XDECREF(exc_value);
+ Py_XDECREF(exc_traceback);
+ }
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_query_info_async(G_FILE(self->obj), attributes, flags,
+ io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_replace_contents kwargs
+static PyObject *
+_wrap_g_file_replace_contents(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "contents", "etag", "make_backup",
+ "flags", "cancellable", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ gsize length;
+ gboolean make_backup = FALSE;
+ char *contents;
+ char *etag = NULL;
+ char *new_etag = NULL;
+ GError *error = NULL;
+ gboolean ret;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s#|zbOO:File.replace_contents",
+ kwlist,
+ &contents,
+ &length,
+ &etag,
+ &make_backup,
+ &flags,
+ &cancellable))
+ {
+ return NULL;
+ }
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ pyg_begin_allow_threads;
+
+ ret = g_file_replace_contents(G_FILE(self->obj), contents, length, etag,
+ make_backup, flags, &new_etag, cancellable,
+ &error);
+
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret) {
+ py_ret = PyString_FromString(new_etag);
+ } else {
+ py_ret = Py_None;
+ Py_INCREF(py_ret);
+ }
+
+ g_free(new_etag);
+ return py_ret;
+}
+%%
+override g_file_replace_contents_finish kwargs
+static PyObject *
+_wrap_g_file_replace_contents_finish(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *res;
+ gchar *etag_out = NULL;
+ GError *error = NULL;
+ gboolean ret;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:File.replace_contents_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &res))
+ return NULL;
+
+ ret = g_file_replace_contents_finish(G_FILE(self->obj),
+ G_ASYNC_RESULT(res->obj), &etag_out,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret) {
+ py_ret = PyString_FromString(etag_out);
+ return py_ret;
+ } else {
+ py_ret = Py_None;
+ Py_INCREF(py_ret);
+ }
+
+ g_free(etag_out);
+ return py_ret;
+}
+%%
+override g_file_replace_contents_async kwargs
+static PyObject *
+_wrap_g_file_replace_contents_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "contents", "callback", "etag", "make_backup",
+ "flags", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ PyGIONotify *notify;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ gsize length;
+ gboolean make_backup = FALSE;
+ char *contents;
+ char *etag = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s#O|zbOOO:File.replace_contents_async",
+ kwlist,
+ &contents,
+ &length,
+ ¬ify->callback,
+ &etag,
+ &make_backup,
+ &py_flags,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+ pygio_notify_copy_buffer(notify, contents, length);
+
+ g_file_replace_contents_async(G_FILE(self->obj),
+ notify->buffer,
+ notify->buffer_size,
+ etag,
+ make_backup,
+ flags,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override-slot GFile.tp_richcompare
+static PyObject *
+_wrap_g_file_tp_richcompare(PyGObject *self, PyGObject *other, int op)
+{
+ PyObject *result;
+
+ if (PyObject_TypeCheck(self, &PyGFile_Type)
+ && PyObject_TypeCheck(other, &PyGFile_Type)) {
+ GFile *file1 = G_FILE(self->obj);
+ GFile *file2 = G_FILE(other->obj);
+
+ switch (op) {
+ case Py_EQ:
+ result = (g_file_equal(file1, file2)
+ ? Py_True : Py_False);
+ break;
+ case Py_NE:
+ result = (!g_file_equal(file1, file2)
+ ? Py_True : Py_False);
+ break;
+ default:
+ result = Py_NotImplemented;
+ }
+ }
+ else
+ result = Py_NotImplemented;
+
+ Py_INCREF(result);
+ return result;
+}
+%%
+override-slot GFile.tp_hash
+static long
+_wrap_g_file_tp_hash(PyGObject *self)
+{
+ return g_file_hash(G_FILE(self->obj));
+}
+%%
+override-slot GFile.tp_repr
+static PyObject *
+_wrap_g_file_tp_repr(PyGObject *self)
+{
+ char *uri = g_file_get_uri(G_FILE(self->obj));
+ gchar *representation;
+ PyObject *result;
+
+ if (uri) {
+ representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, uri);
+ g_free(uri);
+ }
+ else
+ representation = g_strdup_printf("<%s at %p: UNKNOWN URI>", self->ob_type->tp_name, self);
+
+ result = PyString_FromString(representation);
+ g_free(representation);
+ return result;
+}
+%%
+override g_file_eject_mountable kwargs
+static PyObject *
+_wrap_g_file_eject_mountable(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags",
+ "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ GFileCreateFlags flags = G_FILE_CREATE_NONE;
+ PyObject *py_flags = NULL;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:File.eject_mountable",
+ kwlist,
+ ¬ify->callback,
+ &flags,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_FILE_CREATE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_eject_mountable(G_FILE(self->obj), flags, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_eject_mountable_with_operation kwargs
+static PyObject *
+_wrap_g_file_eject_mountable_with_operation(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:File.eject_mountable_with_operation",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_eject_mountable_with_operation(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_find_enclosing_mount_async kwargs
+static PyObject *
+_wrap_g_file_find_enclosing_mount_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:File.enclosing_mount_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_find_enclosing_mount_async(G_FILE(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_query_filesystem_info_async kwargs
+static PyObject *
+_wrap_g_file_query_filesystem_info_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "attributes", "callback",
+ "io_priority", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ char *attributes;
+ int io_priority = G_PRIORITY_DEFAULT;
+ GCancellable *cancellable = NULL;
+ PyGObject *py_cancellable = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|iOO:gio.File.query_filesystem_info_async",
+ kwlist,
+ &attributes,
+ ¬ify->callback,
+ &io_priority,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_query_filesystem_info_async(G_FILE(self->obj),
+ attributes,
+ io_priority,
+ (GCancellable *) cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_set_attributes_async kwargs
+static PyObject *
+_wrap_g_file_set_attributes_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "info", "callback", "flags",
+ "io_priority", "cancellable", "user_data", NULL };
+ PyGObject *info;
+ PyGIONotify *notify;
+ GFileQueryInfoFlags flags = G_FILE_QUERY_INFO_NONE;
+ int io_priority = G_PRIORITY_DEFAULT;
+ GCancellable *cancellable = NULL;
+ PyGObject *py_cancellable = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OiOO:gio.File.set_attributes_async",
+ kwlist,
+ &PyGFileInfo_Type,
+ &info,
+ ¬ify->callback,
+ &flags,
+ &io_priority,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_set_attributes_async(G_FILE(self->obj),
+ G_FILE_INFO(info->obj),
+ flags,
+ io_priority,
+ (GCancellable *) cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+
+%%
+override g_file_set_attributes_finish kwargs
+static PyObject *
+_wrap_g_file_set_attributes_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *res;
+ GFileInfo *info = NULL;
+ GError *error = NULL;
+ gboolean ret;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:File.set_attributes_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &res))
+ return NULL;
+
+ ret = g_file_set_attributes_finish(G_FILE(self->obj),
+ G_ASYNC_RESULT(res->obj), &info,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret) {
+ py_ret = pygobject_new((GObject *)info);
+ } else {
+ py_ret = Py_None;
+ Py_INCREF(py_ret);
+ }
+
+ return py_ret;
+}
+%%
+override g_file_set_display_name_async kwargs
+static PyObject *
+_wrap_g_file_set_display_name_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "display_name", "callback",
+ "io_priority", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ char *display_name;
+ int io_priority = G_PRIORITY_DEFAULT;
+ GCancellable *cancellable = NULL;
+ PyGObject *py_cancellable = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|iOO:gio.File.set_display_name_async",
+ kwlist,
+ &display_name,
+ ¬ify->callback,
+ &io_priority,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_set_display_name_async(G_FILE(self->obj),
+ display_name,
+ io_priority,
+ (GCancellable *) cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_poll_mountable kwargs
+static PyObject *
+_wrap_g_file_poll_mountable(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:File.poll_mountable",
+ kwlist,
+ ¬ify->callback,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_poll_mountable(G_FILE(self->obj), cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_start_mountable kwargs
+static PyObject *
+_wrap_g_file_start_mountable(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "start_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ GDriveStartFlags flags = G_DRIVE_START_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:File.start_mountable",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_DRIVE_START_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_start_mountable(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_stop_mountable kwargs
+static PyObject *
+_wrap_g_file_stop_mountable(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.File.stop_mountable",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_stop_mountable(G_FILE(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+
+/* GFile.load_partial_contents_async: No ArgType for GFileReadMoreCallback */
+/* GFile.load_partial_contents_finish: No ArgType for char** */
diff --git a/gio/gfileattribute.override b/gio/gfileattribute.override
new file mode 100644
index 0000000..e51ec63
--- /dev/null
+++ b/gio/gfileattribute.override
@@ -0,0 +1,153 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Gian Mario Tagliaretti
+ *
+ * gfileattribute.override: module overrides for GFileAttribute*
+ *
+ * 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
+ */
+%%
+headers
+
+extern PyTypeObject PyGFileAttributeInfo_Type;
+
+typedef struct {
+ PyObject_HEAD
+ const GFileAttributeInfo *info;
+} PyGFileAttributeInfo;
+
+static PyObject *
+pygio_file_attribute_info_tp_new(PyTypeObject *type)
+{
+ PyGFileAttributeInfo *self;
+ GFileAttributeInfo *info = NULL;
+
+ self = (PyGFileAttributeInfo *) PyObject_NEW(PyGFileAttributeInfo,
+ &PyGFileAttributeInfo_Type);
+ self->info = info;
+ return (PyObject *) self;
+}
+
+static PyMethodDef pyg_file_attribute_info_methods[] = {
+ { NULL, 0, 0 }
+};
+
+static PyObject *
+pyg_file_attribute_info__get_name(PyObject *self, void *closure)
+{
+ const gchar *ret;
+
+ ret = ((PyGFileAttributeInfo*)self)->info->name;
+ if (ret)
+ return PyString_FromString(ret);
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
+pyg_file_attribute_info__get_type(PyObject *self, void *closure)
+{
+ gint ret;
+
+ ret = ((PyGFileAttributeInfo*)self)->info->type;
+ return pyg_enum_from_gtype(G_TYPE_FILE_ATTRIBUTE_TYPE, ret);
+}
+
+static PyObject *
+pyg_file_attribute_info__get_flags(PyObject *self, void *closure)
+{
+ guint ret;
+
+ ret = ((PyGFileAttributeInfo*)self)->info->flags;
+ return pyg_flags_from_gtype(G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, ret);
+}
+
+static const PyGetSetDef pyg_file_attribute_info_getsets[] = {
+ { "name", (getter)pyg_file_attribute_info__get_name, (setter)0 },
+ { "type", (getter)pyg_file_attribute_info__get_type, (setter)0 },
+ { "flags", (getter)pyg_file_attribute_info__get_flags, (setter)0 },
+ { NULL, (getter)0, (setter)0 },
+};
+
+PyTypeObject PyGFileAttributeInfo_Type = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ "gio.FileAttributeInfo", /* tp_name */
+ sizeof(PyGFileAttributeInfo), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ (destructor)0, /* tp_dealloc */
+ (printfunc)0, /* tp_print */
+ (getattrfunc)0, /* tp_getattr */
+ (setattrfunc)0, /* tp_setattr */
+ (cmpfunc)0, /* tp_compare */
+ (reprfunc)0, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ (hashfunc)0, /* tp_hash */
+ (ternaryfunc)0, /* tp_call */
+ (reprfunc)0, /* tp_str */
+ (getattrofunc)0, /* tp_getattro */
+ (setattrofunc)0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ "Holds information about an attribute", /* Documentation string */
+ (traverseproc)0, /* tp_traverse */
+ (inquiry)0, /* tp_clear */
+ (richcmpfunc)0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
+ (getiterfunc)0, /* tp_iter */
+ (iternextfunc)0, /* tp_iternext */
+ (struct PyMethodDef*)pyg_file_attribute_info_methods, /* tp_methods */
+ 0, /* tp_members */
+ (struct PyGetSetDef*)pyg_file_attribute_info_getsets, /* tp_getset */
+ (PyTypeObject *)0, /* tp_base */
+ (PyObject *)0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ (initproc)0, /* tp_init */
+ 0, /* tp_alloc */
+ (newfunc)pygio_file_attribute_info_tp_new, /* tp_new */
+ 0, /* tp_free */
+ (inquiry)0, /* tp_is_gc */
+ (PyObject *)0, /* tp_bases */
+};
+
+PyObject*
+pyg_file_attribute_info_new(const GFileAttributeInfo *info)
+{
+ PyGFileAttributeInfo *self;
+
+ self = (PyGFileAttributeInfo *)PyObject_NEW(PyGFileAttributeInfo,
+ &PyGFileAttributeInfo_Type);
+ if (G_UNLIKELY(self == NULL))
+ return NULL;
+ if (info)
+ self->info = info;
+ return (PyObject *)self;
+}
+
+%%
+init
+if (PyType_Ready(&PyGFileAttributeInfo_Type) < 0) {
+ g_return_if_reached();
+}
+if (PyDict_SetItemString(d, "FileAttributeInfo",
+ (PyObject *)&PyGFileAttributeInfo_Type) < 0) {
+ g_return_if_reached();
+}
diff --git a/gio/gfileenumerator.override b/gio/gfileenumerator.override
new file mode 100644
index 0000000..db29550
--- /dev/null
+++ b/gio/gfileenumerator.override
@@ -0,0 +1,184 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gfileenumerator.override: module overrides for GFileEnumerator
+ *
+ * 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-slot GFileEnumerator.tp_iter
+static PyObject*
+_wrap_g_file_enumerator_tp_iter(PyGObject *self)
+{
+ Py_INCREF (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;
+
+ if (!iter->obj) {
+ PyErr_SetNone(PyExc_StopIteration);
+ return 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);
+}
+%%
+override g_file_enumerator_next_files_async kwargs
+static PyObject *
+_wrap_g_file_enumerator_next_files_async(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "num_files", "callback",
+ "io_priority", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ int num_files;
+ int io_priority = G_PRIORITY_DEFAULT;
+ GCancellable *cancellable = NULL;
+ PyGObject *py_cancellable = NULL;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "iO|iOO:gio.FileEnumerator.enumerate_next_files_async",
+ kwlist,
+ &num_files,
+ ¬ify->callback,
+ &io_priority,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_enumerator_next_files_async(G_FILE_ENUMERATOR(self->obj),
+ num_files,
+ io_priority,
+ (GCancellable *) cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_file_enumerator_next_files_finish kwargs
+static PyObject *
+_wrap_g_file_enumerator_next_files_finish(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GList *next_files, *l;
+ GError *error = NULL;
+ PyObject *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.FileEnumerator.next_files_finish",
+ kwlist,
+ &PyGAsyncResult_Type, &result))
+ return NULL;
+
+ next_files = g_file_enumerator_next_files_finish(G_FILE_ENUMERATOR(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ ret = PyList_New(0);
+ for (l = next_files; l; l = l->next) {
+ GFileInfo *file_info = l->data;
+ PyObject *item = pygobject_new((GObject *)file_info);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ g_object_unref(file_info);
+ }
+ g_list_free(next_files);
+
+ return ret;
+}
+%%
+override g_file_enumerator_close_async kwargs
+static PyObject *
+_wrap_g_file_enumerator_close_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority", "cancellable",
+ "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:gio.FileEnumerator.close_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_enumerator_close_async(G_FILE_ENUMERATOR(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gfileinfo.override b/gio/gfileinfo.override
new file mode 100644
index 0000000..730e91b
--- /dev/null
+++ b/gio/gfileinfo.override
@@ -0,0 +1,121 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ * 2009 Gian Mario Tagliaretti
+ *
+ * gfileinfo.override: module overrides for GFileInfo
+ *
+ * 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
+ */
+
+%%
+headers
+
+#ifndef G_TYPE_FILE_ATTRIBUTE_MATCHER
+#define G_TYPE_FILE_ATTRIBUTE_MATCHER (_g_file_attribute_matcher_get_type ())
+
+static GType _g_file_attribute_matcher_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_boxed_type_register_static ("GFileAttributeMatcher",
+ (GBoxedCopyFunc)g_file_attribute_matcher_ref,
+ (GBoxedFreeFunc)g_file_attribute_matcher_unref);
+
+ return our_type;
+}
+#endif
+
+%%
+override g_file_info_list_attributes kwargs
+static PyObject *
+_wrap_g_file_info_list_attributes(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ char *kwlist[] = { "name_space", NULL};
+ gchar *name_space = NULL;
+ gchar **names;
+ gchar **n;
+ PyObject *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|z:gio.FileInfo.list_attributes",
+ kwlist, &name_space))
+ return NULL;
+
+ names = g_file_info_list_attributes(G_FILE_INFO(self->obj),
+ name_space);
+
+ ret = PyList_New(0);
+ n = names;
+ while (n && *n) {
+ PyObject *item = PyString_FromString(n[0]);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+
+ n++;
+ }
+
+ g_strfreev(names);
+ return ret;
+}
+%%
+override g_file_info_get_modification_time noargs
+static PyObject *
+_wrap_g_file_info_get_modification_time(PyGObject *self, PyObject *unused)
+{
+ GTimeVal timeval;
+
+ g_file_info_get_modification_time(G_FILE_INFO(self->obj), &timeval);
+ return pyglib_float_from_timeval(timeval);
+}
+%%
+override g_file_info_set_modification_time kwargs
+static PyObject *
+_wrap_g_file_info_set_modification_time(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ char *kwlist[] = { "mtime", NULL};
+ double py_mtime = 0.0;
+ GTimeVal ttime, *mtime;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "d:gio.FileInfo.set_modification_time",
+ kwlist, &py_mtime))
+ return NULL;
+
+ if (py_mtime > 0.0) {
+ ttime.tv_sec = (glong) py_mtime;
+ ttime.tv_usec = (glong)((py_mtime - ttime.tv_sec) * G_USEC_PER_SEC);
+ mtime = &ttime;
+ } else if (py_mtime == 0.0) {
+ mtime = NULL;
+ } else {
+ PyErr_SetString(PyExc_ValueError, "mtime must be >= 0.0");
+ return NULL;
+ }
+
+ g_file_info_set_modification_time(G_FILE_INFO(self->obj), mtime);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+/* GFileInfo.get_attribute_data: No ArgType for GFileAttributeType* */
+/* GFileInfo.set_attribute: No ArgType for gpointer */
diff --git a/gio/gfileinputstream.override b/gio/gfileinputstream.override
new file mode 100644
index 0000000..5190a13
--- /dev/null
+++ b/gio/gfileinputstream.override
@@ -0,0 +1,68 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gfileinputstream.override: module overrides for GFileInputStream
+ *
+ * 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_file_input_stream_query_info_async kwargs
+static PyObject *
+_wrap_g_file_input_stream_query_info_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "attributes", "callback",
+ "io_priority", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ char *attributes;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|iOO:gio.FileInputStream.query_info_async",
+ kwlist,
+ &attributes,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_input_stream_query_info_async(G_FILE_INPUT_STREAM(self->obj),
+ attributes, io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gfileiostream.override b/gio/gfileiostream.override
new file mode 100644
index 0000000..7be6124
--- /dev/null
+++ b/gio/gfileiostream.override
@@ -0,0 +1,68 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gfileiostream.override: module overrides for GFileIOStream
+ *
+ * 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_file_io_stream_query_info_async kwargs
+static PyObject *
+_wrap_g_file_io_stream_query_info_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "attributes", "callback",
+ "io_priority", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ char *attributes;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|iOO:gio.FileIOStream.query_info_async",
+ kwlist,
+ &attributes,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_io_stream_query_info_async(G_FILE_IO_STREAM(self->obj),
+ attributes, io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gfileoutputstream.override b/gio/gfileoutputstream.override
new file mode 100644
index 0000000..c5c184d
--- /dev/null
+++ b/gio/gfileoutputstream.override
@@ -0,0 +1,68 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gfileoutputstream.override: module overrides for GFileOuputStream
+ *
+ * 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_file_output_stream_query_info_async kwargs
+static PyObject *
+_wrap_g_file_output_stream_query_info_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "attributes", "callback",
+ "io_priority", "cancellable", "user_data", NULL };
+ GCancellable *cancellable;
+ PyGObject *pycancellable = NULL;
+ int io_priority = G_PRIORITY_DEFAULT;
+ char *attributes;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO|iOO:gio.FileOutputStream.query_info_async",
+ kwlist,
+ &attributes,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_file_output_stream_query_info_async(G_FILE_OUTPUT_STREAM(self->obj),
+ attributes, io_priority, cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gicon.override b/gio/gicon.override
new file mode 100644
index 0000000..c429556
--- /dev/null
+++ b/gio/gicon.override
@@ -0,0 +1,310 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gicon.override: module overrides for GIcon and related types
+ *
+ * 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
+ */
+%%
+ignore-glob
+ g_icon_hash
+ g_themed_icon_new_from_names
+ g_themed_icon_new_with_default_fallbacks
+%%
+override-slot GIcon.tp_richcompare
+static PyObject *
+_wrap_g_icon_tp_richcompare(PyGObject *self, PyGObject *other, int op)
+{
+ PyObject *result;
+
+ if (PyObject_TypeCheck(self, &PyGIcon_Type)
+ && PyObject_TypeCheck(other, &PyGIcon_Type)) {
+ GIcon *icon1 = G_ICON(self->obj);
+ GIcon *icon2 = G_ICON(other->obj);
+
+ switch (op) {
+ case Py_EQ:
+ result = (g_icon_equal(icon1, icon2)
+ ? Py_True : Py_False);
+ break;
+ case Py_NE:
+ result = (!g_icon_equal(icon1, icon2)
+ ? Py_True : Py_False);
+ break;
+ default:
+ result = Py_NotImplemented;
+ }
+ }
+ else
+ result = Py_NotImplemented;
+
+ Py_INCREF(result);
+ return result;
+}
+%%
+override-slot GIcon.tp_hash
+static long
+_wrap_g_icon_tp_hash(PyGObject *self)
+{
+ return g_icon_hash(G_ICON(self->obj));
+}
+%%
+override g_loadable_icon_load kwargs
+static PyObject *
+_wrap_g_loadable_icon_load(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "size", "cancellable", NULL };
+ int size = 0;
+ char *type = NULL;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ GError *error = NULL;
+ GInputStream *stream;
+ PyObject *result;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "|iO:gio.LoadableIcon.load",
+ kwlist,
+ &size, &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ stream = g_loadable_icon_load(G_LOADABLE_ICON(self->obj), size, &type,
+ cancellable, &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ result = Py_BuildValue("Ns", pygobject_new((GObject *) stream), type);
+ g_free(type);
+ return result;
+}
+%%
+override g_loadable_icon_load_async kwargs
+static PyObject *
+_wrap_g_loadable_icon_load_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "size", "cancellable", "user_data", NULL };
+ int size = 0;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:gio.LoadableIcon.load_async",
+ kwlist,
+ ¬ify->callback, &size, &pycancellable, ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_loadable_icon_load_async(G_LOADABLE_ICON(self->obj),
+ size,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_loadable_icon_load_finish kwargs
+static PyObject *
+_wrap_g_loadable_icon_load_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "res", NULL };
+ PyGObject *res;
+ char *type = NULL;
+ GError *error = NULL;
+ GInputStream *stream;
+ PyObject *result;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.LoadableIcon.load_finish",
+ kwlist,
+ &PyGAsyncResult_Type, &res))
+ return NULL;
+
+ stream = g_loadable_icon_load_finish(G_LOADABLE_ICON(self->obj),
+ G_ASYNC_RESULT(res->obj), &type, &error);
+ if (pyg_error_check(&error))
+ return NULL;
+
+ result = Py_BuildValue("Ns", pygobject_new((GObject *) stream), type);
+ g_free(type);
+ return result;
+}
+%%
+override-slot GFileIcon.tp_repr
+static PyObject *
+_wrap_g_file_icon_tp_repr(PyGObject *self)
+{
+ GFile *file = g_file_icon_get_file(G_FILE_ICON(self->obj));
+ char *uri = (file ? g_file_get_uri(file) : NULL);
+ gchar *representation;
+ PyObject *result;
+
+ if (uri) {
+ representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, uri);
+ g_free(uri);
+ }
+ else
+ representation = g_strdup_printf("<%s at %p: UNKNOWN URI>", self->ob_type->tp_name, self);
+
+ result = PyString_FromString(representation);
+ g_free(representation);
+ return result;
+}
+%%
+new-constructor G_TYPE_THEMED_ICON
+%%
+override g_themed_icon_new kwargs
+static int
+_wrap_g_themed_icon_new(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "name", "use_default_fallbacks", NULL };
+ PyObject *name;
+ gboolean use_default_fallbacks = FALSE;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:gio.ThemedIcon.__init__",
+ kwlist, &name, &use_default_fallbacks))
+ return -1;
+
+ if (PyString_Check(name)) {
+ pygobject_construct(self,
+ "name", PyString_AsString(name),
+ "use-default-fallbacks", use_default_fallbacks, NULL);
+ return 0;
+ }
+ else if (PySequence_Check(name)) {
+ PyObject *tuple = PySequence_Tuple(name);
+
+ if (tuple) {
+ int k;
+ int length = PyTuple_Size(tuple);
+ char **names = g_new(char *, length + 1);
+
+ for (k = 0; k < length; k++) {
+ PyObject *str = PyTuple_GetItem(tuple, k);
+ if (str && PyString_Check(str))
+ names[k] = PyString_AsString(str);
+ else {
+ Py_DECREF(tuple);
+ g_free(names);
+ goto error;
+ }
+ }
+
+ names[length] = NULL;
+ pygobject_construct(self,
+ "names", names,
+ "use-default-fallbacks", use_default_fallbacks, NULL);
+ Py_DECREF(tuple);
+ g_free(names);
+ return 0;
+ }
+ }
+
+ error:
+ if (!PyErr_Occurred()) {
+ PyErr_SetString(PyExc_TypeError,
+ "argument 1 of gio.ThemedIcon.__init__ "
+ "must be either a string or a sequence of strings");
+ }
+ return -1;
+}
+%%
+override g_themed_icon_get_names noargs
+static PyObject *
+_wrap_g_themed_icon_get_names(PyGObject *self)
+{
+ const char * const *names;
+ PyObject *ret;
+
+ names = g_themed_icon_get_names(G_THEMED_ICON(self->obj));
+
+ ret = PyList_New(0);
+ while (names && *names) {
+ PyObject *item = PyString_FromString(names[0]);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+
+ names++;
+ }
+
+ return ret;
+}
+%%
+override-slot GThemedIcon.tp_repr
+static PyObject *
+_wrap_g_themed_icon_tp_repr(PyGObject *self)
+{
+ const char * const *names = g_themed_icon_get_names(G_THEMED_ICON(self->obj));
+ GString *representation = g_string_new(NULL);
+ PyObject *result;
+
+ g_string_append_printf(representation, "<%s at %p: ", self->ob_type->tp_name, self);
+
+ if (names) {
+ gboolean first_name = TRUE;
+ while (*names) {
+ if (!first_name)
+ g_string_append(representation, ", ");
+ else
+ first_name = FALSE;
+
+ g_string_append(representation, *names++);
+ }
+ }
+
+ g_string_append(representation, ">");
+ result = PyString_FromString(representation->str);
+ g_string_free(representation, TRUE);
+ return result;
+}
+%%
+override g_emblemed_icon_get_emblems noargs
+static PyObject *
+_wrap_g_emblemed_icon_get_emblems(PyGObject *self)
+{
+ GList *list;
+ PyObject *ret;
+
+ list = g_emblemed_icon_get_emblems(G_EMBLEMED_ICON(self->obj));
+
+ PYLIST_FROMGLIST(ret, list, pygobject_new(list_item), NULL, NULL);
+
+ return ret;
+}
diff --git a/gio/ginputstream.override b/gio/ginputstream.override
new file mode 100644
index 0000000..260b2fc
--- /dev/null
+++ b/gio/ginputstream.override
@@ -0,0 +1,344 @@
+/* -*- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+headers
+#define BUFSIZE 8192
+
+%%
+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,
+ "|lO:InputStream.read",
+ kwlist, &count,
+ &pycancellable))
+ return NULL;
+
+ buffersize = (count < 0 ? BUFSIZE : count);
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return 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;
+ }
+ if (chunksize == 0) {
+ /* End of file. */
+ break;
+ }
+
+ bytesread += chunksize;
+ if (bytesread < buffersize) {
+ /* g_input_stream_read() decided to not read full buffer. We
+ * then return early too, even if 'count' is less than 0.
+ */
+ 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_all kwargs
+static PyObject *
+_wrap_g_input_stream_read_all(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,
+ "|lO:InputStream.read",
+ kwlist, &count,
+ &pycancellable))
+ return NULL;
+
+ buffersize = (count < 0 ? BUFSIZE : count);
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ v = PyString_FromStringAndSize((char *)NULL, buffersize);
+ if (v == NULL)
+ return NULL;
+
+ bytesread = 0;
+ for (;;)
+ {
+ pyg_begin_allow_threads;
+ errno = 0;
+ g_input_stream_read_all(G_INPUT_STREAM(self->obj),
+ PyString_AS_STRING((PyStringObject *)v) + bytesread,
+ buffersize - bytesread,
+ &chunksize,
+ cancellable, &error);
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error)) {
+ Py_DECREF(v);
+ return NULL;
+ }
+
+ bytesread += chunksize;
+ if (bytesread < buffersize || chunksize == 0) {
+ /* End of file. */
+ 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", "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ long count = -1;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "lO|iOO:InputStream.read_async",
+ kwlist,
+ &count,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ if (!pygio_notify_allocate_buffer(notify, count))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+ pygio_notify_attach_to_result(notify);
+
+ g_input_stream_read_async(G_INPUT_STREAM(self->obj),
+ notify->buffer,
+ notify->buffer_size,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_input_stream_read_finish kwargs
+static PyObject *
+_wrap_g_input_stream_read_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GError *error = NULL;
+ Py_ssize_t bytesread;
+ PyGIONotify *notify;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.InputStream.read_finish",
+ kwlist, &PyGAsyncResult_Type, &result))
+ return NULL;
+
+ bytesread = g_input_stream_read_finish(G_INPUT_STREAM(self->obj),
+ G_ASYNC_RESULT(result->obj), &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (bytesread == 0)
+ return PyString_FromString("");
+
+ notify = pygio_notify_get_attached(result);
+ return PyString_FromStringAndSize(notify->buffer, bytesread);
+}
+%%
+override g_input_stream_close_async kwargs
+static PyObject *
+_wrap_g_input_stream_close_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority", "cancellable",
+ "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:InputStream.close_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_input_stream_close_async(G_INPUT_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_input_stream_skip_async kwargs
+static PyObject *
+_wrap_g_input_stream_skip_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "count", "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ long count = -1;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "lO|iOO:InputStream.skip_async",
+ kwlist,
+ &count,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+
+ g_input_stream_skip_async(G_INPUT_STREAM(self->obj),
+ count,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gio-types.defs b/gio/gio-types.defs
new file mode 100644
index 0000000..331e0bc
--- /dev/null
+++ b/gio/gio-types.defs
@@ -0,0 +1,807 @@
+;; -*- scheme -*-
+
+; interface definitions ...
+
+(define-interface AppInfo
+ (in-module "gio")
+ (c-name "GAppInfo")
+ (gtype-id "G_TYPE_APP_INFO")
+)
+
+(define-interface AsyncInitable
+ (in-module "gio")
+ (c-name "GAsyncInitable")
+ (gtype-id "G_TYPE_ASYNC_INITABLE")
+)
+
+(define-interface AsyncResult
+ (in-module "gio")
+ (c-name "GAsyncResult")
+ (gtype-id "G_TYPE_ASYNC_RESULT")
+)
+
+(define-interface Drive
+ (in-module "gio")
+ (c-name "GDrive")
+ (gtype-id "G_TYPE_DRIVE")
+)
+
+(define-interface File
+ (docstring
+"File(arg, path=None, uri=None) -> gio.File subclass\n"
+"\n"
+"If arg is specified; creates a GFile with the given argument from the\n"
+"command line. The value of arg can be either a URI, an absolute path\n"
+"or a relative path resolved relative to the current working directory.\n"
+"If path is specified, create a file from an absolute or relative path.\n"
+"If uri is specified, create a file from a URI.\n\n"
+"This operation never fails, but the returned object might not \n"
+"support any I/O operation if arg points to a malformed path.")
+ (in-module "gio")
+ (c-name "GFile")
+ (gtype-id "G_TYPE_FILE")
+)
+
+(define-interface Icon
+ (in-module "gio")
+ (c-name "GIcon")
+ (gtype-id "G_TYPE_ICON")
+)
+
+(define-interface Initable
+ (in-module "gio")
+ (c-name "GInitable")
+ (gtype-id "G_TYPE_INITABLE")
+)
+
+(define-interface LoadableIcon
+ (in-module "gio")
+ (c-name "GLoadableIcon")
+ (gtype-id "G_TYPE_LOADABLE_ICON")
+)
+
+(define-interface Mount
+ (in-module "gio")
+ (c-name "GMount")
+ (gtype-id "G_TYPE_MOUNT")
+)
+
+(define-interface Seekable
+ (in-module "gio")
+ (c-name "GSeekable")
+ (gtype-id "G_TYPE_SEEKABLE")
+)
+
+(define-interface SocketConnectable
+ (in-module "gio")
+ (c-name "GSocketConnectable")
+ (gtype-id "G_TYPE_SOCKET_CONNECTABLE")
+)
+
+(define-interface Volume
+ (in-module "gio")
+ (c-name "GVolume")
+ (gtype-id "G_TYPE_VOLUME")
+)
+
+; boxed definitions ...
+
+(define-boxed FileAttributeMatcher
+ (in-module "gio")
+ (c-name "GFileAttributeMatcher")
+ (gtype-id "G_TYPE_FILE_ATTRIBUTE_MATCHER")
+)
+
+(define-boxed SrvTarget
+ (in-module "gio")
+ (c-name "GSrvTarget")
+ (gtype-id "G_TYPE_SRV_TARGET")
+)
+
+; object definitions ...
+
+(define-object AppLaunchContext
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GAppLaunchContext")
+ (gtype-id "G_TYPE_APP_LAUNCH_CONTEXT")
+)
+
+(define-object Cancellable
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GCancellable")
+ (gtype-id "G_TYPE_CANCELLABLE")
+)
+
+(define-object Emblem
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GEmblem")
+ (gtype-id "G_TYPE_EMBLEM")
+)
+
+(define-object EmblemedIcon
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GEmblemedIcon")
+ (gtype-id "G_TYPE_EMBLEMED_ICON")
+)
+
+(define-object FileEnumerator
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GFileEnumerator")
+ (gtype-id "G_TYPE_FILE_ENUMERATOR")
+)
+
+(define-object FileInfo
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GFileInfo")
+ (gtype-id "G_TYPE_FILE_INFO")
+)
+
+(define-object FileMonitor
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GFileMonitor")
+ (gtype-id "G_TYPE_FILE_MONITOR")
+)
+
+(define-object InputStream
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GInputStream")
+ (gtype-id "G_TYPE_INPUT_STREAM")
+)
+
+(define-object FileInputStream
+ (in-module "gio")
+ (parent "GInputStream")
+ (c-name "GFileInputStream")
+ (gtype-id "G_TYPE_FILE_INPUT_STREAM")
+)
+
+(define-object FileIOStream
+ (in-module "gio")
+ (parent "GIOStream")
+ (c-name "GFileIOStream")
+ (gtype-id "G_TYPE_FILE_IO_STREAM")
+)
+
+(define-object FilterInputStream
+ (in-module "gio")
+ (parent "GInputStream")
+ (c-name "GFilterInputStream")
+ (gtype-id "G_TYPE_FILTER_INPUT_STREAM")
+)
+
+(define-object BufferedInputStream
+ (in-module "gio")
+ (parent "GFilterInputStream")
+ (c-name "GBufferedInputStream")
+ (gtype-id "G_TYPE_BUFFERED_INPUT_STREAM")
+)
+
+(define-object DataInputStream
+ (in-module "gio")
+ (parent "GFilterInputStream")
+ (c-name "GDataInputStream")
+ (gtype-id "G_TYPE_DATA_INPUT_STREAM")
+)
+
+(define-object MemoryInputStream
+ (in-module "gio")
+ (parent "GInputStream")
+ (c-name "GMemoryInputStream")
+ (gtype-id "G_TYPE_MEMORY_INPUT_STREAM")
+)
+
+(define-object MountOperation
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GMountOperation")
+ (gtype-id "G_TYPE_MOUNT_OPERATION")
+)
+
+(define-object InetAddress
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GInetAddress")
+ (gtype-id "G_TYPE_INET_ADDRESS")
+)
+
+(define-object InetSocketAddress
+ (in-module "gio")
+ (parent "GSocketAddress")
+ (c-name "GInetSocketAddress")
+ (gtype-id "G_TYPE_INET_SOCKET_ADDRESS")
+)
+
+(define-object NetworkAddress
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GNetworkAddress")
+ (gtype-id "G_TYPE_NETWORK_ADDRESS")
+)
+
+(define-object NetworkService
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GNetworkService")
+ (gtype-id "G_TYPE_NETWORK_SERVICE")
+)
+
+(define-object Resolver
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GResolver")
+ (gtype-id "G_TYPE_RESOLVER")
+)
+
+(define-object Socket
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSocket")
+ (gtype-id "G_TYPE_SOCKET")
+)
+
+(define-object SocketAddress
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSocketAddress")
+ (gtype-id "G_TYPE_SOCKET_ADDRESS")
+)
+
+(define-object SocketAddressEnumerator
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSocketAddressEnumerator")
+ (gtype-id "G_TYPE_SOCKET_ADDRESS_ENUMERATOR")
+)
+
+(define-object SocketClient
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSocketClient")
+ (gtype-id "G_TYPE_SOCKET_CLIENT")
+)
+
+(define-object SocketConnection
+ (in-module "gio")
+ (parent "GIOStream")
+ (c-name "GSocketConnection")
+ (gtype-id "G_TYPE_SOCKET_CONNECTION")
+)
+
+(define-object SocketControlMessage
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSocketControlMessage")
+ (gtype-id "G_TYPE_SOCKET_CONTROL_MESSAGE")
+)
+
+(define-object SocketListener
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSocketListener")
+ (gtype-id "G_TYPE_SOCKET_LISTENER")
+)
+
+(define-object SocketService
+ (in-module "gio")
+ (parent "GSocketListener")
+ (c-name "GSocketService")
+ (gtype-id "G_TYPE_SOCKET_SERVICE")
+)
+
+(define-object TcpConnection
+ (in-module "gio")
+ (parent "GSocketConnection")
+ (c-name "GTcpConnection")
+ (gtype-id "G_TYPE_TCP_CONNECTION")
+)
+
+(define-object ThreadedSocketService
+ (in-module "gio")
+ (parent "GSocketService")
+ (c-name "GThreadedSocketService")
+ (gtype-id "G_TYPE_THREADED_SOCKET_SERVICE")
+)
+
+(define-object IOStream
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GIOStream")
+ (gtype-id "G_TYPE_IO_STREAM")
+)
+
+(define-object OutputStream
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GOutputStream")
+ (gtype-id "G_TYPE_OUTPUT_STREAM")
+)
+
+(define-object MemoryOutputStream
+ (in-module "gio")
+ (parent "GOutputStream")
+ (c-name "GMemoryOutputStream")
+ (gtype-id "G_TYPE_MEMORY_OUTPUT_STREAM")
+)
+
+(define-object FilterOutputStream
+ (in-module "gio")
+ (parent "GOutputStream")
+ (c-name "GFilterOutputStream")
+ (gtype-id "G_TYPE_FILTER_OUTPUT_STREAM")
+)
+
+(define-object BufferedOutputStream
+ (in-module "gio")
+ (parent "GFilterOutputStream")
+ (c-name "GBufferedOutputStream")
+ (gtype-id "G_TYPE_BUFFERED_OUTPUT_STREAM")
+)
+
+(define-object DataOutputStream
+ (in-module "gio")
+ (parent "GFilterOutputStream")
+ (c-name "GDataOutputStream")
+ (gtype-id "G_TYPE_DATA_OUTPUT_STREAM")
+)
+
+(define-object FileOutputStream
+ (in-module "gio")
+ (parent "GOutputStream")
+ (c-name "GFileOutputStream")
+ (gtype-id "G_TYPE_FILE_OUTPUT_STREAM")
+)
+
+(define-object SimpleAsyncResult
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GSimpleAsyncResult")
+ (gtype-id "G_TYPE_SIMPLE_ASYNC_RESULT")
+)
+
+(define-object Vfs
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GVfs")
+ (gtype-id "G_TYPE_VFS")
+)
+
+(define-object VolumeMonitor
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GVolumeMonitor")
+ (gtype-id "G_TYPE_VOLUME_MONITOR")
+)
+
+(define-object NativeVolumeMonitor
+ (in-module "gio")
+ (parent "GVolumeMonitor")
+ (c-name "GNativeVolumeMonitor")
+ (gtype-id "G_TYPE_NATIVE_VOLUME_MONITOR")
+)
+
+(define-object FileIcon
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GFileIcon")
+ (gtype-id "G_TYPE_FILE_ICON")
+ (implements "GIcon")
+ (implements "GLoadableIcon")
+)
+
+(define-object ThemedIcon
+ (in-module "gio")
+ (parent "GObject")
+ (c-name "GThemedIcon")
+ (gtype-id "G_TYPE_THEMED_ICON")
+ (implements "GIcon")
+)
+
+
+
+;; Enumerations and flags ...
+
+(define-flags AppInfoCreateFlags
+ (in-module "gio")
+ (c-name "GAppInfoCreateFlags")
+ (gtype-id "G_TYPE_APP_INFO_CREATE_FLAGS")
+ (values
+ '("none" "G_APP_INFO_CREATE_NONE")
+ '("needs-terminal" "G_APP_INFO_CREATE_NEEDS_TERMINAL")
+ '("supports-uris" "G_APP_INFO_CREATE_SUPPORTS_URIS")
+ )
+)
+
+(define-flags ConverterFlags
+ (in-module "gio")
+ (c-name "GConverterFlags")
+ (gtype-id "G_TYPE_CONVERTER_FLAGS")
+ (values
+ '("no-flags" "G_CONVERTER_NO_FLAGS")
+ '("input-at-end" "G_CONVERTER_INPUT_AT_END")
+ '("flush" "G_CONVERTER_FLUSH")
+ )
+)
+
+(define-enum ConverterResult
+ (in-module "gio")
+ (c-name "GConverterResult")
+ (gtype-id "G_TYPE_CONVERTER_RESULT")
+ (values
+ '("error" "G_CONVERTER_ERROR")
+ '("converted" "G_CONVERTER_CONVERTED")
+ '("finished" "G_CONVERTER_FINISHED")
+ '("flushed" "G_CONVERTER_FLUSHED")
+ )
+)
+
+(define-enum DataStreamByteOrder
+ (in-module "gio")
+ (c-name "GDataStreamByteOrder")
+ (gtype-id "G_TYPE_DATA_STREAM_BYTE_ORDER")
+ (values
+ '("big-endian" "G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN")
+ '("little-endian" "G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN")
+ '("host-endian" "G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN")
+ )
+)
+
+(define-enum DataStreamNewlineType
+ (in-module "gio")
+ (c-name "GDataStreamNewlineType")
+ (gtype-id "G_TYPE_DATA_STREAM_NEWLINE_TYPE")
+ (values
+ '("lf" "G_DATA_STREAM_NEWLINE_TYPE_LF")
+ '("cr" "G_DATA_STREAM_NEWLINE_TYPE_CR")
+ '("cr-lf" "G_DATA_STREAM_NEWLINE_TYPE_CR_LF")
+ '("any" "G_DATA_STREAM_NEWLINE_TYPE_ANY")
+ )
+)
+
+(define-enum FileAttributeType
+ (in-module "gio")
+ (c-name "GFileAttributeType")
+ (gtype-id "G_TYPE_FILE_ATTRIBUTE_TYPE")
+ (values
+ '("invalid" "G_FILE_ATTRIBUTE_TYPE_INVALID")
+ '("string" "G_FILE_ATTRIBUTE_TYPE_STRING")
+ '("byte-string" "G_FILE_ATTRIBUTE_TYPE_BYTE_STRING")
+ '("boolean" "G_FILE_ATTRIBUTE_TYPE_BOOLEAN")
+ '("uint32" "G_FILE_ATTRIBUTE_TYPE_UINT32")
+ '("int32" "G_FILE_ATTRIBUTE_TYPE_INT32")
+ '("uint64" "G_FILE_ATTRIBUTE_TYPE_UINT64")
+ '("int64" "G_FILE_ATTRIBUTE_TYPE_INT64")
+ '("object" "G_FILE_ATTRIBUTE_TYPE_OBJECT")
+ '("stringv" "G_FILE_ATTRIBUTE_TYPE_STRINGV")
+ )
+)
+
+(define-flags FileAttributeInfoFlags
+ (in-module "gio")
+ (c-name "GFileAttributeInfoFlags")
+ (gtype-id "G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS")
+ (values
+ '("none" "G_FILE_ATTRIBUTE_INFO_NONE")
+ '("copy-with-file" "G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE")
+ '("copy-when-moved" "G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED")
+ )
+)
+
+(define-enum FileAttributeStatus
+ (in-module "gio")
+ (c-name "GFileAttributeStatus")
+ (gtype-id "G_TYPE_FILE_ATTRIBUTE_STATUS")
+ (values
+ '("unset" "G_FILE_ATTRIBUTE_STATUS_UNSET")
+ '("set" "G_FILE_ATTRIBUTE_STATUS_SET")
+ '("error-setting" "G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING")
+ )
+)
+
+(define-flags FileQueryInfoFlags
+ (in-module "gio")
+ (c-name "GFileQueryInfoFlags")
+ (gtype-id "G_TYPE_FILE_QUERY_INFO_FLAGS")
+ (values
+ '("none" "G_FILE_QUERY_INFO_NONE")
+ '("nofollow-symlinks" "G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS")
+ )
+)
+
+(define-flags FileCreateFlags
+ (in-module "gio")
+ (c-name "GFileCreateFlags")
+ (gtype-id "G_TYPE_FILE_CREATE_FLAGS")
+ (values
+ '("none" "G_FILE_CREATE_NONE")
+ '("private" "G_FILE_CREATE_PRIVATE")
+ '("replace-destination" "G_FILE_CREATE_REPLACE_DESTINATION")
+ )
+)
+
+(define-enum MountMountFlags
+ (in-module "gio")
+ (c-name "GMountMountFlags")
+ (gtype-id "G_TYPE_MOUNT_MOUNT_FLAGS")
+ (values
+ '("none" "G_MOUNT_MOUNT_NONE")
+ )
+)
+
+(define-flags MountUnmountFlags
+ (in-module "gio")
+ (c-name "GMountUnmountFlags")
+ (gtype-id "G_TYPE_MOUNT_UNMOUNT_FLAGS")
+ (values
+ '("none" "G_MOUNT_UNMOUNT_NONE")
+ '("force" "G_MOUNT_UNMOUNT_FORCE")
+ )
+)
+
+(define-enum DriveStartFlags
+ (in-module "gio")
+ (c-name "GDriveStartFlags")
+ (gtype-id "G_TYPE_DRIVE_START_FLAGS")
+ (values
+ '("none" "G_DRIVE_START_NONE")
+ )
+)
+
+(define-enum DriveStartStopType
+ (in-module "gio")
+ (c-name "GDriveStartStopType")
+ (gtype-id "G_TYPE_DRIVE_START_STOP_TYPE")
+ (values
+ '("unknown" "G_DRIVE_START_STOP_TYPE_UNKNOWN")
+ '("shutdown" "G_DRIVE_START_STOP_TYPE_SHUTDOWN")
+ '("network" "G_DRIVE_START_STOP_TYPE_NETWORK")
+ '("multidisk" "G_DRIVE_START_STOP_TYPE_MULTIDISK")
+ '("password" "G_DRIVE_START_STOP_TYPE_PASSWORD")
+ )
+)
+
+(define-flags FileCopyFlags
+ (in-module "gio")
+ (c-name "GFileCopyFlags")
+ (gtype-id "G_TYPE_FILE_COPY_FLAGS")
+ (values
+ '("none" "G_FILE_COPY_NONE")
+ '("overwrite" "G_FILE_COPY_OVERWRITE")
+ '("backup" "G_FILE_COPY_BACKUP")
+ '("nofollow-symlinks" "G_FILE_COPY_NOFOLLOW_SYMLINKS")
+ '("all-metadata" "G_FILE_COPY_ALL_METADATA")
+ '("no-fallback-for-move" "G_FILE_COPY_NO_FALLBACK_FOR_MOVE")
+ '("target-default-perms" "G_FILE_COPY_TARGET_DEFAULT_PERMS")
+ )
+)
+
+(define-flags FileMonitorFlags
+ (in-module "gio")
+ (c-name "GFileMonitorFlags")
+ (gtype-id "G_TYPE_FILE_MONITOR_FLAGS")
+ (values
+ '("none" "G_FILE_MONITOR_NONE")
+ '("watch-mounts" "G_FILE_MONITOR_WATCH_MOUNTS")
+ )
+)
+
+(define-enum FileType
+ (in-module "gio")
+ (c-name "GFileType")
+ (gtype-id "G_TYPE_FILE_TYPE")
+ (values
+ '("unknown" "G_FILE_TYPE_UNKNOWN")
+ '("regular" "G_FILE_TYPE_REGULAR")
+ '("directory" "G_FILE_TYPE_DIRECTORY")
+ '("symbolic-link" "G_FILE_TYPE_SYMBOLIC_LINK")
+ '("special" "G_FILE_TYPE_SPECIAL")
+ '("shortcut" "G_FILE_TYPE_SHORTCUT")
+ '("mountable" "G_FILE_TYPE_MOUNTABLE")
+ )
+)
+
+(define-enum FilesystemPreviewType
+ (in-module "gio")
+ (c-name "GFilesystemPreviewType")
+ (gtype-id "G_TYPE_FILESYSTEM_PREVIEW_TYPE")
+ (values
+ '("if-always" "G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS")
+ '("if-local" "G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL")
+ '("never" "G_FILESYSTEM_PREVIEW_TYPE_NEVER")
+ )
+)
+
+(define-enum FileMonitorEvent
+ (in-module "gio")
+ (c-name "GFileMonitorEvent")
+ (gtype-id "G_TYPE_FILE_MONITOR_EVENT")
+ (values
+ '("changed" "G_FILE_MONITOR_EVENT_CHANGED")
+ '("changes-done-hint" "G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT")
+ '("deleted" "G_FILE_MONITOR_EVENT_DELETED")
+ '("created" "G_FILE_MONITOR_EVENT_CREATED")
+ '("attribute-changed" "G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED")
+ '("pre-unmount" "G_FILE_MONITOR_EVENT_PRE_UNMOUNT")
+ '("unmounted" "G_FILE_MONITOR_EVENT_UNMOUNTED")
+ )
+)
+
+(define-enum ErrorEnum
+ (in-module "gio")
+ (c-name "GIOErrorEnum")
+ (gtype-id "G_TYPE_IO_ERROR_ENUM")
+ (values
+ '("failed" "G_IO_ERROR_FAILED")
+ '("not-found" "G_IO_ERROR_NOT_FOUND")
+ '("exists" "G_IO_ERROR_EXISTS")
+ '("is-directory" "G_IO_ERROR_IS_DIRECTORY")
+ '("not-directory" "G_IO_ERROR_NOT_DIRECTORY")
+ '("not-empty" "G_IO_ERROR_NOT_EMPTY")
+ '("not-regular-file" "G_IO_ERROR_NOT_REGULAR_FILE")
+ '("not-symbolic-link" "G_IO_ERROR_NOT_SYMBOLIC_LINK")
+ '("not-mountable-file" "G_IO_ERROR_NOT_MOUNTABLE_FILE")
+ '("filename-too-long" "G_IO_ERROR_FILENAME_TOO_LONG")
+ '("invalid-filename" "G_IO_ERROR_INVALID_FILENAME")
+ '("too-many-links" "G_IO_ERROR_TOO_MANY_LINKS")
+ '("no-space" "G_IO_ERROR_NO_SPACE")
+ '("invalid-argument" "G_IO_ERROR_INVALID_ARGUMENT")
+ '("permission-denied" "G_IO_ERROR_PERMISSION_DENIED")
+ '("not-supported" "G_IO_ERROR_NOT_SUPPORTED")
+ '("not-mounted" "G_IO_ERROR_NOT_MOUNTED")
+ '("already-mounted" "G_IO_ERROR_ALREADY_MOUNTED")
+ '("closed" "G_IO_ERROR_CLOSED")
+ '("cancelled" "G_IO_ERROR_CANCELLED")
+ '("pending" "G_IO_ERROR_PENDING")
+ '("read-only" "G_IO_ERROR_READ_ONLY")
+ '("cant-create-backup" "G_IO_ERROR_CANT_CREATE_BACKUP")
+ '("wrong-etag" "G_IO_ERROR_WRONG_ETAG")
+ '("timed-out" "G_IO_ERROR_TIMED_OUT")
+ '("would-recurse" "G_IO_ERROR_WOULD_RECURSE")
+ '("busy" "G_IO_ERROR_BUSY")
+ '("would-block" "G_IO_ERROR_WOULD_BLOCK")
+ '("host-not-found" "G_IO_ERROR_HOST_NOT_FOUND")
+ '("would-merge" "G_IO_ERROR_WOULD_MERGE")
+ '("failed-handled" "G_IO_ERROR_FAILED_HANDLED")
+ '("too-many-open-files" "G_IO_ERROR_TOO_MANY_OPEN_FILES")
+ '("not-initialized" "G_IO_ERROR_NOT_INITIALIZED")
+ '("address-in-use" "G_IO_ERROR_ADDRESS_IN_USE")
+ '("partial-input" "G_IO_ERROR_PARTIAL_INPUT")
+ '("invalid-data" "G_IO_ERROR_INVALID_DATA")
+ )
+)
+
+(define-flags AskPasswordFlags
+ (in-module "gio")
+ (c-name "GAskPasswordFlags")
+ (gtype-id "G_TYPE_ASK_PASSWORD_FLAGS")
+ (values
+ '("need-password" "G_ASK_PASSWORD_NEED_PASSWORD")
+ '("need-username" "G_ASK_PASSWORD_NEED_USERNAME")
+ '("need-domain" "G_ASK_PASSWORD_NEED_DOMAIN")
+ '("saving-supported" "G_ASK_PASSWORD_SAVING_SUPPORTED")
+ '("anonymous-supported" "G_ASK_PASSWORD_ANONYMOUS_SUPPORTED")
+ )
+)
+
+(define-enum PasswordSave
+ (in-module "gio")
+ (c-name "GPasswordSave")
+ (gtype-id "G_TYPE_PASSWORD_SAVE")
+ (values
+ '("never" "G_PASSWORD_SAVE_NEVER")
+ '("for-session" "G_PASSWORD_SAVE_FOR_SESSION")
+ '("permanently" "G_PASSWORD_SAVE_PERMANENTLY")
+ )
+)
+
+(define-enum MountOperationResult
+ (in-module "gio")
+ (c-name "GMountOperationResult")
+ (gtype-id "G_TYPE_MOUNT_OPERATION_RESULT")
+ (values
+ '("handled" "G_MOUNT_OPERATION_HANDLED")
+ '("aborted" "G_MOUNT_OPERATION_ABORTED")
+ '("unhandled" "G_MOUNT_OPERATION_UNHANDLED")
+ )
+)
+
+(define-flags OutputStreamSpliceFlags
+ (in-module "gio")
+ (c-name "GOutputStreamSpliceFlags")
+ (gtype-id "G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS")
+ (values
+ '("none" "G_OUTPUT_STREAM_SPLICE_NONE")
+ '("close-source" "G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE")
+ '("close-target" "G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET")
+ )
+)
+
+(define-enum EmblemOrigin
+ (in-module "gio")
+ (c-name "GEmblemOrigin")
+ (gtype-id "G_TYPE_EMBLEM_ORIGIN")
+ (values
+ '("unknown" "G_EMBLEM_ORIGIN_UNKNOWN")
+ '("device" "G_EMBLEM_ORIGIN_DEVICE")
+ '("livemetadata" "G_EMBLEM_ORIGIN_LIVEMETADATA")
+ '("tag" "G_EMBLEM_ORIGIN_TAG")
+ )
+)
+
+(define-enum ResolverError
+ (in-module "gio")
+ (c-name "GResolverError")
+ (gtype-id "G_TYPE_RESOLVER_ERROR")
+ (values
+ '("not-found" "G_RESOLVER_ERROR_NOT_FOUND")
+ '("temporary-failure" "G_RESOLVER_ERROR_TEMPORARY_FAILURE")
+ '("internal" "G_RESOLVER_ERROR_INTERNAL")
+ )
+)
+
+(define-enum SocketFamily
+ (in-module "gio")
+ (c-name "GSocketFamily")
+ (gtype-id "G_TYPE_SOCKET_FAMILY")
+ (values
+ '("invalid" "G_SOCKET_FAMILY_INVALID")
+ '("unix" "G_SOCKET_FAMILY_UNIX")
+ '("ipv4" "G_SOCKET_FAMILY_IPV4")
+ '("ipv6" "G_SOCKET_FAMILY_IPV6")
+ )
+)
+
+(define-enum SocketType
+ (in-module "gio")
+ (c-name "GSocketType")
+ (gtype-id "G_TYPE_SOCKET_TYPE")
+ (values
+ '("invalid" "G_SOCKET_TYPE_INVALID")
+ '("stream" "G_SOCKET_TYPE_STREAM")
+ '("datagram" "G_SOCKET_TYPE_DATAGRAM")
+ '("seqpacket" "G_SOCKET_TYPE_SEQPACKET")
+ )
+)
+
+(define-enum SocketMsgFlags
+ (in-module "gio")
+ (c-name "GSocketMsgFlags")
+ (gtype-id "G_TYPE_SOCKET_MSG_FLAGS")
+ (values
+ '("none" "G_SOCKET_MSG_NONE")
+ '("oob" "G_SOCKET_MSG_OOB")
+ '("peek" "G_SOCKET_MSG_PEEK")
+ '("dontroute" "G_SOCKET_MSG_DONTROUTE")
+ )
+)
+
+(define-enum SocketProtocol
+ (in-module "gio")
+ (c-name "GSocketProtocol")
+ (gtype-id "G_TYPE_SOCKET_PROTOCOL")
+ (values
+ '("unknown" "G_SOCKET_PROTOCOL_UNKNOWN")
+ '("default" "G_SOCKET_PROTOCOL_DEFAULT")
+ '("tcp" "G_SOCKET_PROTOCOL_TCP")
+ '("udp" "G_SOCKET_PROTOCOL_UDP")
+ '("sctp" "G_SOCKET_PROTOCOL_SCTP")
+ )
+)
+
+(define-enum ZlibCompressorFormat
+ (in-module "gio")
+ (c-name "GZlibCompressorFormat")
+ (gtype-id "G_TYPE_ZLIB_COMPRESSOR_FORMAT")
+ (values
+ '("zlib" "G_ZLIB_COMPRESSOR_FORMAT_ZLIB")
+ '("gzip" "G_ZLIB_COMPRESSOR_FORMAT_GZIP")
+ '("raw" "G_ZLIB_COMPRESSOR_FORMAT_RAW")
+ )
+)
diff --git a/gio/gio.defs b/gio/gio.defs
new file mode 100644
index 0000000..f5a28b6
--- /dev/null
+++ b/gio/gio.defs
@@ -0,0 +1,7465 @@
+;; -*- scheme -*-
+
+(include "gio-types.defs")
+
+;; From gappinfo.h
+
+(define-function app_info_get_type
+ (c-name "g_app_info_get_type")
+ (return-type "GType")
+)
+
+(define-function app_launch_context_get_type
+ (c-name "g_app_launch_context_get_type")
+ (return-type "GType")
+)
+
+(define-function app_info_create_from_commandline
+ (c-name "g_app_info_create_from_commandline")
+ (is-constructor-of "GAppInfo")
+ (return-type "GAppInfo*")
+ (parameters
+ '("const-char*" "commandline")
+ '("const-char*" "application_name" (null-ok) (default "NULL"))
+ '("GAppInfoCreateFlags" "flags" (default "G_APP_INFO_CREATE_NONE"))
+ '("GError**" "error")
+ )
+)
+
+(define-method dup
+ (of-object "GAppInfo")
+ (c-name "g_app_info_dup")
+ (return-type "GAppInfo*")
+ (caller-owns-return #t)
+)
+
+(define-method equal
+ (of-object "GAppInfo")
+ (c-name "g_app_info_equal")
+ (return-type "gboolean")
+ (parameters
+ '("GAppInfo*" "appinfo2")
+ )
+)
+
+(define-method get_id
+ (of-object "GAppInfo")
+ (c-name "g_app_info_get_id")
+ (return-type "const-char*")
+)
+
+(define-method get_name
+ (of-object "GAppInfo")
+ (c-name "g_app_info_get_name")
+ (return-type "const-char*")
+)
+
+(define-method get_description
+ (of-object "GAppInfo")
+ (c-name "g_app_info_get_description")
+ (return-type "const-char*")
+)
+
+(define-method get_executable
+ (of-object "GAppInfo")
+ (c-name "g_app_info_get_executable")
+ (return-type "const-char*")
+)
+
+(define-method get_icon
+ (of-object "GAppInfo")
+ (c-name "g_app_info_get_icon")
+ (return-type "GIcon*")
+)
+
+;;
+;; wrapped in gappinfo.override
+;;
+(define-method launch
+ (docstring
+ "launch (files=None, launch_context=None) -> gboolean\n"
+ "\n"
+ "Launches the application. Passes files to the launched application\n"
+ "as arguments, using the optional launch_context to get information\n"
+ "about the details of the launcher (like what screen it is on).\n"
+ "On error, error will be set accordingly.\n\n"
+ "Note that even if the launch is successful the application launched\n"
+ "can fail to start if it runs into problems during startup.\n"
+ "There is no way to detect this.\n\n"
+ "Some URIs can be changed when passed through a gio.File\n"
+ "(for instance unsupported uris with strange formats like mailto:),\n"
+ "so if you have a textual uri you want to pass in as argument,\n"
+ "consider using gio.AppInfo.launch_uris() instead."
+ )
+ (of-object "GAppInfo")
+ (c-name "g_app_info_launch")
+ (return-type "gboolean")
+ (parameters
+ '("GList*" "files")
+ '("GAppLaunchContext*" "launch_context")
+ '("GError**" "error")
+ )
+)
+
+(define-method supports_uris
+ (of-object "GAppInfo")
+ (c-name "g_app_info_supports_uris")
+ (return-type "gboolean")
+)
+
+(define-method supports_files
+ (of-object "GAppInfo")
+ (c-name "g_app_info_supports_files")
+ (return-type "gboolean")
+)
+
+;;
+;; wrapped in gappinfo.override
+;;
+(define-method launch_uris
+ (docstring
+ "launch_uris (files=None, launch_context=None) -> gboolean\n"
+ "\n"
+ "Launches the application. Passes files to the launched application\n"
+ "as arguments, using the optional launch_context to get information\n"
+ "about the details of the launcher (like what screen it is on).\n"
+ "On error, error will be set accordingly.\n\n"
+ "Note that even if the launch is successful the application launched\n"
+ "can fail to start if it runs into problems during startup.\n"
+ "There is no way to detect this.\n\n"
+ )
+ (of-object "GAppInfo")
+ (c-name "g_app_info_launch_uris")
+ (return-type "gboolean")
+ (parameters
+ '("GList*" "uris")
+ '("GAppLaunchContext*" "launch_context")
+ '("GError**" "error")
+ )
+)
+
+(define-method should_show
+ (of-object "GAppInfo")
+ (c-name "g_app_info_should_show")
+ (return-type "gboolean")
+)
+
+(define-method set_as_default_for_type
+ (of-object "GAppInfo")
+ (c-name "g_app_info_set_as_default_for_type")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+(define-method set_as_default_for_extension
+ (of-object "GAppInfo")
+ (c-name "g_app_info_set_as_default_for_extension")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "extension")
+ '("GError**" "error")
+ )
+)
+
+(define-method add_supports_type
+ (of-object "GAppInfo")
+ (c-name "g_app_info_add_supports_type")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+(define-method can_remove_supports_type
+ (of-object "GAppInfo")
+ (c-name "g_app_info_can_remove_supports_type")
+ (return-type "gboolean")
+)
+
+(define-method remove_supports_type
+ (of-object "GAppInfo")
+ (c-name "g_app_info_remove_supports_type")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-function app_info_get_all
+ (c-name "g_app_info_get_all")
+ (return-type "GList*")
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-function app_info_get_all_for_type
+ (c-name "g_app_info_get_all_for_type")
+ (return-type "GList*")
+ (parameters
+ '("const-char*" "content_type")
+ )
+)
+
+(define-function app_info_get_default_for_type
+ (c-name "g_app_info_get_default_for_type")
+ (return-type "GAppInfo*")
+ (parameters
+ '("const-char*" "content_type")
+ '("gboolean" "must_support_uris")
+ )
+)
+
+(define-function app_info_get_default_for_uri_scheme
+ (c-name "g_app_info_get_default_for_uri_scheme")
+ (return-type "GAppInfo*")
+ (parameters
+ '("const-char*" "uri_scheme")
+ )
+)
+
+(define-function app_launch_context_new
+ (c-name "g_app_launch_context_new")
+ (is-constructor-of "GAppLaunchContext")
+ (return-type "GAppLaunchContext*")
+)
+
+;;
+;; wrapped in gapplaunchcontext.override
+;;
+(define-method get_display
+ (of-object "GAppLaunchContext")
+ (c-name "g_app_launch_context_get_display")
+ (return-type "char*")
+ (parameters
+ '("GAppInfo*" "info")
+ '("GList*" "files")
+ )
+)
+
+;;
+;; wrapped in gapplaunchcontext.override
+;;
+(define-method get_startup_notify_id
+ (of-object "GAppLaunchContext")
+ (c-name "g_app_launch_context_get_startup_notify_id")
+ (return-type "char*")
+ (parameters
+ '("GAppInfo*" "info")
+ '("GList*" "files")
+ )
+)
+
+(define-method launch_failed
+ (of-object "GAppLaunchContext")
+ (c-name "g_app_launch_context_launch_failed")
+ (return-type "none")
+ (parameters
+ '("const-char*" "startup_notify_id")
+ )
+)
+
+(define-function app_info_reset_type_associations
+ (c-name "g_app_info_reset_type_associations")
+ (return-type "none")
+ (parameters
+ '("const-char*" "content_type")
+ )
+)
+
+(define-method can_delete
+ (of-object "GAppInfo")
+ (c-name "g_app_info_can_delete")
+ (return-type "gboolean")
+)
+
+(define-method delete
+ (of-object "GAppInfo")
+ (c-name "g_app_info_delete")
+ (return-type "gboolean")
+)
+
+(define-method get_commandline
+ (of-object "GAppInfo")
+ (c-name "g_app_info_get_commandline")
+ (return-type "const-char*")
+)
+
+
+
+;; From gasyncinitable.h
+
+(define-function async_initable_get_type
+ (c-name "g_async_initable_get_type")
+ (return-type "GType")
+)
+
+(define-method init_async
+ (of-object "GAsyncInitable")
+ (c-name "g_async_initable_init_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method init_finish
+ (of-object "GAsyncInitable")
+ (c-name "g_async_initable_init_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-function async_initable_new_async
+ (c-name "g_async_initable_new_async")
+ (return-type "none")
+ (parameters
+ '("GType" "object_type")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ '("const-gchar*" "first_property_name")
+ )
+ (varargs #t)
+)
+
+(define-function async_initable_newv_async
+ (c-name "g_async_initable_newv_async")
+ (return-type "none")
+ (parameters
+ '("GType" "object_type")
+ '("guint" "n_parameters")
+ '("GParameter*" "parameters")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-function async_initable_new_valist_async
+ (c-name "g_async_initable_new_valist_async")
+ (return-type "none")
+ (parameters
+ '("GType" "object_type")
+ '("const-gchar*" "first_property_name")
+ '("va_list" "var_args")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method new_finish
+ (of-object "GAsyncInitable")
+ (c-name "g_async_initable_new_finish")
+ (return-type "GObject*")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gasyncresult.h
+
+(define-function async_result_get_type
+ (c-name "g_async_result_get_type")
+ (return-type "GType")
+)
+
+(define-method get_user_data
+ (of-object "GAsyncResult")
+ (c-name "g_async_result_get_user_data")
+ (return-type "gpointer")
+)
+
+(define-method get_source_object
+ (of-object "GAsyncResult")
+ (c-name "g_async_result_get_source_object")
+ (return-type "GObject*")
+)
+
+
+
+;; From gbufferedinputstream.h
+
+(define-function buffered_input_stream_get_type
+ (c-name "g_buffered_input_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function buffered_input_stream_new
+ (c-name "g_buffered_input_stream_new")
+ (is-constructor-of "GBufferedInputStream")
+ (return-type "GInputStream*")
+ (properties
+ '("base_stream")
+ )
+)
+
+(define-function buffered_input_stream_new_sized
+ (c-name "g_buffered_input_stream_new_sized")
+ (return-type "GInputStream*")
+ (parameters
+ '("GInputStream*" "base_stream")
+ '("gsize" "size")
+ )
+)
+
+(define-method get_buffer_size
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_get_buffer_size")
+ (return-type "gsize")
+)
+
+(define-method set_buffer_size
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_set_buffer_size")
+ (return-type "none")
+ (parameters
+ '("gsize" "size")
+ )
+)
+
+(define-method get_available
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_get_available")
+ (return-type "gsize")
+)
+
+(define-method peek
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_peek")
+ (return-type "gsize")
+ (parameters
+ '("void*" "buffer")
+ '("gsize" "offset")
+ '("gsize" "count")
+ )
+)
+
+(define-method peek_buffer
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_peek_buffer")
+ (return-type "const-void*")
+ (parameters
+ '("gsize*" "count")
+ )
+)
+
+(define-method fill
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_fill")
+ (return-type "gssize")
+ (unblock-threads #t)
+ (parameters
+ '("gssize" "count")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method fill_async
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_fill_async")
+ (return-type "none")
+ (parameters
+ '("gssize" "count")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method fill_finish
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_fill_finish")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method read_byte
+ (of-object "GBufferedInputStream")
+ (c-name "g_buffered_input_stream_read_byte")
+ (return-type "int")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gbufferedoutputstream.h
+
+(define-function buffered_output_stream_get_type
+ (c-name "g_buffered_output_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function buffered_output_stream_new
+ (c-name "g_buffered_output_stream_new")
+ (is-constructor-of "GBufferedOutputStream")
+ (return-type "GOutputStream*")
+ (properties
+ '("base_stream")
+ )
+)
+
+(define-function buffered_output_stream_new_sized
+ (c-name "g_buffered_output_stream_new_sized")
+ (return-type "GOutputStream*")
+ (parameters
+ '("GOutputStream*" "base_stream")
+ '("guint" "size")
+ )
+)
+
+(define-method get_buffer_size
+ (of-object "GBufferedOutputStream")
+ (c-name "g_buffered_output_stream_get_buffer_size")
+ (return-type "gsize")
+)
+
+(define-method set_buffer_size
+ (of-object "GBufferedOutputStream")
+ (c-name "g_buffered_output_stream_set_buffer_size")
+ (return-type "none")
+ (parameters
+ '("gsize" "size")
+ )
+)
+
+(define-method get_auto_grow
+ (of-object "GBufferedOutputStream")
+ (c-name "g_buffered_output_stream_get_auto_grow")
+ (return-type "gboolean")
+)
+
+(define-method set_auto_grow
+ (of-object "GBufferedOutputStream")
+ (c-name "g_buffered_output_stream_set_auto_grow")
+ (return-type "none")
+ (parameters
+ '("gboolean" "auto_grow")
+ )
+)
+
+
+
+;; From gcancellable.h
+
+(define-function cancellable_get_type
+ (c-name "g_cancellable_get_type")
+ (return-type "GType")
+)
+
+(define-function cancellable_new
+ (c-name "g_cancellable_new")
+ (is-constructor-of "GCancellable")
+ (return-type "GCancellable*")
+)
+
+(define-method is_cancelled
+ (of-object "GCancellable")
+ (c-name "g_cancellable_is_cancelled")
+ (return-type "gboolean")
+)
+
+(define-method set_error_if_cancelled
+ (of-object "GCancellable")
+ (c-name "g_cancellable_set_error_if_cancelled")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method get_fd
+ (of-object "GCancellable")
+ (c-name "g_cancellable_get_fd")
+ (return-type "int")
+)
+
+(define-method make_pollfd
+ (of-object "GCancellable")
+ (c-name "g_cancellable_make_pollfd")
+ (return-type "none")
+ (parameters
+ '("GPollFD*" "pollfd")
+ )
+)
+
+(define-function cancellable_get_current
+ (c-name "g_cancellable_get_current")
+ (return-type "GCancellable*")
+)
+
+(define-method push_current
+ (of-object "GCancellable")
+ (c-name "g_cancellable_push_current")
+ (return-type "none")
+)
+
+(define-method pop_current
+ (of-object "GCancellable")
+ (c-name "g_cancellable_pop_current")
+ (return-type "none")
+)
+
+(define-method reset
+ (of-object "GCancellable")
+ (c-name "g_cancellable_reset")
+ (return-type "none")
+)
+
+(define-method cancel
+ (of-object "GCancellable")
+ (c-name "g_cancellable_cancel")
+ (return-type "none")
+)
+
+(define-method connect
+ (of-object "GCancellable")
+ (c-name "g_cancellable_connect")
+ (return-type "gulong")
+ (parameters
+ '("GCallback" "callback")
+ '("gpointer" "data")
+ '("GDestroyNotify" "data_destroy_func")
+ )
+)
+
+(define-method disconnect
+ (of-object "GCancellable")
+ (c-name "g_cancellable_disconnect")
+ (return-type "none")
+ (parameters
+ '("gulong" "handler_id")
+ )
+)
+
+(define-method release_fd
+ (of-object "GCancellable")
+ (c-name "g_cancellable_release_fd")
+ (return-type "none")
+)
+
+
+
+;; From gcontenttype.h
+
+(define-function content_type_equals
+ (c-name "g_content_type_equals")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "type1")
+ '("const-char*" "type2")
+ )
+)
+
+(define-function content_type_is_a
+ (c-name "g_content_type_is_a")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "type")
+ '("const-char*" "supertype")
+ )
+)
+
+(define-function content_type_is_unknown
+ (c-name "g_content_type_is_unknown")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "type")
+ )
+)
+
+(define-function content_type_get_description
+ (c-name "g_content_type_get_description")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "type")
+ )
+)
+
+(define-function content_type_get_mime_type
+ (c-name "g_content_type_get_mime_type")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "type")
+ )
+)
+
+(define-function content_type_get_icon
+ (c-name "g_content_type_get_icon")
+ (return-type "GIcon*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "type")
+ )
+)
+
+(define-function content_type_can_be_executable
+ (c-name "g_content_type_can_be_executable")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "type")
+ )
+)
+
+(define-function content_type_from_mime_type
+ (c-name "g_content_type_from_mime_type")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "mime_type")
+ )
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-function content_type_guess
+ (docstring
+"content_type_guess([filename, data, want_uncertain]) -> mime type\n"
+"\n"
+"Guesses the content type based on the parameters passed.\n"
+"Either filename or data must be specified\n"
+"Returns a string containing the mime type.\n"
+"If want_uncertain is set to True, return a tuple with the mime type and \n"
+"True/False if the type guess was uncertain or not.")
+ (c-name "g_content_type_guess")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "filename")
+ '("const-guchar*" "data")
+ '("gsize" "data_size")
+ '("gboolean*" "result_uncertain")
+ )
+)
+
+(define-function content_type_guess_for_tree
+ (c-name "g_content_type_guess_for_tree")
+ (return-type "char**")
+ (parameters
+ '("GFile*" "root")
+ )
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-function content_types_get_registered
+ (c-name "g_content_types_get_registered")
+ (return-type "GList*")
+)
+
+
+
+;; From gdatainputstream.h
+
+(define-function data_input_stream_get_type
+ (c-name "g_data_input_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function data_input_stream_new
+ (c-name "g_data_input_stream_new")
+ (is-constructor-of "GDataInputStream")
+ (return-type "GDataInputStream*")
+ (properties
+ '("base_stream")
+ )
+)
+
+(define-method set_byte_order
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_set_byte_order")
+ (return-type "none")
+ (parameters
+ '("GDataStreamByteOrder" "order")
+ )
+)
+
+(define-method get_byte_order
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_get_byte_order")
+ (return-type "GDataStreamByteOrder")
+)
+
+(define-method set_newline_type
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_set_newline_type")
+ (return-type "none")
+ (parameters
+ '("GDataStreamNewlineType" "type")
+ )
+)
+
+(define-method get_newline_type
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_get_newline_type")
+ (return-type "GDataStreamNewlineType")
+)
+
+(define-method read_byte
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_byte")
+ (return-type "guchar")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_int16
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_int16")
+ (return-type "gint16")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_uint16
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_uint16")
+ (return-type "guint16")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_int32
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_int32")
+ (return-type "gint32")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_uint32
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_uint32")
+ (return-type "guint32")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_int64
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_int64")
+ (return-type "gint64")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_uint64
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_uint64")
+ (return-type "guint64")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gdatainputstream.override
+;;
+(define-method read_line
+ (of-object "GDataInputStream")
+ (docstring
+ "S.read_line([cancellable]) -> str\n"
+ "Read a line from the stream. Return value includes ending newline\n"
+ "character.")
+ (c-name "g_data_input_stream_read_line")
+ (return-type "char*")
+ (parameters
+ '("gsize*" "length")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gdatainputstream.override
+;;
+(define-method read_until
+ (of-object "GDataInputStream")
+ (docstring
+ "S.read_until(stop_chars, [cancellable]) -> str\n"
+ "Read characters from the string, stopping at the end or upon reading\n"
+ "any character in stop_chars. Return value does not include the stopping\n"
+ "character.")
+ (c-name "g_data_input_stream_read_until")
+ (return-type "char*")
+ (parameters
+ '("const-gchar*" "stop_chars")
+ '("gsize*" "length")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method read_until_async
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_until_async")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "stop_chars")
+ '("gint" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method read_until_finish
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_until_finish")
+ (return-type "char*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("gsize*" "length")
+ '("GError**" "error")
+ )
+)
+
+(define-method read_line_async
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_line_async")
+ (return-type "none")
+ (parameters
+ '("gint" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method read_line_finish
+ (of-object "GDataInputStream")
+ (c-name "g_data_input_stream_read_line_finish")
+ (return-type "char*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("gsize*" "length")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gdataoutputstream.h
+
+(define-function data_output_stream_get_type
+ (c-name "g_data_output_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function data_output_stream_new
+ (c-name "g_data_output_stream_new")
+ (is-constructor-of "GDataOutputStream")
+ (return-type "GDataOutputStream*")
+ (properties
+ '("base_stream")
+ )
+)
+
+(define-method set_byte_order
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_set_byte_order")
+ (return-type "none")
+ (parameters
+ '("GDataStreamByteOrder" "order")
+ )
+)
+
+(define-method get_byte_order
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_get_byte_order")
+ (return-type "GDataStreamByteOrder")
+)
+
+(define-method put_byte
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_byte")
+ (return-type "gboolean")
+ (parameters
+ '("guchar" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_int16
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_int16")
+ (return-type "gboolean")
+ (parameters
+ '("gint16" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_uint16
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_uint16")
+ (return-type "gboolean")
+ (parameters
+ '("guint16" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_int32
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_int32")
+ (return-type "gboolean")
+ (parameters
+ '("gint32" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_uint32
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_uint32")
+ (return-type "gboolean")
+ (parameters
+ '("guint32" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_int64
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_int64")
+ (return-type "gboolean")
+ (parameters
+ '("gint64" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_uint64
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_uint64")
+ (return-type "gboolean")
+ (parameters
+ '("guint64" "data")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method put_string
+ (of-object "GDataOutputStream")
+ (c-name "g_data_output_stream_put_string")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "str")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+
+
+
+
+
+;; From gdrive.h
+
+(define-function drive_get_type
+ (c-name "g_drive_get_type")
+ (return-type "GType")
+)
+
+(define-method get_name
+ (of-object "GDrive")
+ (c-name "g_drive_get_name")
+ (return-type "char*")
+)
+
+(define-method get_icon
+ (of-object "GDrive")
+ (c-name "g_drive_get_icon")
+ (return-type "GIcon*")
+ (caller-owns-return #t)
+)
+
+(define-method has_volumes
+ (of-object "GDrive")
+ (c-name "g_drive_has_volumes")
+ (return-type "gboolean")
+)
+
+;;
+;; wrapped in gdrive.override
+;;
+(define-method get_volumes
+ (of-object "GDrive")
+ (c-name "g_drive_get_volumes")
+ (return-type "GList*")
+)
+
+(define-method is_media_removable
+ (of-object "GDrive")
+ (c-name "g_drive_is_media_removable")
+ (return-type "gboolean")
+)
+
+(define-method has_media
+ (of-object "GDrive")
+ (c-name "g_drive_has_media")
+ (return-type "gboolean")
+)
+
+(define-method is_media_check_automatic
+ (of-object "GDrive")
+ (c-name "g_drive_is_media_check_automatic")
+ (return-type "gboolean")
+)
+
+(define-method can_poll_for_media
+ (of-object "GDrive")
+ (c-name "g_drive_can_poll_for_media")
+ (return-type "gboolean")
+)
+
+(define-method can_eject
+ (of-object "GDrive")
+ (c-name "g_drive_can_eject")
+ (return-type "gboolean")
+)
+
+;;
+;; wrapped in gdrive.override
+;;
+(define-method eject
+ (of-object "GDrive")
+ (c-name "g_drive_eject")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_finish
+ (of-object "GDrive")
+ (c-name "g_drive_eject_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gdrive.override
+;;
+(define-method poll_for_media
+ (of-object "GDrive")
+ (c-name "g_drive_poll_for_media")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method poll_for_media_finish
+ (of-object "GDrive")
+ (c-name "g_drive_poll_for_media_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_identifier
+ (of-object "GDrive")
+ (c-name "g_drive_get_identifier")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "kind")
+ )
+)
+
+;;
+;; wrapped in gdrive.override
+;;
+(define-method enumerate_identifiers
+ (of-object "GDrive")
+ (c-name "g_drive_enumerate_identifiers")
+ (return-type "char**")
+)
+
+(define-method can_start
+ (of-object "GDrive")
+ (c-name "g_drive_can_start")
+ (return-type "gboolean")
+)
+
+(define-method can_start_degraded
+ (of-object "GDrive")
+ (c-name "g_drive_can_start_degraded")
+ (return-type "gboolean")
+)
+
+(define-method can_stop
+ (of-object "GDrive")
+ (c-name "g_drive_can_stop")
+ (return-type "gboolean")
+)
+
+(define-method eject_with_operation
+ (of-object "GDrive")
+ (c-name "g_drive_eject_with_operation")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_with_operation_finish
+ (of-object "GDrive")
+ (c-name "g_drive_eject_with_operation_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_start_stop_type
+ (of-object "GDrive")
+ (c-name "g_drive_get_start_stop_type")
+ (return-type "GDriveStartStopType")
+)
+
+(define-method start
+ (of-object "GDrive")
+ (c-name "g_drive_start")
+ (return-type "none")
+ (parameters
+ '("GDriveStartFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method start_finish
+ (of-object "GDrive")
+ (c-name "g_drive_start_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method stop
+ (of-object "GDrive")
+ (c-name "g_drive_stop")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method stop_finish
+ (of-object "GDrive")
+ (c-name "g_drive_stop_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gemblemedicon.h
+
+(define-function emblemed_icon_get_type
+ (c-name "g_emblemed_icon_get_type")
+ (return-type "GType")
+)
+
+(define-function emblemed_icon_new
+ (c-name "g_emblemed_icon_new")
+ (is-constructor-of "GEmblemedIcon")
+ (return-type "GIcon*")
+ (parameters
+ '("GIcon*" "icon")
+ '("GEmblem*" "emblem")
+ )
+)
+
+(define-method get_icon
+ (of-object "GEmblemedIcon")
+ (c-name "g_emblemed_icon_get_icon")
+ (return-type "GIcon*")
+)
+
+(define-method get_emblems
+ (of-object "GEmblemedIcon")
+ (c-name "g_emblemed_icon_get_emblems")
+ (return-type "GList*")
+)
+
+(define-method add_emblem
+ (of-object "GEmblemedIcon")
+ (c-name "g_emblemed_icon_add_emblem")
+ (return-type "none")
+ (parameters
+ '("GEmblem*" "emblem")
+ )
+)
+
+
+
+;; From gemblem.h
+
+(define-function emblem_get_type
+ (c-name "g_emblem_get_type")
+ (return-type "GType")
+)
+
+(define-function emblem_new
+ (c-name "g_emblem_new")
+ (is-constructor-of "GEmblem")
+ (return-type "GEmblem*")
+ (properties
+ '("icon")
+ '("origin" (optional))
+ )
+)
+
+(define-function emblem_new_with_origin
+ (c-name "g_emblem_new_with_origin")
+ (return-type "GEmblem*")
+ (parameters
+ '("GIcon*" "icon")
+ '("GEmblemOrigin" "origin")
+ )
+)
+
+(define-method get_icon
+ (of-object "GEmblem")
+ (c-name "g_emblem_get_icon")
+ (return-type "GIcon*")
+)
+
+(define-method get_origin
+ (of-object "GEmblem")
+ (c-name "g_emblem_get_origin")
+ (return-type "GEmblemOrigin")
+)
+
+
+
+;; From gfileattribute.h
+
+(define-function file_attribute_info_list_new
+ (c-name "g_file_attribute_info_list_new")
+ (is-constructor-of "GFileAttributeInfoList")
+ (return-type "GFileAttributeInfoList*")
+)
+
+(define-method ref
+ (of-object "GFileAttributeInfoList")
+ (c-name "g_file_attribute_info_list_ref")
+ (return-type "GFileAttributeInfoList*")
+)
+
+(define-method unref
+ (of-object "GFileAttributeInfoList")
+ (c-name "g_file_attribute_info_list_unref")
+ (return-type "none")
+)
+
+(define-method dup
+ (of-object "GFileAttributeInfoList")
+ (c-name "g_file_attribute_info_list_dup")
+ (return-type "GFileAttributeInfoList*")
+)
+
+(define-method lookup
+ (of-object "GFileAttributeInfoList")
+ (c-name "g_file_attribute_info_list_lookup")
+ (return-type "const-GFileAttributeInfo*")
+ (parameters
+ '("const-char*" "name")
+ )
+)
+
+(define-method add
+ (of-object "GFileAttributeInfoList")
+ (c-name "g_file_attribute_info_list_add")
+ (return-type "none")
+ (parameters
+ '("const-char*" "name")
+ '("GFileAttributeType" "type")
+ '("GFileAttributeInfoFlags" "flags" (default "G_FILE_ATTRIBUTE_INFO_NONE"))
+ )
+)
+
+
+
+;; From gfileenumerator.h
+
+(define-function file_enumerator_get_type
+ (c-name "g_file_enumerator_get_type")
+ (return-type "GType")
+)
+
+(define-method next_file
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_next_file")
+ (return-type "GFileInfo*")
+ (caller-owns-return #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method close
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_close")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfileenumerator.override
+;;
+(define-method next_files_async
+ (docstring
+"FE.next_files_async(num_files, callback, [io_priority, cancellable,\n"
+" user_data])\n"
+"Request information for a number of files from the enumerator\n"
+"asynchronously. When all i/o for the operation is finished the callback\n"
+"will be called with the requested information.\n"
+"\n"
+"The callback can be called with less than num_files files in case of error\n"
+"or at the end of the enumerator. In case of a partial error the callback\n"
+"will be called with any succeeding items and no error, and on the next\n"
+"request the error will be reported. If a request is cancelled the callback\n"
+"will be called with gio.ERROR_CANCELLED.\n"
+"\n"
+"During an async request no other sync and async calls are allowed, and will\n"
+"result in gio.ERROR_PENDING errors.\n"
+"\n"
+"Any outstanding i/o request with higher priority (lower numerical value)\n"
+"will be executed before an outstanding request with lower priority.\n"
+"Default priority is gobject.PRIORITY_DEFAULT.")
+
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_next_files_async")
+ (return-type "none")
+ (parameters
+ '("int" "num_files")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+;;
+;; wrapped in gfileenumerator.override
+;;
+(define-method next_files_finish
+ (docstring
+"FE.next_files_finish(result) -> a list of gio.FileInfos\n"
+"Finishes the asynchronous operation started with\n"
+"gio.FileEnumerator.next_files_async().")
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_next_files_finish")
+ (return-type "GList*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfileenumerator.override
+;;
+(define-method close_async
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_close_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method close_finish
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_close_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method is_closed
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_is_closed")
+ (return-type "gboolean")
+)
+
+(define-method has_pending
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_has_pending")
+ (return-type "gboolean")
+)
+
+(define-method set_pending
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_set_pending")
+ (return-type "none")
+ (parameters
+ '("gboolean" "pending")
+ )
+)
+
+(define-method get_container
+ (of-object "GFileEnumerator")
+ (c-name "g_file_enumerator_get_container")
+ (return-type "GFile*")
+)
+
+
+
+;; From gfile.h
+
+(define-function file_get_type
+ (c-name "g_file_get_type")
+ (return-type "GType")
+)
+
+(define-function file_new_for_path
+ (c-name "g_file_new_for_path")
+ (is-constructor-of "GFile")
+ (return-type "GFile*")
+ (parameters
+ '("const-char*" "path")
+ )
+)
+
+(define-function file_new_for_uri
+ (c-name "g_file_new_for_uri")
+ (is-constructor-of "GFile")
+ (return-type "GFile*")
+ (parameters
+ '("const-char*" "uri")
+ )
+)
+
+(define-function file_new_for_commandline_arg
+ (is-constructor-of "GFile")
+ (c-name "g_file_new_for_commandline_arg")
+ (return-type "GFile*")
+ (parameters
+ '("const-char*" "arg")
+ )
+)
+
+(define-function file_parse_name
+ (c-name "g_file_parse_name")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "parse_name")
+ )
+)
+
+(define-method dup
+ (of-object "GFile")
+ (c-name "g_file_dup")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+)
+
+(define-function file_hash
+ (c-name "g_file_hash")
+ (return-type "guint")
+ (parameters
+ '("gconstpointer" "file")
+ )
+)
+
+(define-method equal
+ (of-object "GFile")
+ (c-name "g_file_equal")
+ (return-type "gboolean")
+ (parameters
+ '("GFile*" "file2")
+ )
+)
+
+(define-method get_basename
+ (of-object "GFile")
+ (c-name "g_file_get_basename")
+ (return-type "char*")
+)
+
+(define-method get_path
+ (of-object "GFile")
+ (c-name "g_file_get_path")
+ (return-type "char*")
+)
+
+(define-method get_uri
+ (of-object "GFile")
+ (c-name "g_file_get_uri")
+ (return-type "char*")
+)
+
+(define-method get_parse_name
+ (of-object "GFile")
+ (c-name "g_file_get_parse_name")
+ (return-type "char*")
+)
+
+(define-method get_parent
+ (of-object "GFile")
+ (c-name "g_file_get_parent")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+)
+
+(define-method get_child
+ (of-object "GFile")
+ (c-name "g_file_get_child")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "name")
+ )
+)
+
+(define-method get_child_for_display_name
+ (of-object "GFile")
+ (c-name "g_file_get_child_for_display_name")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "display_name")
+ '("GError**" "error")
+ )
+)
+
+(define-method has_prefix
+ (of-object "GFile")
+ (c-name "g_file_has_prefix")
+ (return-type "gboolean")
+ (parameters
+ '("GFile*" "descendant")
+ )
+)
+
+(define-method get_relative_path
+ (of-object "GFile")
+ (c-name "g_file_get_relative_path")
+ (return-type "char*")
+ (parameters
+ '("GFile*" "descendant")
+ )
+)
+
+(define-method resolve_relative_path
+ (of-object "GFile")
+ (c-name "g_file_resolve_relative_path")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "relative_path")
+ )
+)
+
+(define-method is_native
+ (of-object "GFile")
+ (c-name "g_file_is_native")
+ (return-type "gboolean")
+)
+
+(define-method has_uri_scheme
+ (of-object "GFile")
+ (c-name "g_file_has_uri_scheme")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "uri_scheme")
+ )
+)
+
+(define-method get_uri_scheme
+ (of-object "GFile")
+ (c-name "g_file_get_uri_scheme")
+ (return-type "char*")
+)
+
+(define-method read
+ (of-object "GFile")
+ (docstring
+ "F.read([cancellable]) -> input stream\n"
+ "Opens a file for reading. The result is a GFileInputStream that\n"
+ "can be used to read the contents of the file.\n"
+ "\n"
+ "If cancellable is specified, then the operation can be cancelled\n"
+ "by triggering the cancellable object from another thread. If the\n"
+ "operation was cancelled, the error gio.IO_ERROR_CANCELLED will\n"
+ "be returned. If the file does not exist, the gio.IO_ERROR_NOT_FOUND\n"
+ "error will be returned. If the file is a directory, the\n"
+ "gio.IO_ERROR_IS_DIRECTORY error will be returned. Other errors\n"
+ "are possible too, and depend on what kind of filesystem the file is on."
+ )
+ (c-name "g_file_read")
+ (return-type "GFileInputStream*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method read_async
+ (of-object "GFile")
+ (docstring
+ "F.read_async(callback [,io_priority [,cancellable [,user_data]]])\n"
+ "-> start read\n"
+ "\n"
+ "For more details, see gio.File.read() which is the synchronous\n"
+ "version of this call. Asynchronously opens file for reading.\n"
+ "When the operation is finished, callback will be called.\n"
+ "You can then call g_file_read_finish() to get the result of the\n"
+ "operation.\n"
+ )
+ (c-name "g_file_read_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method read_finish
+ (of-object "GFile")
+ (c-name "g_file_read_finish")
+ (return-type "GFileInputStream*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method append_to
+ (of-object "GFile")
+ (c-name "g_file_append_to")
+ (return-type "GFileOutputStream*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method create
+ (of-object "GFile")
+ (c-name "g_file_create")
+ (return-type "GFileOutputStream*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method replace
+ (of-object "GFile")
+ (c-name "g_file_replace")
+ (return-type "GFileOutputStream*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "etag")
+ '("gboolean" "make_backup")
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method append_to_async
+ (docstring
+ "F.append_to_async(callback [flags, [,io_priority [,cancellable\n"
+ " [,user_data]]]]) -> open for append\n"
+ "\n"
+ "Asynchronously opens file for appending.\n"
+ "For more details, see gio.File.append_to() which is the synchronous\n"
+ "version of this call. When the operation is finished, callback will\n"
+ "be called. You can then call F.append_to_finish() to get the result\n"
+ "of the operation."
+ )
+ (of-object "GFile")
+ (c-name "g_file_append_to_async")
+ (return-type "none")
+ (parameters
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method append_to_finish
+ (of-object "GFile")
+ (c-name "g_file_append_to_finish")
+ (return-type "GFileOutputStream*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method create_async
+ (docstring
+ "F.create_async(callback [flags, [,io_priority [,cancellable\n"
+ " [,user_data]]]]) -> file created\n"
+ "\n"
+ "Asynchronously creates a new file and returns an output stream for\n"
+ "writing to it. The file must not already exist.\n"
+ "For more details, see F.create() which is the synchronous\n"
+ "version of this call.\n"
+ "When the operation is finished, callback will be called. You can\n"
+ "then call F.create_finish() to get the result of the operation."
+ )
+ (of-object "GFile")
+ (c-name "g_file_create_async")
+ (return-type "none")
+ (parameters
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method create_finish
+ (of-object "GFile")
+ (c-name "g_file_create_finish")
+ (return-type "GFileOutputStream*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method replace_async
+ (docstring
+ "F.replace_async(callback [etag, [make_backup, [flags, [io_priority,\n"
+ " [cancellable, [user_data]]]]]]) -> file replace\n"
+ "\n"
+ "Asynchronously overwrites the file, replacing the contents, possibly\n"
+ "creating a backup copy of the file first.\n"
+ "For more details, see F.replace() which is the synchronous\n"
+ "version of this call.\n"
+ "When the operation is finished, callback will be called. You can\n"
+ "then call F.replace_finish() to get the result of the operation."
+ )
+ (of-object "GFile")
+ (c-name "g_file_replace_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "etag")
+ '("gboolean" "make_backup")
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method replace_finish
+ (of-object "GFile")
+ (c-name "g_file_replace_finish")
+ (return-type "GFileOutputStream*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method query_exists
+ (of-object "GFile")
+ (c-name "g_file_query_exists")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ )
+)
+
+(define-method query_file_type
+ (of-object "GFile")
+ (c-name "g_file_query_file_type")
+ (return-type "GFileType")
+ (parameters
+ '("GFileQueryInfoFlags" "flags")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ )
+)
+
+(define-method query_info
+ (of-object "GFile")
+ (c-name "g_file_query_info")
+ (return-type "GFileInfo*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "attributes")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method query_info_async
+ (docstring
+ "F.query_info_async(attributes, callback, [flags, [io_priority,\n"
+ " [cancellable, [user_data]]]]) -> query attributes\n"
+ "\n"
+ "Asynchronously gets the requested information about specified file.\n"
+ "The result is a GFileInfo object that contains key-value attributes\n"
+ "(such as type or size for the file).\n"
+ "For more details, see F.query_info() which is the synchronous\n"
+ "version of this call. \n"
+ "When the operation is finished, callback will be called. You can\n"
+ "then call F.query_info_finish() to get the result of the operation.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_query_info_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attributes")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method query_info_finish
+ (of-object "GFile")
+ (c-name "g_file_query_info_finish")
+ (return-type "GFileInfo*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method query_filesystem_info
+ (of-object "GFile")
+ (c-name "g_file_query_filesystem_info")
+ (return-type "GFileInfo*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "attributes")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method query_filesystem_info_async
+ (of-object "GFile")
+ (c-name "g_file_query_filesystem_info_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attributes")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method query_filesystem_info_finish
+ (of-object "GFile")
+ (c-name "g_file_query_filesystem_info_finish")
+ (return-type "GFileInfo*")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method find_enclosing_mount
+ (of-object "GFile")
+ (c-name "g_file_find_enclosing_mount")
+ (return-type "GMount*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method find_enclosing_mount_async
+ (of-object "GFile")
+ (c-name "g_file_find_enclosing_mount_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method find_enclosing_mount_finish
+ (of-object "GFile")
+ (c-name "g_file_find_enclosing_mount_finish")
+ (return-type "GMount*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method enumerate_children
+ (docstring
+"F.enumerate_children(attributes, [flags, cancellable]) -> enumerator\n"
+"Gets the requested information about the files in a directory.\n"
+"The result is a gio.FileEnumerator object that will give out gio.FileInfo\n"
+"objects for all the files in the directory.\n"
+"The attribute value is a string that specifies the file attributes that\n"
+"should be gathered. It is not an error if it's not possible to read a \n"
+"particular requested attribute from a file - it just won't be set.\n"
+"attribute should be a comma-separated list of attribute or attribute\n"
+"wildcards. The wildcard \"*\" means all attributes, and a wildcard like\n"
+"\"standard::*\" means all attributes in the standard namespace.\n"
+"An example attribute query be \"standard::*,owner::user\". The standard\n"
+"attributes are available as defines, like gio.FILE_ATTRIBUTE_STANDARD_NAME.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled by\n"
+"triggering the cancellable object from another thread. If the operation was\n"
+"cancelled, the error gio.ERROR_CANCELLED will be returned.\n"
+"\n"
+"If the file does not exist, the gio.ERROR_NOT_FOUND error will be returned.\n"
+"If the file is not a directory, the gio.FILE_ERROR_NOTDIR error will\n"
+"be returned. Other errors are possible too.")
+ (of-object "GFile")
+ (c-name "g_file_enumerate_children")
+ (return-type "GFileEnumerator*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "attributes")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method enumerate_children_async
+ (docstring
+"F.enumerate_children_async(attributes, callback,\n"
+" [flags, io_priority, cancellable, user_data])\n"
+"Asynchronously gets the requested information about the files in a\n"
+"directory. The result is a GFileEnumerator object that will give out\n"
+"GFileInfo objects for all the files in the directory.\n"
+"\n"
+"For more details, see gio.File.enumerate_children() which is the synchronous\n"
+"version of this call.\n"
+"\n"
+"When the operation is finished, callback will be called. You can then call\n"
+"gio.File.enumerate_children_finish() to get the result of the operation.")
+ (of-object "GFile")
+ (c-name "g_file_enumerate_children_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attributes")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method enumerate_children_finish
+ (of-object "GFile")
+ (c-name "g_file_enumerate_children_finish")
+ (return-type "GFileEnumerator*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method set_display_name
+ (of-object "GFile")
+ (c-name "g_file_set_display_name")
+ (return-type "GFile*")
+ (unblock-threads #t)
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "display_name")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_display_name_async
+ (of-object "GFile")
+ (c-name "g_file_set_display_name_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "display_name")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method set_display_name_finish
+ (of-object "GFile")
+ (c-name "g_file_set_display_name_finish")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method delete
+ (of-object "GFile")
+ (c-name "g_file_delete")
+ (return-type "gboolean")
+ (unblock-threads #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method trash
+ (of-object "GFile")
+ (c-name "g_file_trash")
+ (return-type "gboolean")
+ (unblock-threads #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method copy
+ (docstring
+"F.copy(destination, [callback, flags, cancellable, user_data])\n"
+"Copies the file source to the location specified by destination.\n"
+"Can not handle recursive copies of directories.\n"
+"\n"
+"If the flag gio.FILE_COPY_OVERWRITE is specified an already existing\n"
+"destination file is overwritten.\n"
+"\n"
+"If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlink\n"
+"will be copied as symlinks, otherwise the target of the source symlink\n"
+"will be copied.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled b\n"
+"triggering the cancellable object from another thread.\n"
+"If the operation was cancelled, the error gio.ERROR_CANCELLED\n"
+"will be returned.\n"
+"\n"
+"If progress_callback is not None, then the operation can be monitored\n"
+"by setting this to a callable. if specified progress_callback_data will\n"
+"be passed to this function. It is guaranteed that this callback\n"
+"will be called after all data has been transferred with the total number\n"
+"of bytes copied during the operation.\n"
+"\n"
+"If the source file does not exist then the gio.ERROR_NOT_FOUND\n"
+"error is returned, independent on the status of the destination.\n"
+"\n"
+"If gio.FILE_COPY_OVERWRITE is not specified and the target exists\n"
+"then the error gio.ERROR_EXISTS is returned.\n"
+"\n"
+"If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY\n"
+"error is returned. If trying to overwrite a directory with a directory\n"
+"the gio.ERROR_WOULD_MERGE error is returned.\n"
+"\n"
+"If the source is a directory and the target does not exist\n"
+"or gio.FILE_COPY_OVERWRITE is specified and the target is a file\n"
+"then the gio.ERROR_WOULD_RECURSE error is returned.\n"
+"\n"
+"If you are interested in copying the GFile object itself\n"
+"(not the on-disk file), see gio.File.dup().")
+ (of-object "GFile")
+ (c-name "g_file_copy")
+ (unblock-threads #t)
+ (return-type "gboolean")
+ (parameters
+ '("GFile*" "destination")
+ '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GFileProgressCallback" "progress_callback")
+ '("gpointer" "progress_callback_data")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method copy_async
+ (of-object "GFile")
+ (docstring
+ "F.copy_async(destination, callback, [flags, io_priority, user_data, cancellable, progress_callback])\n"
+ "-> start copy\n"
+ "\n"
+ "For more details, see gio.File.copy() which is the synchronous\n"
+ "version of this call. Asynchronously copies file.\n"
+ "When the operation is finished, callback will be called.\n"
+ "You can then call g_file_copy_finish() to get the result of the\n"
+ "operation.\n"
+ )
+ (c-name "g_file_copy_async")
+ (return-type "none")
+ (parameters
+ '("GFile*" "destination")
+ '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GFileProgressCallback" "progress_callback")
+ '("gpointer" "progress_callback_data")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method copy_finish
+ (of-object "GFile")
+ (c-name "g_file_copy_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method move
+ (docstring
+"F.move(destination, [callback, flags, cancellable, user_data])\n"
+"Tries to move the file or directory source to the location\n"
+"specified by destination. If native move operations are\n"
+"supported then this is used, otherwise a copy + delete fallback\n"
+"is used. The native implementation may support moving directories\n"
+"(for instance on moves inside the same filesystem), but the \n"
+"fallback code does not.\n"
+"\n"
+"If the flag gio.FILE_COPY_OVERWRITE is specified an already existing\n"
+"destination file is overwritten.\n"
+"\n"
+"If the flag gio.FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlink\n"
+"will be copied as symlinks, otherwise the target of the source symlink\n"
+"will be copied.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled b\n"
+"triggering the cancellable object from another thread.\n"
+"If the operation was cancelled, the error gio.ERROR_CANCELLED\n"
+"will be returned.\n"
+"\n"
+"If progress_callback is not None, then the operation can be monitored\n"
+"by setting this to a callable. if specified progress_callback_data will\n"
+"be passed to this function. It is guaranteed that this callback\n"
+"will be called after all data has been transferred with the total number\n"
+"of bytes copied during the operation.\n"
+"\n"
+"If the source file does not exist then the gio.ERROR_NOT_FOUND\n"
+"error is returned, independent on the status of the destination.\n"
+"\n"
+"If gio.FILE_COPY_OVERWRITE is not specified and the target exists\n"
+"then the error gio.ERROR_EXISTS is returned.\n"
+"\n"
+"If trying to overwrite a file over a directory the gio.ERROR_IS_DIRECTORY\n"
+"error is returned. If trying to overwrite a directory with a directory\n"
+"the gio.ERROR_WOULD_MERGE error is returned.\n"
+"\n"
+"If the source is a directory and the target does not exist\n"
+"or gio.FILE_COPY_OVERWRITE is specified and the target is a file\n"
+"then the gio.ERROR_WOULD_RECURSE error is returned.")
+ (of-object "GFile")
+ (c-name "g_file_move")
+ (return-type "gboolean")
+ (parameters
+ '("GFile*" "destination")
+ '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GFileProgressCallback" "progress_callback")
+ '("gpointer" "progress_callback_data")
+ '("GError**" "error")
+ )
+)
+
+(define-method make_directory
+ (of-object "GFile")
+ (c-name "g_file_make_directory")
+ (return-type "gboolean")
+ (unblock-threads #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method make_directory_with_parents
+ (of-object "GFile")
+ (c-name "g_file_make_directory_with_parents")
+ (return-type "gboolean")
+ (unblock-threads #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method make_symbolic_link
+ (of-object "GFile")
+ (c-name "g_file_make_symbolic_link")
+ (return-type "gboolean")
+ (unblock-threads #t)
+ (parameters
+ '("const-char*" "symlink_value")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method query_settable_attributes
+ (docstring
+ "F.query_settable_attributes([cancellable]) -> list\n\n"
+ "Obtain the list of settable attributes for the file.\n"
+ "Returns the type and full attribute name of all the attributes that\n"
+ "can be set on this file. This doesn't mean setting it will always\n"
+ "succeed though, you might get an access failure, or some specific\n"
+ "file may not support a specific attribute.\n\n"
+ "If cancellable is not None, then the operation can be cancelled by\n"
+ "triggering the cancellable object from another thread. If the operation\n"
+ "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned."
+ )
+ (of-object "GFile")
+ (c-name "g_file_query_settable_attributes")
+ (return-type "GFileAttributeInfoList*")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method query_writable_namespaces
+ (docstring
+ "F.query_writable_namespaces([cancellable]) -> list\n\n"
+ "Obtain the list of attribute namespaces where new attributes can\n"
+ "be created by a user. An example of this is extended attributes\n"
+ "(in the "xattr" namespace).\n"
+ "If cancellable is not None, then the operation can be cancelled\n"
+ "by triggering the cancellable object from another thread. If the\n"
+ "operation was cancelled, the error gio.IO_ERROR_CANCELLED\n"
+ "will be returned."
+ )
+ (of-object "GFile")
+ (c-name "g_file_query_writable_namespaces")
+ (return-type "GFileAttributeInfoList*")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method set_attribute
+ (docstring
+ "F.set_attribute(attribute, type, value_p [,flags [,cancellable ]])->bool\n"
+ "\n"
+ "Sets an attribute in the file with attribute name attribute to value_p.\n"
+ "If cancellable is not None, then the operation can be cancelled by\n"
+ "triggering the cancellable object from another thread. If the operation\n"
+ "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned."
+ )
+ (of-object "GFile")
+ (c-name "g_file_set_attribute")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("GFileAttributeType" "type")
+ '("gpointer" "value_p")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attributes_from_info
+ (of-object "GFile")
+ (c-name "g_file_set_attributes_from_info")
+ (return-type "gboolean")
+ (parameters
+ '("GFileInfo*" "info")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attributes_async
+ (of-object "GFile")
+ (c-name "g_file_set_attributes_async")
+ (return-type "none")
+ (parameters
+ '("GFileInfo*" "info")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method set_attributes_finish
+ (of-object "GFile")
+ (c-name "g_file_set_attributes_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GFileInfo**" "info")
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attribute_string
+ (of-object "GFile")
+ (c-name "g_file_set_attribute_string")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("const-char*" "value")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attribute_byte_string
+ (of-object "GFile")
+ (c-name "g_file_set_attribute_byte_string")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("const-char*" "value")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attribute_uint32
+ (of-object "GFile")
+ (c-name "g_file_set_attribute_uint32")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("guint32" "value")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attribute_int32
+ (of-object "GFile")
+ (c-name "g_file_set_attribute_int32")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("gint32" "value")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attribute_uint64
+ (of-object "GFile")
+ (c-name "g_file_set_attribute_uint64")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("guint64" "value")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method set_attribute_int64
+ (of-object "GFile")
+ (c-name "g_file_set_attribute_int64")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("gint64" "value")
+ '("GFileQueryInfoFlags" "flags" (default "G_FILE_QUERY_INFO_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method mount_enclosing_volume
+ (docstring
+"F.mount_enclosing_volume(mount_operation, callback, [cancellable,\n"
+" user_data])\n"
+"Starts a mount_operation, mounting the volume that contains\n"
+"the file location.\n"
+"\n"
+"When this operation has completed, callback will be called with\n"
+"user_user data, and the operation can be finalized with\n"
+"gio.File.mount_enclosing_volume_finish().\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled\n"
+"by triggering the cancellable object from another thread.\n"
+"If the operation was cancelled, the error gio.ERROR_CANCELLED\n"
+"will be returned.")
+ (of-object "GFile")
+ (c-name "g_file_mount_enclosing_volume")
+ (return-type "none")
+ (parameters
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method mount_enclosing_volume_finish
+ (of-object "GFile")
+ (c-name "g_file_mount_enclosing_volume_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method mount_mountable
+ (docstring
+"F.mount_mountable(mount_operation, callback, [flags, cancellable,\n"
+" user_data])\n"
+"Mounts a file of type gio.FILE_TYPE_MOUNTABLE. Using mount_operation,\n"
+"you can request callbacks when, for instance, passwords are needed\n"
+"during authentication.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled by\n"
+" triggering the cancellable object from another thread. If the\n"
+"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n"
+"\n"
+"When the operation is finished, callback will be called. You can then\n"
+"call g_file_mount_mountable_finish() to get the result of the operation.\n")
+ (of-object "GFile")
+ (c-name "g_file_mount_mountable")
+ (return-type "none")
+ (parameters
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method mount_mountable_finish
+ (of-object "GFile")
+ (c-name "g_file_mount_mountable_finish")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method unmount_mountable
+ (docstring
+"F.unmount_mountable(callback, [flags, cancellable, user_data])\n"
+"Unmounts a file of type gio.FILE_TYPE_MOUNTABLE.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled by\n"
+"triggering the cancellable object from another thread. If the\n"
+"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n"
+"\n"
+"When the operation is finished, callback will be called. You can\n"
+"then call gio.File.unmount_mountable_finish() to get the\n"
+"result of the operation.\n")
+ (of-object "GFile")
+ (c-name "g_file_unmount_mountable")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method unmount_mountable_finish
+ (of-object "GFile")
+ (c-name "g_file_unmount_mountable_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method eject_mountable
+ (of-object "GFile")
+ (c-name "g_file_eject_mountable")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_mountable_finish
+ (of-object "GFile")
+ (c-name "g_file_eject_mountable_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+(define-method copy_attributes
+ (of-object "GFile")
+ (c-name "g_file_copy_attributes")
+ (return-type "gboolean")
+ (parameters
+ '("GFile*" "destination")
+ '("GFileCopyFlags" "flags" (default "G_FILE_COPY_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method monitor_directory
+ (of-object "GFile")
+ (c-name "g_file_monitor_directory")
+ (return-type "GFileMonitor*")
+ (caller-owns-return #t)
+ (parameters
+ '("GFileMonitorFlags" "flags" (default "G_FILE_MONITOR_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method monitor_file
+ (of-object "GFile")
+ (c-name "g_file_monitor_file")
+ (return-type "GFileMonitor*")
+ (caller-owns-return #t)
+ (parameters
+ '("GFileMonitorFlags" "flags" (default "G_FILE_MONITOR_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method monitor
+ (of-object "GFile")
+ (c-name "g_file_monitor")
+ (return-type "GFileMonitor*")
+ (parameters
+ '("GFileMonitorFlags" "flags" (default "G_FILE_MONITOR_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method query_default_handler
+ (of-object "GFile")
+ (c-name "g_file_query_default_handler")
+ (return-type "GAppInfo*")
+ (caller-owns-return #t)
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method load_contents
+ (docstring
+ "F.load_contents([cancellable]) -> contents, length, etag_out\n\n"
+ "Loads the content of the file into memory, returning the size of the\n"
+ "data. The data is always zero terminated, but this is not included\n"
+ "in the resultant length.\n"
+ "If cancellable is not None, then the operation can be cancelled by\n"
+ "triggering the cancellable object from another thread. If the operation\n"
+ "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_load_contents")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("char**" "contents")
+ '("gsize*" "length")
+ '("char**" "etag_out")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method load_contents_async
+ (docstring
+ "F.load_contents_async(callback, [cancellable, [user_data]])->start loading\n\n"
+ "Starts an asynchronous load of the file's contents.\n\n"
+ "For more details, see F.load_contents() which is the synchronous\n"
+ "version of this call.\n\n"
+ "When the load operation has completed, callback will be called with\n"
+ "user data. To finish the operation, call F.load_contents_finish() with\n"
+ "the parameter 'res' returned by the callback.\n\n"
+ "If cancellable is not None, then the operation can be cancelled by\n"
+ "triggering the cancellable object from another thread. If the operation\n"
+ "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_load_contents_async")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method load_contents_finish
+ (docstring
+ "F.load_contents_finish(res) -> contents, length, etag_out\n\n"
+ "Finishes an asynchronous load of the file's contents. The contents are\n"
+ "placed in contents, and length is set to the size of the contents\n"
+ "string. If etag_out is present, it will be set to the new entity\n"
+ "tag for the file.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_load_contents_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("char**" "contents")
+ '("gsize*" "length")
+ '("char**" "etag_out")
+ '("GError**" "error")
+ )
+)
+
+(define-method load_partial_contents_async
+ (of-object "GFile")
+ (c-name "g_file_load_partial_contents_async")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GFileReadMoreCallback" "read_more_callback")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method load_partial_contents_finish
+ (of-object "GFile")
+ (c-name "g_file_load_partial_contents_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("char**" "contents")
+ '("gsize*" "length")
+ '("char**" "etag_out")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method replace_contents
+ (docstring
+ "F.replace_contents(contents, [etag, [make_backup, [flags, [cancellable]]]])\n"
+ "-> etag_out\n"
+ "\n"
+ "Replaces the content of the file, returning the new etag value for the\n"
+ "file. If an etag is specified, any existing file must have that etag, or\n"
+ "the error gio.IO_ERROR_WRONG_ETAG will be returned.\n"
+ "If make_backup is True, this method will attempt to make a backup of the\n"
+ "file. If cancellable is not None, then the operation can be cancelled by\n"
+ "triggering the cancellable object from another thread. If the operation\n"
+ "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_replace_contents")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "contents")
+ '("gsize" "length")
+ '("const-char*" "etag")
+ '("gboolean" "make_backup")
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("char**" "new_etag")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method replace_contents_async
+ (docstring
+ "F.replace_contents_async(contents, callback, [etag, [make_backup, [flags,\n"
+ " [cancellable]]]]) -> etag_out\n"
+ "\n"
+ "Starts an asynchronous replacement of the file with the given contents.\n"
+ "For more details, see F.replace_contents() which is the synchronous\n"
+ "version of this call.\n\n"
+ "When the load operation has completed, callback will be called with\n"
+ "user data. To finish the operation, call F.replace_contents_finish() with\n"
+ "the parameter 'res' returned by the callback.\n\n"
+ "If cancellable is not None, then the operation can be cancelled by\n"
+ "triggering the cancellable object from another thread. If the operation\n"
+ "was cancelled, the error gio.IO_ERROR_CANCELLED will be returned.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_replace_contents_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "contents")
+ '("gsize" "length")
+ '("const-char*" "etag")
+ '("gboolean" "make_backup")
+ '("GFileCreateFlags" "flags" (default "G_FILE_CREATE_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+;;
+;; wrapped in gfile.override
+;;
+(define-method replace_contents_finish
+ (docstring
+ "F.replace_contents_finish(res) -> etag_out\n\n"
+ "Finishes an asynchronous replacement of the file's contents.\n"
+ "The new entity tag for the file is returned.\n"
+ )
+ (of-object "GFile")
+ (c-name "g_file_replace_contents_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("char**" "new_etag")
+ '("GError**" "error")
+ )
+)
+
+(define-method create_readwrite
+ (of-object "GFile")
+ (c-name "g_file_create_readwrite")
+ (return-type "GFileIOStream*")
+ (parameters
+ '("GFileCreateFlags" "flags")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method create_readwrite_async
+ (of-object "GFile")
+ (c-name "g_file_create_readwrite_async")
+ (return-type "none")
+ (parameters
+ '("GFileCreateFlags" "flags")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method create_readwrite_finish
+ (of-object "GFile")
+ (c-name "g_file_create_readwrite_finish")
+ (return-type "GFileIOStream*")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method eject_mountable_with_operation
+ (of-object "GFile")
+ (c-name "g_file_eject_mountable_with_operation")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_mountable_with_operation_finish
+ (of-object "GFile")
+ (c-name "g_file_eject_mountable_with_operation_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method open_readwrite
+ (of-object "GFile")
+ (c-name "g_file_open_readwrite")
+ (return-type "GFileIOStream*")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method open_readwrite_async
+ (of-object "GFile")
+ (c-name "g_file_open_readwrite_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method open_readwrite_finish
+ (of-object "GFile")
+ (c-name "g_file_open_readwrite_finish")
+ (return-type "GFileIOStream*")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method poll_mountable
+ (of-object "GFile")
+ (c-name "g_file_poll_mountable")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method poll_mountable_finish
+ (of-object "GFile")
+ (c-name "g_file_poll_mountable_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method replace_readwrite
+ (of-object "GFile")
+ (c-name "g_file_replace_readwrite")
+ (return-type "GFileIOStream*")
+ (parameters
+ '("const-char*" "etag")
+ '("gboolean" "make_backup")
+ '("GFileCreateFlags" "flags")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method replace_readwrite_async
+ (of-object "GFile")
+ (c-name "g_file_replace_readwrite_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "etag")
+ '("gboolean" "make_backup")
+ '("GFileCreateFlags" "flags")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method replace_readwrite_finish
+ (of-object "GFile")
+ (c-name "g_file_replace_readwrite_finish")
+ (return-type "GFileIOStream*")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("GError**" "error")
+ )
+)
+
+(define-method start_mountable
+ (of-object "GFile")
+ (c-name "g_file_start_mountable")
+ (return-type "none")
+ (parameters
+ '("GDriveStartFlags" "flags")
+ '("GMountOperation*" "start_operation")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method start_mountable_finish
+ (of-object "GFile")
+ (c-name "g_file_start_mountable_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method stop_mountable
+ (of-object "GFile")
+ (c-name "g_file_stop_mountable")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method stop_mountable_finish
+ (of-object "GFile")
+ (c-name "g_file_stop_mountable_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method supports_thread_contexts
+ (of-object "GFile")
+ (c-name "g_file_supports_thread_contexts")
+ (return-type "gboolean")
+)
+
+(define-method unmount_mountable_with_operation
+ (of-object "GFile")
+ (c-name "g_file_unmount_mountable_with_operation")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method unmount_mountable_with_operation_finish
+ (of-object "GFile")
+ (c-name "g_file_unmount_mountable_with_operation_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gfileicon.h
+
+(define-function file_icon_get_type
+ (c-name "g_file_icon_get_type")
+ (return-type "GType")
+)
+
+(define-function file_icon_new
+ (c-name "g_file_icon_new")
+ (is-constructor-of "GFileIcon")
+ (return-type "GIcon*")
+ ;; Note: starting with GLib 2.18 we could use (properties ...)
+ ;; instead, but I don't know if it is possible to branch on version
+ ;; in codegen.
+ (parameters
+ '("GFile*" "file")
+ )
+)
+
+(define-method get_file
+ (of-object "GFileIcon")
+ (c-name "g_file_icon_get_file")
+ (return-type "GFile*")
+)
+
+
+
+;; From gfileinfo.h
+
+(define-function file_info_get_type
+ (c-name "g_file_info_get_type")
+ (return-type "GType")
+)
+
+(define-function file_info_new
+ (c-name "g_file_info_new")
+ (is-constructor-of "GFileInfo")
+ (return-type "GFileInfo*")
+)
+
+(define-method dup
+ (of-object "GFileInfo")
+ (c-name "g_file_info_dup")
+ (return-type "GFileInfo*")
+ (caller-owns-return #t)
+)
+
+(define-method copy_into
+ (of-object "GFileInfo")
+ (c-name "g_file_info_copy_into")
+ (return-type "none")
+ (parameters
+ '("GFileInfo*" "dest_info")
+ )
+)
+
+(define-method has_attribute
+ (of-object "GFileInfo")
+ (c-name "g_file_info_has_attribute")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method has_namespace
+ (of-object "GFileInfo")
+ (c-name "g_file_info_has_namespace")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "name_space")
+ )
+)
+
+;;
+;; wrapped in gfileinfo.override
+(define-method list_attributes
+ (docstring
+ "INFO.list_attributes(name_space) -> Attribute list\n\n"
+ "Lists the file info structure's attributes."
+ )
+ (of-object "GFileInfo")
+ (c-name "g_file_info_list_attributes")
+ (return-type "char**")
+ (parameters
+ '("const-char*" "name_space")
+ )
+)
+
+(define-method get_attribute_data
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_data")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("GFileAttributeType*" "type")
+ '("gpointer*" "value_pp")
+ '("GFileAttributeStatus*" "status")
+ )
+)
+
+(define-method get_attribute_type
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_type")
+ (return-type "GFileAttributeType")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method remove_attribute
+ (of-object "GFileInfo")
+ (c-name "g_file_info_remove_attribute")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_status
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_status")
+ (return-type "GFileAttributeStatus")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method set_attribute_status
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_status")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ '("GFileAttributeStatus" "status")
+ )
+)
+
+(define-method get_attribute_as_string
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_as_string")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_string
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_string")
+ (return-type "const-char*")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_byte_string
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_byte_string")
+ (return-type "const-char*")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_boolean
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_boolean")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_uint32
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_uint32")
+ (return-type "guint32")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_int32
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_int32")
+ (return-type "gint32")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_uint64
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_uint64")
+ (return-type "guint64")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_int64
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_int64")
+ (return-type "gint64")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_object
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_object")
+ (return-type "GObject*")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method get_attribute_stringv
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_attribute_stringv")
+ (return-type "char**")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method set_attribute
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("GFileAttributeType" "type")
+ '("gpointer" "value_p")
+ )
+)
+
+(define-method set_attribute_string
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_string")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("const-char*" "attr_value")
+ )
+)
+
+(define-method set_attribute_byte_string
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_byte_string")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("const-char*" "attr_value")
+ )
+)
+
+(define-method set_attribute_boolean
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_boolean")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("gboolean" "attr_value")
+ )
+)
+
+(define-method set_attribute_uint32
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_uint32")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("guint32" "attr_value")
+ )
+)
+
+(define-method set_attribute_int32
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_int32")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("gint32" "attr_value")
+ )
+)
+
+(define-method set_attribute_uint64
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_uint64")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("guint64" "attr_value")
+ )
+)
+
+(define-method set_attribute_int64
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_int64")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("gint64" "attr_value")
+ )
+)
+
+(define-method set_attribute_object
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_object")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attribute")
+ '("GObject*" "attr_value")
+ )
+)
+
+(define-method clear_status
+ (of-object "GFileInfo")
+ (c-name "g_file_info_clear_status")
+ (return-type "none")
+)
+
+(define-method get_file_type
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_file_type")
+ (return-type "GFileType")
+)
+
+(define-method get_is_hidden
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_is_hidden")
+ (return-type "gboolean")
+)
+
+(define-method get_is_backup
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_is_backup")
+ (return-type "gboolean")
+)
+
+(define-method get_is_symlink
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_is_symlink")
+ (return-type "gboolean")
+)
+
+(define-method get_name
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_name")
+ (return-type "const-char*")
+)
+
+(define-method get_display_name
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_display_name")
+ (return-type "const-char*")
+)
+
+(define-method get_edit_name
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_edit_name")
+ (return-type "const-char*")
+)
+
+(define-method get_icon
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_icon")
+ (return-type "GIcon*")
+)
+
+(define-method get_content_type
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_content_type")
+ (return-type "const-char*")
+)
+
+(define-method get_size
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_size")
+ (return-type "goffset")
+)
+
+;;
+;; wrapped in gfileinfo.override
+;;
+(define-method get_modification_time
+ (docstring
+"INFO.get_modification_time() -> modification time\n"
+"Returns the modification time, in UNIX time format\n")
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_modification_time")
+ (return-type "none")
+ (parameters
+ '("GTimeVal*" "result")
+ )
+)
+
+(define-method get_symlink_target
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_symlink_target")
+ (return-type "const-char*")
+)
+
+(define-method get_etag
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_etag")
+ (return-type "const-char*")
+)
+
+(define-method get_sort_order
+ (of-object "GFileInfo")
+ (c-name "g_file_info_get_sort_order")
+ (return-type "gint32")
+)
+
+(define-method set_attribute_mask
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_attribute_mask")
+ (return-type "none")
+ (parameters
+ '("GFileAttributeMatcher*" "mask")
+ )
+)
+
+(define-method unset_attribute_mask
+ (of-object "GFileInfo")
+ (c-name "g_file_info_unset_attribute_mask")
+ (return-type "none")
+)
+
+(define-method set_file_type
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_file_type")
+ (return-type "none")
+ (parameters
+ '("GFileType" "type")
+ )
+)
+
+(define-method set_is_hidden
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_is_hidden")
+ (return-type "none")
+ (parameters
+ '("gboolean" "is_hidden")
+ )
+)
+
+(define-method set_is_symlink
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_is_symlink")
+ (return-type "none")
+ (parameters
+ '("gboolean" "is_symlink")
+ )
+)
+
+(define-method set_name
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_name")
+ (return-type "none")
+ (parameters
+ '("const-char*" "name")
+ )
+)
+
+(define-method set_display_name
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_display_name")
+ (return-type "none")
+ (parameters
+ '("const-char*" "display_name")
+ )
+)
+
+(define-method set_edit_name
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_edit_name")
+ (return-type "none")
+ (parameters
+ '("const-char*" "edit_name")
+ )
+)
+
+(define-method set_icon
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_icon")
+ (return-type "none")
+ (parameters
+ '("GIcon*" "icon")
+ )
+)
+
+(define-method set_content_type
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_content_type")
+ (return-type "none")
+ (parameters
+ '("const-char*" "content_type")
+ )
+)
+
+(define-method set_size
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_size")
+ (return-type "none")
+ (parameters
+ '("goffset" "size")
+ )
+)
+
+(define-method set_modification_time
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_modification_time")
+ (return-type "none")
+ (parameters
+ '("GTimeVal*" "mtime")
+ )
+)
+
+(define-method set_symlink_target
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_symlink_target")
+ (return-type "none")
+ (parameters
+ '("const-char*" "symlink_target")
+ )
+)
+
+(define-method set_sort_order
+ (of-object "GFileInfo")
+ (c-name "g_file_info_set_sort_order")
+ (return-type "none")
+ (parameters
+ '("gint32" "sort_order")
+ )
+)
+
+(define-function file_attribute_matcher_new
+ (c-name "g_file_attribute_matcher_new")
+ (is-constructor-of "GFileAttributeMatcher")
+ (return-type "GFileAttributeMatcher*")
+ (parameters
+ '("const-char*" "attributes")
+ )
+)
+
+(define-method ref
+ (of-object "GFileAttributeMatcher")
+ (c-name "g_file_attribute_matcher_ref")
+ (return-type "GFileAttributeMatcher*")
+)
+
+(define-method unref
+ (of-object "GFileAttributeMatcher")
+ (c-name "g_file_attribute_matcher_unref")
+ (return-type "none")
+)
+
+(define-method matches
+ (of-object "GFileAttributeMatcher")
+ (c-name "g_file_attribute_matcher_matches")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method matches_only
+ (of-object "GFileAttributeMatcher")
+ (c-name "g_file_attribute_matcher_matches_only")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "attribute")
+ )
+)
+
+(define-method enumerate_namespace
+ (of-object "GFileAttributeMatcher")
+ (c-name "g_file_attribute_matcher_enumerate_namespace")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "ns")
+ )
+)
+
+(define-method enumerate_next
+ (of-object "GFileAttributeMatcher")
+ (c-name "g_file_attribute_matcher_enumerate_next")
+ (return-type "const-char*")
+)
+
+
+
+;; From gfileinputstream.h
+
+(define-function file_input_stream_get_type
+ (c-name "g_file_input_stream_get_type")
+ (return-type "GType")
+)
+
+(define-method query_info
+ (of-object "GFileInputStream")
+ (c-name "g_file_input_stream_query_info")
+ (return-type "GFileInfo*")
+ (parameters
+ '("char*" "attributes")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method query_info_async
+ (of-object "GFileInputStream")
+ (c-name "g_file_input_stream_query_info_async")
+ (return-type "none")
+ (parameters
+ '("char*" "attributes")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method query_info_finish
+ (of-object "GFileInputStream")
+ (c-name "g_file_input_stream_query_info_finish")
+ (return-type "GFileInfo*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gfileiostream.h
+
+(define-function file_io_stream_get_type
+ (c-name "g_file_io_stream_get_type")
+ (return-type "GType")
+)
+
+(define-method query_info
+ (of-object "GFileIOStream")
+ (c-name "g_file_io_stream_query_info")
+ (return-type "GFileInfo*")
+ (parameters
+ '("const-char*" "attributes")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method query_info_async
+ (of-object "GFileIOStream")
+ (c-name "g_file_io_stream_query_info_async")
+ (return-type "none")
+ (parameters
+ '("const-char*" "attributes")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method query_info_finish
+ (of-object "GFileIOStream")
+ (c-name "g_file_io_stream_query_info_finish")
+ (return-type "GFileInfo*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_etag
+ (of-object "GFileIOStream")
+ (c-name "g_file_io_stream_get_etag")
+ (return-type "char*")
+)
+
+
+
+
+;; From gfilemonitor.h
+
+(define-function file_monitor_get_type
+ (c-name "g_file_monitor_get_type")
+ (return-type "GType")
+)
+
+(define-method cancel
+ (of-object "GFileMonitor")
+ (c-name "g_file_monitor_cancel")
+ (return-type "gboolean")
+)
+
+(define-method is_cancelled
+ (of-object "GFileMonitor")
+ (c-name "g_file_monitor_is_cancelled")
+ (return-type "gboolean")
+)
+
+(define-method set_rate_limit
+ (of-object "GFileMonitor")
+ (c-name "g_file_monitor_set_rate_limit")
+ (return-type "none")
+ (parameters
+ '("int" "limit_msecs")
+ )
+)
+
+(define-method emit_event
+ (of-object "GFileMonitor")
+ (c-name "g_file_monitor_emit_event")
+ (return-type "none")
+ (parameters
+ '("GFile*" "file")
+ '("GFile*" "other_file")
+ '("GFileMonitorEvent" "event_type")
+ )
+)
+
+
+
+;; From gfilenamecompleter.h
+
+(define-function filename_completer_get_type
+ (c-name "g_filename_completer_get_type")
+ (return-type "GType")
+)
+
+(define-function filename_completer_new
+ (c-name "g_filename_completer_new")
+ (is-constructor-of "GFilenameCompleter")
+ (return-type "GFilenameCompleter*")
+)
+
+(define-method get_completion_suffix
+ (of-object "GFilenameCompleter")
+ (c-name "g_filename_completer_get_completion_suffix")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "initial_text")
+ )
+)
+
+(define-method get_completions
+ (of-object "GFilenameCompleter")
+ (c-name "g_filename_completer_get_completions")
+ (return-type "char**")
+ (parameters
+ '("const-char*" "initial_text")
+ )
+)
+
+(define-method set_dirs_only
+ (of-object "GFilenameCompleter")
+ (c-name "g_filename_completer_set_dirs_only")
+ (return-type "none")
+ (parameters
+ '("gboolean" "dirs_only")
+ )
+)
+
+
+
+;; From gfileoutputstream.h
+
+(define-function file_output_stream_get_type
+ (c-name "g_file_output_stream_get_type")
+ (return-type "GType")
+)
+
+(define-method query_info
+ (of-object "GFileOutputStream")
+ (c-name "g_file_output_stream_query_info")
+ (return-type "GFileInfo*")
+ (parameters
+ '("char*" "attributes")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method query_info_async
+ (of-object "GFileOutputStream")
+ (c-name "g_file_output_stream_query_info_async")
+ (return-type "none")
+ (parameters
+ '("char*" "attributes")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method query_info_finish
+ (of-object "GFileOutputStream")
+ (c-name "g_file_output_stream_query_info_finish")
+ (return-type "GFileInfo*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_etag
+ (of-object "GFileOutputStream")
+ (c-name "g_file_output_stream_get_etag")
+ (return-type "char*")
+)
+
+
+;; From gfilterinputstream.h
+
+(define-function filter_input_stream_get_type
+ (c-name "g_filter_input_stream_get_type")
+ (return-type "GType")
+)
+
+(define-method get_base_stream
+ (of-object "GFilterInputStream")
+ (c-name "g_filter_input_stream_get_base_stream")
+ (return-type "GInputStream*")
+)
+
+(define-method get_close_base_stream
+ (of-object "GFilterInputStream")
+ (c-name "g_filter_input_stream_get_close_base_stream")
+ (return-type "gboolean")
+)
+
+(define-method set_close_base_stream
+ (of-object "GFilterInputStream")
+ (c-name "g_filter_input_stream_set_close_base_stream")
+ (return-type "none")
+ (parameters
+ '("gboolean" "close_base")
+ )
+)
+
+
+
+;; From gfilteroutputstream.h
+
+(define-function filter_output_stream_get_type
+ (c-name "g_filter_output_stream_get_type")
+ (return-type "GType")
+)
+
+(define-method get_base_stream
+ (of-object "GFilterOutputStream")
+ (c-name "g_filter_output_stream_get_base_stream")
+ (return-type "GOutputStream*")
+)
+
+(define-method get_close_base_stream
+ (of-object "GFilterOutputStream")
+ (c-name "g_filter_output_stream_get_close_base_stream")
+ (return-type "gboolean")
+)
+
+(define-method set_close_base_stream
+ (of-object "GFilterOutputStream")
+ (c-name "g_filter_output_stream_set_close_base_stream")
+ (return-type "none")
+ (parameters
+ '("gboolean" "close_base")
+ )
+)
+
+
+
+;; From gicon.h
+
+(define-function icon_get_type
+ (c-name "g_icon_get_type")
+ (return-type "GType")
+)
+
+(define-function icon_hash
+ (c-name "g_icon_hash")
+ (return-type "guint")
+ (parameters
+ '("gconstpointer" "icon")
+ )
+)
+
+(define-method equal
+ (of-object "GIcon")
+ (c-name "g_icon_equal")
+ (return-type "gboolean")
+ (parameters
+ '("GIcon*" "icon2")
+ )
+)
+
+(define-method to_string
+ (of-object "GIcon")
+ (c-name "g_icon_to_string")
+ (return-type "gchar*")
+)
+
+(define-function icon_new_for_string
+ (c-name "g_icon_new_for_string")
+ (return-type "GIcon*")
+ (parameters
+ '("const-gchar*" "str")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From ginetsocketaddress.h
+
+(define-function inet_socket_address_get_type
+ (c-name "g_inet_socket_address_get_type")
+ (return-type "GType")
+)
+
+(define-function inet_socket_address_new
+ (c-name "g_inet_socket_address_new")
+ (is-constructor-of "GInetSocketAddress")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GInetAddress*" "address")
+ '("guint16" "port")
+ )
+)
+
+(define-method get_address
+ (of-object "GInetSocketAddress")
+ (c-name "g_inet_socket_address_get_address")
+ (return-type "GInetAddress*")
+)
+
+(define-method get_port
+ (of-object "GInetSocketAddress")
+ (c-name "g_inet_socket_address_get_port")
+ (return-type "guint16")
+)
+
+
+
+;; From ginputstream.h
+
+(define-function input_stream_get_type
+ (c-name "g_input_stream_get_type")
+ (return-type "GType")
+)
+
+;;
+;; wrapped in ginputstream.override
+;;
+;; Note: the following two methods are renamed for consistency with
+;; Python file objects' read(). I.e. g_input_stream_read_all() is
+;; more like Python file.read(), so it is renamed read(). Since now
+;; there is a name clash, g_input_stream_read() is renamed
+;; read_part().
+(define-method read_part
+ (of-object "GInputStream")
+ (docstring
+ "STREAM.read_part([count, [cancellable]]) -> string\n"
+ "\n"
+ "Read 'count' bytes from the stream. If 'count' is not specified or is\n"
+ "omitted, read until the end of the stream. This method is allowed to\n"
+ "stop at any time after reading at least 1 byte from the stream. E.g.\n"
+ "when reading over a (relatively slow) HTTP connection, it will often\n"
+ "stop after receiving one packet. Therefore, to reliably read requested\n"
+ "number of bytes, you need to use a loop. See also gio.InputStream.read\n"
+ "for easier to use (though less efficient) method.\n"
+ "\n"
+ "Note: this method roughly corresponds to C GIO g_input_stream_read."
+ )
+ (c-name "g_input_stream_read")
+ (return-type "gssize")
+ (parameters
+ '("void*" "buffer")
+ '("gsize" "count")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in ginputstream.override
+;;
+;; See comments before the previous method definition.
+(define-method read
+ (of-object "GInputStream")
+ (docstring
+ "STREAM.read([count, [cancellable]]) -> string\n"
+ "\n"
+ "Read 'count' bytes from the stream. If 'count' is not specified or is\n"
+ "omitted, read until the end of the stream. This method will stop only\n"
+ "after reading requested number of bytes, reaching end of stream or\n"
+ "triggering an I/O error. See also gio.InputStream.read_part for more\n"
+ "efficient, but more cumbersome to use method.\n"
+ "\n"
+ "Note: this method roughly corresponds to C GIO g_input_stream_read_all.\n"
+ "It was renamed for consistency with Python standard file.read."
+ )
+ (c-name "g_input_stream_read_all")
+ (return-type "gboolean")
+ (parameters
+ '("void*" "buffer")
+ '("gsize" "count")
+ '("gsize*" "bytes_read")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method skip
+ (of-object "GInputStream")
+ (c-name "g_input_stream_skip")
+ (return-type "gssize")
+ (parameters
+ '("gsize" "count")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method close
+ (of-object "GInputStream")
+ (c-name "g_input_stream_close")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in ginputstream.override
+;;
+(define-method read_async
+ (of-object "GInputStream")
+ (c-name "g_input_stream_read_async")
+ (return-type "none")
+ (parameters
+ '("void*" "buffer")
+ '("gsize" "count")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+;;
+;; wrapped in ginputstream.override
+;;
+(define-method read_finish
+ (of-object "GInputStream")
+ (c-name "g_input_stream_read_finish")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method skip_async
+ (of-object "GInputStream")
+ (c-name "g_input_stream_skip_async")
+ (return-type "none")
+ (parameters
+ '("gsize" "count")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method skip_finish
+ (of-object "GInputStream")
+ (c-name "g_input_stream_skip_finish")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in ginputstream.override
+;;
+(define-method close_async
+ (of-object "GInputStream")
+ (c-name "g_input_stream_close_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method close_finish
+ (of-object "GInputStream")
+ (c-name "g_input_stream_close_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method is_closed
+ (of-object "GInputStream")
+ (c-name "g_input_stream_is_closed")
+ (return-type "gboolean")
+)
+
+(define-method has_pending
+ (of-object "GInputStream")
+ (c-name "g_input_stream_has_pending")
+ (return-type "gboolean")
+)
+
+(define-method set_pending
+ (of-object "GInputStream")
+ (c-name "g_input_stream_set_pending")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method clear_pending
+ (of-object "GInputStream")
+ (c-name "g_input_stream_clear_pending")
+ (return-type "none")
+)
+
+
+
+;; From gioalias.h
+
+
+
+;; From gioenumtypes.h
+
+(define-function app_info_create_flags_get_type
+ (c-name "g_app_info_create_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function data_stream_byte_order_get_type
+ (c-name "g_data_stream_byte_order_get_type")
+ (return-type "GType")
+)
+
+(define-function data_stream_newline_type_get_type
+ (c-name "g_data_stream_newline_type_get_type")
+ (return-type "GType")
+)
+
+(define-function file_query_info_flags_get_type
+ (c-name "g_file_query_info_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function file_create_flags_get_type
+ (c-name "g_file_create_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function file_copy_flags_get_type
+ (c-name "g_file_copy_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function file_monitor_flags_get_type
+ (c-name "g_file_monitor_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function file_attribute_type_get_type
+ (c-name "g_file_attribute_type_get_type")
+ (return-type "GType")
+)
+
+(define-function file_attribute_info_flags_get_type
+ (c-name "g_file_attribute_info_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function file_attribute_status_get_type
+ (c-name "g_file_attribute_status_get_type")
+ (return-type "GType")
+)
+
+(define-function file_type_get_type
+ (c-name "g_file_type_get_type")
+ (return-type "GType")
+)
+
+(define-function file_monitor_event_get_type
+ (c-name "g_file_monitor_event_get_type")
+ (return-type "GType")
+)
+
+(define-function io_error_enum_get_type
+ (c-name "g_io_error_enum_get_type")
+ (return-type "GType")
+)
+
+(define-function ask_password_flags_get_type
+ (c-name "g_ask_password_flags_get_type")
+ (return-type "GType")
+)
+
+(define-function password_save_get_type
+ (c-name "g_password_save_get_type")
+ (return-type "GType")
+)
+
+(define-function output_stream_splice_flags_get_type
+ (c-name "g_output_stream_splice_flags_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From gioerror.h
+
+(define-function io_error_quark
+ (c-name "g_io_error_quark")
+ (return-type "GQuark")
+)
+
+(define-function io_error_from_errno
+ (c-name "g_io_error_from_errno")
+ (return-type "GIOErrorEnum")
+ (parameters
+ '("gint" "err_no")
+ )
+)
+
+
+
+;; From gio.h
+
+
+
+;; From gio-marshal.h
+
+
+
+;; From giomodule.h
+
+(define-function io_module_get_type
+ (c-name "g_io_module_get_type")
+ (return-type "GType")
+)
+
+(define-function io_module_new
+ (c-name "g_io_module_new")
+ (is-constructor-of "GIoModule")
+ (return-type "GIOModule*")
+ (parameters
+ '("const-gchar*" "filename")
+ )
+)
+
+(define-function io_modules_load_all_in_directory
+ (c-name "g_io_modules_load_all_in_directory")
+ (return-type "GList*")
+ (parameters
+ '("const-char*" "dirname")
+ )
+)
+
+(define-method load
+ (of-object "GIOModule")
+ (c-name "g_io_module_load")
+ (return-type "none")
+)
+
+(define-method unload
+ (of-object "GIOModule")
+ (c-name "g_io_module_unload")
+ (return-type "none")
+)
+
+
+
+;; From gioscheduler.h
+
+(define-function io_scheduler_push_job
+ (c-name "g_io_scheduler_push_job")
+ (return-type "none")
+ (parameters
+ '("GIOSchedulerJobFunc" "job_func")
+ '("gpointer" "user_data")
+ '("GDestroyNotify" "notify")
+ '("gint" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ )
+)
+
+(define-function io_scheduler_cancel_all_jobs
+ (c-name "g_io_scheduler_cancel_all_jobs")
+ (return-type "none")
+)
+
+(define-method send_to_mainloop
+ (of-object "GIOSchedulerJob")
+ (c-name "g_io_scheduler_job_send_to_mainloop")
+ (return-type "gboolean")
+ (parameters
+ '("GSourceFunc" "func")
+ '("gpointer" "user_data")
+ '("GDestroyNotify" "notify")
+ )
+)
+
+(define-method send_to_mainloop_async
+ (of-object "GIOSchedulerJob")
+ (c-name "g_io_scheduler_job_send_to_mainloop_async")
+ (return-type "none")
+ (parameters
+ '("GSourceFunc" "func")
+ '("gpointer" "user_data")
+ '("GDestroyNotify" "notify")
+ )
+)
+
+
+
+;; From gloadableicon.h
+
+(define-function loadable_icon_get_type
+ (c-name "g_loadable_icon_get_type")
+ (return-type "GType")
+)
+
+;;
+;; wrapped in gicon.override
+;;
+(define-method load
+ (of-object "GLoadableIcon")
+ (docstring
+ "ICON.load([size, [cancellable]]) -> input stream, type\n"
+ "\n"
+ "Opens a stream of icon data for reading. The result is a tuple of\n"
+ "gio.InputStream and type (either a string or None). The stream can\n"
+ "be read to retrieve icon data.\n"
+ "\n"
+ ;; Note: this is just a guess, GIO docs say nothing at the moment.
+ "Optional size is a hint at desired icon size. Not all implementations\n"
+ "support it and the hint will be just ignored in such cases.\n"
+ "If cancellable is specified, then the operation can be cancelled\n"
+ "by triggering the cancellable object from another thread. See\n"
+ "gio.File.read for details."
+ )
+ (c-name "g_loadable_icon_load")
+ (return-type "GInputStream*")
+ (parameters
+ '("int" "size")
+ '("char**" "type")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gicon.override
+;;
+(define-method load_async
+ (of-object "GLoadableIcon")
+ (docstring
+ "ICON.load_async(callback, [size, [cancellable, [user_data]]])\n"
+ "-> start loading\n"
+ "\n"
+ "For more information, see gio.LoadableIcon.load() which is the\n"
+ "synchronous version of this call. Asynchronously opens icon data for\n"
+ "reading. When the operation is finished, callback will be called.\n"
+ "You can then call gio.LoadableIcon.load_finish() to get the result of\n"
+ "the operation.\n"
+ )
+ (c-name "g_loadable_icon_load_async")
+ (return-type "none")
+ (parameters
+ '("int" "size")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+;;
+;; wrapped in gicon.override
+;;
+(define-method load_finish
+ (docstring
+ "F.load_finish(res) -> start loading\n"
+ "\n"
+ "Finish asynchronous icon loading operation. Must be called from callback\n"
+ "as specified to gio.LoadableIcon.load_async. Returns a tuple of\n"
+ "gio.InputStream and type, just as gio.LoadableIcon.load."
+ )
+ (of-object "GLoadableIcon")
+ (c-name "g_loadable_icon_load_finish")
+ (return-type "GInputStream*")
+ (parameters
+ '("GAsyncResult*" "res")
+ '("char**" "type")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From ginetaddress.h
+
+(define-function inet_address_get_type
+ (c-name "g_inet_address_get_type")
+ (return-type "GType")
+)
+
+(define-function inet_address_new_from_string
+ (c-name "g_inet_address_new_from_string")
+ (return-type "GInetAddress*")
+ (parameters
+ '("const-gchar*" "string")
+ )
+)
+
+(define-function inet_address_new_from_bytes
+ (c-name "g_inet_address_new_from_bytes")
+ (return-type "GInetAddress*")
+ (parameters
+ '("const-guint8*" "bytes")
+ '("GSocketFamily" "family")
+ )
+)
+
+(define-function inet_address_new_loopback
+ (c-name "g_inet_address_new_loopback")
+ (return-type "GInetAddress*")
+ (parameters
+ '("GSocketFamily" "family")
+ )
+)
+
+(define-function inet_address_new_any
+ (c-name "g_inet_address_new_any")
+ (return-type "GInetAddress*")
+ (parameters
+ '("GSocketFamily" "family")
+ )
+)
+
+(define-method to_string
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_to_string")
+ (return-type "gchar*")
+)
+
+
+;; FIXME codegen barfs on this one
+;;
+;;(define-method to_bytes
+;; (of-object "GInetAddress")
+;; (c-name "g_inet_address_to_bytes")
+;; (return-type "const-guint8*")
+;;)
+
+(define-method get_native_size
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_native_size")
+ (return-type "gsize")
+)
+
+(define-method get_family
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_family")
+ (return-type "GSocketFamily")
+)
+
+(define-method get_is_any
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_any")
+ (return-type "gboolean")
+)
+
+(define-method get_is_loopback
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_loopback")
+ (return-type "gboolean")
+)
+
+(define-method get_is_link_local
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_link_local")
+ (return-type "gboolean")
+)
+
+(define-method get_is_site_local
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_site_local")
+ (return-type "gboolean")
+)
+
+(define-method get_is_multicast
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_multicast")
+ (return-type "gboolean")
+)
+
+(define-method get_is_mc_global
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_mc_global")
+ (return-type "gboolean")
+)
+
+(define-method get_is_mc_link_local
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_mc_link_local")
+ (return-type "gboolean")
+)
+
+(define-method get_is_mc_node_local
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_mc_node_local")
+ (return-type "gboolean")
+)
+
+(define-method get_is_mc_org_local
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_mc_org_local")
+ (return-type "gboolean")
+)
+
+(define-method get_is_mc_site_local
+ (of-object "GInetAddress")
+ (c-name "g_inet_address_get_is_mc_site_local")
+ (return-type "gboolean")
+)
+
+
+
+;; From ginitable.h
+
+(define-function initable_get_type
+ (c-name "g_initable_get_type")
+ (return-type "GType")
+)
+
+(define-method init
+ (of-object "GInitable")
+ (c-name "g_initable_init")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-function initable_new
+ (c-name "g_initable_new")
+ (return-type "gpointer")
+ (parameters
+ '("GType" "object_type")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ '("const-gchar*" "first_property_name")
+ )
+ (varargs #t)
+)
+
+(define-function initable_newv
+ (c-name "g_initable_newv")
+ (return-type "gpointer")
+ (parameters
+ '("GType" "object_type")
+ '("guint" "n_parameters")
+ '("GParameter*" "parameters")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-function initable_new_valist
+ (c-name "g_initable_new_valist")
+ (return-type "GObject*")
+ (parameters
+ '("GType" "object_type")
+ '("const-gchar*" "first_property_name")
+ '("va_list" "var_args")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From giostream.h
+
+(define-function io_stream_get_type
+ (c-name "g_io_stream_get_type")
+ (return-type "GType")
+)
+
+(define-method get_input_stream
+ (of-object "GIOStream")
+ (c-name "g_io_stream_get_input_stream")
+ (return-type "GInputStream*")
+)
+
+(define-method get_output_stream
+ (of-object "GIOStream")
+ (c-name "g_io_stream_get_output_stream")
+ (return-type "GOutputStream*")
+)
+
+(define-method close
+ (of-object "GIOStream")
+ (c-name "g_io_stream_close")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method close_async
+ (of-object "GIOStream")
+ (c-name "g_io_stream_close_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method close_finish
+ (of-object "GIOStream")
+ (c-name "g_io_stream_close_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method is_closed
+ (of-object "GIOStream")
+ (c-name "g_io_stream_is_closed")
+ (return-type "gboolean")
+)
+
+(define-method has_pending
+ (of-object "GIOStream")
+ (c-name "g_io_stream_has_pending")
+ (return-type "gboolean")
+)
+
+(define-method set_pending
+ (of-object "GIOStream")
+ (c-name "g_io_stream_set_pending")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method clear_pending
+ (of-object "GIOStream")
+ (c-name "g_io_stream_clear_pending")
+ (return-type "none")
+)
+
+
+
+;; From glocaldirectorymonitor.h
+
+(define-function local_directory_monitor_get_type
+ (c-name "g_local_directory_monitor_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From glocalfileenumerator.h
+
+
+
+;; From glocalfile.h
+
+
+
+;; From glocalfileinfo.h
+
+
+
+;; From glocalfileinputstream.h
+
+
+
+;; From glocalfilemonitor.h
+
+(define-function local_file_monitor_get_type
+ (c-name "g_local_file_monitor_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From glocalfileoutputstream.h
+
+
+
+;; From glocalvfs.h
+
+
+
+;; From gmemoryinputstream.h
+
+(define-function memory_input_stream_get_type
+ (c-name "g_memory_input_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function memory_input_stream_new
+ (c-name "g_memory_input_stream_new")
+ (is-constructor-of "GMemoryInputStream")
+ (return-type "GInputStream*")
+)
+
+(define-function memory_input_stream_new_from_data
+ (c-name "g_memory_input_stream_new_from_data")
+ (return-type "GInputStream*")
+ (parameters
+ '("const-void*" "data")
+ '("gssize" "len")
+ '("GDestroyNotify" "destroy")
+ )
+)
+
+;;
+;; wrapped in ginputstream.override
+;;
+(define-method add_data
+ (of-object "GMemoryInputStream")
+ (c-name "g_memory_input_stream_add_data")
+ (return-type "none")
+ (parameters
+ '("const-void*" "data")
+ '("gssize" "len")
+ '("GDestroyNotify" "destroy")
+ )
+)
+
+
+
+;; From gmemoryoutputstream.h
+
+(define-function memory_output_stream_get_type
+ (c-name "g_memory_output_stream_get_type")
+ (return-type "GType")
+)
+
+;;
+;; wrapped in goutputstream.override
+;;
+(define-function memory_output_stream_new
+ (c-name "g_memory_output_stream_new")
+ (is-constructor-of "GMemoryOutputStream")
+ (return-type "GOutputStream*")
+ (parameters
+ '("gpointer" "data")
+ '("gsize" "len")
+ '("GReallocFunc" "realloc_fn")
+ '("GDestroyNotify" "destroy")
+ )
+)
+
+;;
+;; wrapped in goutputstream.override
+;;
+;; Note: name clash with gobject.GObject.get_data; renamed.
+(define-method get_contents
+ (of-object "GMemoryOutputStream")
+ (c-name "g_memory_output_stream_get_data")
+ (return-type "gpointer")
+)
+
+(define-method get_size
+ (of-object "GMemoryOutputStream")
+ (c-name "g_memory_output_stream_get_size")
+ (return-type "gsize")
+)
+
+(define-method get_data_size
+ (of-object "GMemoryOutputStream")
+ (c-name "g_memory_output_stream_get_data_size")
+ (return-type "gsize")
+)
+
+
+
+;; From gmount.h
+
+(define-function mount_get_type
+ (c-name "g_mount_get_type")
+ (return-type "GType")
+)
+
+(define-method get_root
+ (of-object "GMount")
+ (c-name "g_mount_get_root")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+)
+
+(define-method get_name
+ (of-object "GMount")
+ (c-name "g_mount_get_name")
+ (return-type "char*")
+)
+
+(define-method get_icon
+ (of-object "GMount")
+ (c-name "g_mount_get_icon")
+ (return-type "GIcon*")
+ (caller-owns-return #t)
+)
+
+(define-method get_uuid
+ (of-object "GMount")
+ (c-name "g_mount_get_uuid")
+ (return-type "char*")
+)
+
+(define-method get_volume
+ (of-object "GMount")
+ (c-name "g_mount_get_volume")
+ (return-type "GVolume*")
+ (caller-owns-return #t)
+)
+
+(define-method get_drive
+ (of-object "GMount")
+ (c-name "g_mount_get_drive")
+ (return-type "GDrive*")
+ (caller-owns-return #t)
+)
+
+(define-method can_unmount
+ (of-object "GMount")
+ (c-name "g_mount_can_unmount")
+ (return-type "gboolean")
+)
+
+(define-method can_eject
+ (of-object "GMount")
+ (c-name "g_mount_can_eject")
+ (return-type "gboolean")
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-method unmount
+ (docstring
+"M.unmount(callback, [flags, cancellable, user_data])\n"
+"Unmounts a mount. This is an asynchronous operation, and is finished\n"
+"by calling gio.Mount.unmount_finish() with the mount and gio.AsyncResults\n"
+"data returned in the callback."
+)
+ (of-object "GMount")
+ (c-name "g_mount_unmount")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method unmount_finish
+ (of-object "GMount")
+ (c-name "g_mount_unmount_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-method eject
+ (docstring
+"F.eject(callback, [flags, cancellable, user_data])\n"
+"Ejects a volume.\n"
+"\n"
+"If cancellable is not None, then the operation can be cancelled by\n"
+"triggering the cancellable object from another thread. If the\n"
+"operation was cancelled, the error gio.ERROR_CANCELLED will be returned.\n"
+"\n"
+"When the operation is finished, callback will be called. You can\n"
+"then call gio.Volume.eject_finish() to get the result of the operation.\n")
+ (of-object "GMount")
+ (c-name "g_mount_eject")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_finish
+ (of-object "GMount")
+ (c-name "g_mount_eject_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-method remount
+ (of-object "GMount")
+ (docstring
+ "M.remount(callback, [flags, [mount_operation, [cancellable, [user_data]]]])\n"
+ "Remounts a mount. This is an asynchronous operation, and is finished by\n"
+ "calling gio.Mount.remount_finish with the mount and gio.AsyncResults data\n"
+ "returned in the callback.")
+ (c-name "g_mount_remount")
+ (return-type "none")
+ (parameters
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method remount_finish
+ (of-object "GMount")
+ (c-name "g_mount_remount_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method guess_content_type
+ (of-object "GMount")
+ (c-name "g_mount_guess_content_type")
+ (return-type "none")
+ (parameters
+ '("gboolean" "force_rescan")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method guess_content_type_finish
+ (of-object "GMount")
+ (c-name "g_mount_guess_content_type_finish")
+ (return-type "gchar**")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method guess_content_type_sync
+ (of-object "GMount")
+ (c-name "g_mount_guess_content_type_sync")
+ (return-type "gchar**")
+ (parameters
+ '("gboolean" "force_rescan")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method is_shadowed
+ (of-object "GMount")
+ (c-name "g_mount_is_shadowed")
+ (return-type "gboolean")
+)
+
+(define-method shadow
+ (of-object "GMount")
+ (c-name "g_mount_shadow")
+ (return-type "none")
+)
+
+(define-method unshadow
+ (of-object "GMount")
+ (c-name "g_mount_unshadow")
+ (return-type "none")
+)
+
+(define-method unmount_with_operation
+ (of-object "GMount")
+ (c-name "g_mount_unmount_with_operation")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method unmount_with_operation_finish
+ (of-object "GMount")
+ (c-name "g_mount_unmount_with_operation_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method eject_with_operation
+ (of-object "GMount")
+ (c-name "g_mount_eject_with_operation")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_with_operation_finish
+ (of-object "GMount")
+ (c-name "g_mount_eject_with_operation_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gmountoperation.h
+
+(define-function mount_operation_get_type
+ (c-name "g_mount_operation_get_type")
+ (return-type "GType")
+)
+
+(define-function mount_operation_new
+ (c-name "g_mount_operation_new")
+ (is-constructor-of "GMountOperation")
+ (return-type "GMountOperation*")
+)
+
+(define-method get_username
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_get_username")
+ (return-type "const-char*")
+)
+
+(define-method set_username
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_set_username")
+ (return-type "none")
+ (parameters
+ '("const-char*" "username")
+ )
+)
+
+(define-method get_password
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_get_password")
+ (return-type "const-char*")
+)
+
+(define-method set_password
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_set_password")
+ (return-type "none")
+ (parameters
+ '("const-char*" "password")
+ )
+)
+
+(define-method get_anonymous
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_get_anonymous")
+ (return-type "gboolean")
+)
+
+(define-method set_anonymous
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_set_anonymous")
+ (return-type "none")
+ (parameters
+ '("gboolean" "anonymous")
+ )
+)
+
+(define-method get_domain
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_get_domain")
+ (return-type "const-char*")
+)
+
+(define-method set_domain
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_set_domain")
+ (return-type "none")
+ (parameters
+ '("const-char*" "domain")
+ )
+)
+
+(define-method get_password_save
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_get_password_save")
+ (return-type "GPasswordSave")
+)
+
+(define-method set_password_save
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_set_password_save")
+ (return-type "none")
+ (parameters
+ '("GPasswordSave" "save")
+ )
+)
+
+(define-method get_choice
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_get_choice")
+ (return-type "int")
+)
+
+(define-method set_choice
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_set_choice")
+ (return-type "none")
+ (parameters
+ '("int" "choice")
+ )
+)
+
+(define-method reply
+ (of-object "GMountOperation")
+ (c-name "g_mount_operation_reply")
+ (return-type "none")
+ (parameters
+ '("GMountOperationResult" "result")
+ )
+)
+
+
+
+;; From gnativevolumemonitor.h
+
+(define-function native_volume_monitor_get_type
+ (c-name "g_native_volume_monitor_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From gnetworkaddress.h
+
+(define-function network_address_get_type
+ (c-name "g_network_address_get_type")
+ (return-type "GType")
+)
+
+(define-function network_address_new
+ (c-name "g_network_address_new")
+ (is-constructor-of "GNetworkAddress")
+ (return-type "GSocketConnectable*")
+ (parameters
+ '("const-gchar*" "hostname")
+ '("guint16" "port")
+ )
+)
+
+(define-function network_address_parse
+ (c-name "g_network_address_parse")
+ (return-type "GSocketConnectable*")
+ (parameters
+ '("const-gchar*" "host_and_port")
+ '("guint16" "default_port")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_hostname
+ (of-object "GNetworkAddress")
+ (c-name "g_network_address_get_hostname")
+ (return-type "const-gchar*")
+)
+
+(define-method get_port
+ (of-object "GNetworkAddress")
+ (c-name "g_network_address_get_port")
+ (return-type "guint16")
+)
+
+
+
+;; From gnetworkservice.h
+
+(define-function network_service_get_type
+ (c-name "g_network_service_get_type")
+ (return-type "GType")
+)
+
+(define-function network_service_new
+ (c-name "g_network_service_new")
+ (is-constructor-of "GNetworkService")
+ (return-type "GSocketConnectable*")
+ (parameters
+ '("const-gchar*" "service")
+ '("const-gchar*" "protocol")
+ '("const-gchar*" "domain")
+ )
+)
+
+(define-method get_service
+ (of-object "GNetworkService")
+ (c-name "g_network_service_get_service")
+ (return-type "const-gchar*")
+)
+
+(define-method get_protocol
+ (of-object "GNetworkService")
+ (c-name "g_network_service_get_protocol")
+ (return-type "const-gchar*")
+)
+
+(define-method get_domain
+ (of-object "GNetworkService")
+ (c-name "g_network_service_get_domain")
+ (return-type "const-gchar*")
+)
+
+
+
+;; From goutputstream.h
+
+(define-function output_stream_get_type
+ (c-name "g_output_stream_get_type")
+ (return-type "GType")
+)
+
+;;
+;; wrapped in goutputstream.override
+;;
+;; Note: the following two methods are renamed for consistency with
+;; Python file objects' write(). I.e. g_output_stream_write_all() is
+;; more like Python file.write(), so it is renamed write(). Since now
+;; there is a name clash, g_output_stream_write() is renamed
+;; write_part().
+(define-method write_part
+ (of-object "GOutputStream")
+ (docstring
+ "STREAM.write_part(buffer, [cancellable]) -> int\n"
+ "\n"
+ "Write the bytes in 'buffer' to the stream. Return the number of bytes\n"
+ "successfully written. This method is allowed to stop at any time after\n"
+ "writing at least 1 byte. Therefore, to reliably write the whole buffer,\n"
+ "you need to use a loop. See also gio.OutputStream.write for easier to\n"
+ "use (though less efficient) method.\n"
+ "\n"
+ "Note: this method roughly corresponds to C GIO g_output_stream_write."
+ )
+ (c-name "g_output_stream_write")
+ (return-type "gssize")
+ (parameters
+ '("const-void*" "buffer")
+ '("gsize" "count")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in goutputstream.override
+;;
+;; See comments before the previous method definition.
+(define-method write
+ (of-object "GOutputStream")
+ "STREAM.write(buffer, [cancellable]) -> int\n"
+ "\n"
+ "Write the bytes in 'buffer' to the stream. Return the number of bytes\n"
+ "successfully written. This method will stop only after writing the whole\n"
+ "buffer or triggering an I/O error. See also gio.OutputStream.write_part\n"
+ "for more efficient, but more cumbersome to use method.\n"
+ "\n"
+ "Note: this method roughly corresponds to C GIO g_output_stream_write_all.\n"
+ "It was renamed for consistency with Python standard file.write."
+ (c-name "g_output_stream_write_all")
+ (return-type "gboolean")
+ (parameters
+ '("const-void*" "buffer")
+ '("gsize" "count")
+ '("gsize*" "bytes_written")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method splice
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_splice")
+ (return-type "gssize")
+ (parameters
+ '("GInputStream*" "source")
+ '("GOutputStreamSpliceFlags" "flags" (default "G_OUTPUT_STREAM_SPLICE_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method flush
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_flush")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method close
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_close")
+ (return-type "gboolean")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in goutputstream.override
+;;
+(define-method write_async
+ (of-object "GOutputStream")
+ (docstring
+"S.write_async(buffer, callback [,io_priority] [,cancellable] [,user_data])\n"
+"\n"
+"Request an asynchronous write of count bytes from buffer into the stream.\n"
+"When the operation is finished callback will be called. You can then call\n"
+"gio.OutputStream.write_finish() to get the result of the operation.\n"
+"On success, the number of bytes written will be passed to the callback.\n"
+"It is not an error if this is not the same as the requested size, as it can\n"
+"happen e.g. on a partial I/O error, but generally tries to write as many \n"
+"bytes as requested.\n"
+"For the synchronous, blocking version of this function, see\n"
+"gio.OutputStream.write().\n")
+ (c-name "g_output_stream_write_async")
+ (return-type "none")
+ (parameters
+ '("const-void*" "buffer")
+ '("gsize" "count")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method write_finish
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_write_finish")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method splice_async
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_splice_async")
+ (return-type "none")
+ (parameters
+ '("GInputStream*" "source")
+ '("GOutputStreamSpliceFlags" "flags" (default "G_OUTPUT_STREAM_SPLICE_NONE"))
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method splice_finish
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_splice_finish")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method flush_async
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_flush_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method flush_finish
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_flush_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in goutputstream.override
+;;
+(define-method close_async
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_close_async")
+ (return-type "none")
+ (parameters
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method close_finish
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_close_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method is_closed
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_is_closed")
+ (return-type "gboolean")
+)
+
+(define-method has_pending
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_has_pending")
+ (return-type "gboolean")
+)
+
+(define-method set_pending
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_set_pending")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method clear_pending
+ (of-object "GOutputStream")
+ (c-name "g_output_stream_clear_pending")
+ (return-type "none")
+)
+
+
+
+;; From gresolver.h
+
+(define-function resolver_get_type
+ (c-name "g_resolver_get_type")
+ (return-type "GType")
+)
+
+(define-function resolver_get_default
+ (c-name "g_resolver_get_default")
+ (return-type "GResolver*")
+)
+
+(define-method set_default
+ (of-object "GResolver")
+ (c-name "g_resolver_set_default")
+ (return-type "none")
+)
+
+(define-method lookup_by_name
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_by_name")
+ (return-type "GList*")
+ (parameters
+ '("const-gchar*" "hostname")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method lookup_by_name_async
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_by_name_async")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "hostname")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method lookup_by_name_finish
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_by_name_finish")
+ (return-type "GList*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-function resolver_free_addresses
+ (c-name "g_resolver_free_addresses")
+ (return-type "none")
+ (parameters
+ '("GList*" "addresses")
+ )
+)
+
+(define-method lookup_by_address
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_by_address")
+ (return-type "gchar*")
+ (parameters
+ '("GInetAddress*" "address")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method lookup_by_address_async
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_by_address_async")
+ (return-type "none")
+ (parameters
+ '("GInetAddress*" "address")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method lookup_by_address_finish
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_by_address_finish")
+ (return-type "gchar*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method lookup_service
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_service")
+ (return-type "GList*")
+ (parameters
+ '("const-gchar*" "service")
+ '("const-gchar*" "protocol")
+ '("const-gchar*" "domain")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method lookup_service_async
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_service_async")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "service")
+ '("const-gchar*" "protocol")
+ '("const-gchar*" "domain")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method lookup_service_finish
+ (of-object "GResolver")
+ (c-name "g_resolver_lookup_service_finish")
+ (return-type "GList*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-function resolver_free_targets
+ (c-name "g_resolver_free_targets")
+ (return-type "none")
+ (parameters
+ '("GList*" "targets")
+ )
+)
+
+(define-function resolver_error_quark
+ (c-name "g_resolver_error_quark")
+ (return-type "GQuark")
+)
+
+
+
+;; From gseekable.h
+
+(define-function seekable_get_type
+ (c-name "g_seekable_get_type")
+ (return-type "GType")
+)
+
+(define-method tell
+ (of-object "GSeekable")
+ (c-name "g_seekable_tell")
+ (return-type "goffset")
+)
+
+(define-method can_seek
+ (of-object "GSeekable")
+ (c-name "g_seekable_can_seek")
+ (return-type "gboolean")
+)
+
+(define-method seek
+ (of-object "GSeekable")
+ (c-name "g_seekable_seek")
+ (return-type "gboolean")
+ (parameters
+ '("goffset" "offset")
+ '("GSeekType" "type" (default "G_SEEK_SET"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method can_truncate
+ (of-object "GSeekable")
+ (c-name "g_seekable_can_truncate")
+ (return-type "gboolean")
+)
+
+(define-method truncate
+ (of-object "GSeekable")
+ (c-name "g_seekable_truncate")
+ (return-type "gboolean")
+ (parameters
+ '("goffset" "offset")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gsimpleasyncresult.h
+
+(define-function simple_async_result_get_type
+ (c-name "g_simple_async_result_get_type")
+ (return-type "GType")
+)
+
+(define-function simple_async_result_new
+ (c-name "g_simple_async_result_new")
+ (is-constructor-of "GSimpleAsyncResult")
+ (return-type "GSimpleAsyncResult*")
+ (parameters
+ '("GObject*" "source_object")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ '("gpointer" "source_tag")
+ )
+)
+
+(define-function simple_async_result_new_error
+ (c-name "g_simple_async_result_new_error")
+ (return-type "GSimpleAsyncResult*")
+ (parameters
+ '("GObject*" "source_object")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ '("GQuark" "domain")
+ '("gint" "code")
+ '("const-char*" "format")
+ )
+ (varargs #t)
+)
+
+(define-function simple_async_result_new_from_error
+ (c-name "g_simple_async_result_new_from_error")
+ (return-type "GSimpleAsyncResult*")
+ (parameters
+ '("GObject*" "source_object")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ '("GError*" "error")
+ )
+)
+
+(define-method set_op_res_gpointer
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_op_res_gpointer")
+ (return-type "none")
+ (parameters
+ '("gpointer" "op_res")
+ '("GDestroyNotify" "destroy_op_res")
+ )
+)
+
+(define-method get_op_res_gpointer
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_get_op_res_gpointer")
+ (return-type "gpointer")
+)
+
+(define-method set_op_res_gssize
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_op_res_gssize")
+ (return-type "none")
+ (parameters
+ '("gssize" "op_res")
+ )
+)
+
+(define-method get_op_res_gssize
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_get_op_res_gssize")
+ (return-type "gssize")
+)
+
+(define-method set_op_res_gboolean
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_op_res_gboolean")
+ (return-type "none")
+ (parameters
+ '("gboolean" "op_res")
+ )
+)
+
+(define-method get_op_res_gboolean
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_get_op_res_gboolean")
+ (return-type "gboolean")
+)
+
+(define-method get_source_tag
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_get_source_tag")
+ (return-type "gpointer")
+)
+
+(define-method set_handle_cancellation
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_handle_cancellation")
+ (return-type "none")
+ (parameters
+ '("gboolean" "handle_cancellation")
+ )
+)
+
+(define-method complete
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_complete")
+ (return-type "none")
+)
+
+(define-method complete_in_idle
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_complete_in_idle")
+ (return-type "none")
+)
+
+(define-method run_in_thread
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_run_in_thread")
+ (return-type "none")
+ (parameters
+ '("GSimpleAsyncThreadFunc" "func")
+ '("int" "io_priority" (default "G_PRIORITY_DEFAULT"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ )
+)
+
+(define-method set_from_error
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_from_error")
+ (return-type "none")
+ (parameters
+ '("GError*" "error")
+ )
+)
+
+(define-method propagate_error
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_propagate_error")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "dest")
+ )
+)
+
+(define-method set_error
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_error")
+ (return-type "none")
+ (parameters
+ '("GQuark" "domain")
+ '("gint" "code")
+ '("const-char*" "format")
+ )
+ (varargs #t)
+)
+
+(define-method set_error_va
+ (of-object "GSimpleAsyncResult")
+ (c-name "g_simple_async_result_set_error_va")
+ (return-type "none")
+ (parameters
+ '("GQuark" "domain")
+ '("gint" "code")
+ '("const-char*" "format")
+ '("va_list" "args")
+ )
+)
+
+(define-function simple_async_report_error_in_idle
+ (c-name "g_simple_async_report_error_in_idle")
+ (return-type "none")
+ (parameters
+ '("GObject*" "object")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ '("GQuark" "domain")
+ '("gint" "code")
+ '("const-char*" "format")
+ )
+ (varargs #t)
+)
+
+(define-function simple_async_report_gerror_in_idle
+ (c-name "g_simple_async_report_gerror_in_idle")
+ (return-type "none")
+ (parameters
+ '("GObject*" "object")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ '("GError*" "error")
+ )
+)
+
+
+
+;; From gsocketaddressenumerator.h
+
+(define-function socket_address_enumerator_get_type
+ (c-name "g_socket_address_enumerator_get_type")
+ (return-type "GType")
+)
+
+(define-method next
+ (of-object "GSocketAddressEnumerator")
+ (c-name "g_socket_address_enumerator_next")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method next_async
+ (of-object "GSocketAddressEnumerator")
+ (c-name "g_socket_address_enumerator_next_async")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method next_finish
+ (of-object "GSocketAddressEnumerator")
+ (c-name "g_socket_address_enumerator_next_finish")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gsocketaddress.h
+
+(define-function socket_address_get_type
+ (c-name "g_socket_address_get_type")
+ (return-type "GType")
+)
+
+(define-method get_family
+ (of-object "GSocketAddress")
+ (c-name "g_socket_address_get_family")
+ (return-type "GSocketFamily")
+)
+
+(define-function socket_address_new_from_native
+ (c-name "g_socket_address_new_from_native")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("gpointer" "native")
+ '("gsize" "len")
+ )
+)
+
+(define-method to_native
+ (of-object "GSocketAddress")
+ (c-name "g_socket_address_to_native")
+ (return-type "gboolean")
+ (parameters
+ '("gpointer" "dest")
+ '("gsize" "destlen")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_native_size
+ (of-object "GSocketAddress")
+ (c-name "g_socket_address_get_native_size")
+ (return-type "gssize")
+)
+
+
+
+;; From gsocketclient.h
+
+(define-function socket_client_get_type
+ (c-name "g_socket_client_get_type")
+ (return-type "GType")
+)
+
+(define-function socket_client_new
+ (c-name "g_socket_client_new")
+ (is-constructor-of "GSocketClient")
+ (return-type "GSocketClient*")
+)
+
+(define-method get_family
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_get_family")
+ (return-type "GSocketFamily")
+)
+
+(define-method set_family
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_set_family")
+ (return-type "none")
+ (parameters
+ '("GSocketFamily" "family")
+ )
+)
+
+(define-method get_socket_type
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_get_socket_type")
+ (return-type "GSocketType")
+)
+
+(define-method set_socket_type
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_set_socket_type")
+ (return-type "none")
+ (parameters
+ '("GSocketType" "type")
+ )
+)
+
+(define-method get_protocol
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_get_protocol")
+ (return-type "GSocketProtocol")
+)
+
+(define-method set_protocol
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_set_protocol")
+ (return-type "none")
+ (parameters
+ '("GSocketProtocol" "protocol")
+ )
+)
+
+(define-method get_local_address
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_get_local_address")
+ (return-type "GSocketAddress*")
+)
+
+(define-method set_local_address
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_set_local_address")
+ (return-type "none")
+ (parameters
+ '("GSocketAddress*" "address")
+ )
+)
+
+(define-method connect
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("GSocketConnectable*" "connectable")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method connect_to_host
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_to_host")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("const-gchar*" "host_and_port")
+ '("guint16" "default_port")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method connect_to_service
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_to_service")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("const-gchar*" "domain")
+ '("const-gchar*" "service")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method connect_async
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_async")
+ (return-type "none")
+ (parameters
+ '("GSocketConnectable*" "connectable")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method connect_finish
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_finish")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method connect_to_host_async
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_to_host_async")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "host_and_port")
+ '("guint16" "default_port")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method connect_to_host_finish
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_to_host_finish")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+(define-method connect_to_service_async
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_to_service_async")
+ (return-type "none")
+ (parameters
+ '("const-gchar*" "domain")
+ '("const-gchar*" "service")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method connect_to_service_finish
+ (of-object "GSocketClient")
+ (c-name "g_socket_client_connect_to_service_finish")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gsocketconnectable.h
+
+(define-function socket_connectable_get_type
+ (c-name "g_socket_connectable_get_type")
+ (return-type "GType")
+)
+
+(define-method enumerate
+ (of-object "GSocketConnectable")
+ (c-name "g_socket_connectable_enumerate")
+ (return-type "GSocketAddressEnumerator*")
+)
+
+
+
+;; From gsocketconnection.h
+
+(define-function socket_connection_get_type
+ (c-name "g_socket_connection_get_type")
+ (return-type "GType")
+)
+
+(define-method get_socket
+ (of-object "GSocketConnection")
+ (c-name "g_socket_connection_get_socket")
+ (return-type "GSocket*")
+)
+
+(define-method get_local_address
+ (of-object "GSocketConnection")
+ (c-name "g_socket_connection_get_local_address")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method get_remote_address
+ (of-object "GSocketConnection")
+ (c-name "g_socket_connection_get_remote_address")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-function socket_connection_factory_register_type
+ (c-name "g_socket_connection_factory_register_type")
+ (return-type "none")
+ (parameters
+ '("GType" "g_type")
+ '("GSocketFamily" "family")
+ '("GSocketType" "type")
+ '("gint" "protocol")
+ )
+)
+
+(define-function socket_connection_factory_lookup_type
+ (c-name "g_socket_connection_factory_lookup_type")
+ (return-type "GType")
+ (parameters
+ '("GSocketFamily" "family")
+ '("GSocketType" "type")
+ '("gint" "protocol_id")
+ )
+)
+
+(define-method connection_factory_create_connection
+ (of-object "GSocket")
+ (c-name "g_socket_connection_factory_create_connection")
+ (return-type "GSocketConnection*")
+)
+
+
+
+;; From gsocketcontrolmessage.h
+
+(define-function socket_control_message_get_type
+ (c-name "g_socket_control_message_get_type")
+ (return-type "GType")
+)
+
+(define-method get_size
+ (of-object "GSocketControlMessage")
+ (c-name "g_socket_control_message_get_size")
+ (return-type "gsize")
+)
+
+(define-method get_level
+ (of-object "GSocketControlMessage")
+ (c-name "g_socket_control_message_get_level")
+ (return-type "int")
+)
+
+(define-method get_msg_type
+ (of-object "GSocketControlMessage")
+ (c-name "g_socket_control_message_get_msg_type")
+ (return-type "int")
+)
+
+(define-method serialize
+ (of-object "GSocketControlMessage")
+ (c-name "g_socket_control_message_serialize")
+ (return-type "none")
+ (parameters
+ '("gpointer" "data")
+ )
+)
+
+(define-function socket_control_message_deserialize
+ (c-name "g_socket_control_message_deserialize")
+ (return-type "GSocketControlMessage*")
+ (parameters
+ '("int" "level")
+ '("int" "type")
+ '("gsize" "size")
+ '("gpointer" "data")
+ )
+)
+
+
+
+;; From gsocket.h
+
+(define-function socket_get_type
+ (c-name "g_socket_get_type")
+ (return-type "GType")
+)
+
+(define-function socket_new
+ (c-name "g_socket_new")
+ (is-constructor-of "GSocket")
+ (return-type "GSocket*")
+ (parameters
+ '("GSocketFamily" "family")
+ '("GSocketType" "type")
+ '("GSocketProtocol" "protocol")
+ '("GError**" "error")
+ )
+)
+
+(define-function socket_new_from_fd
+ (c-name "g_socket_new_from_fd")
+ (return-type "GSocket*")
+ (parameters
+ '("gint" "fd")
+ '("GError**" "error")
+ )
+)
+
+(define-method get_fd
+ (of-object "GSocket")
+ (c-name "g_socket_get_fd")
+ (return-type "int")
+)
+
+(define-method get_family
+ (of-object "GSocket")
+ (c-name "g_socket_get_family")
+ (return-type "GSocketFamily")
+)
+
+(define-method get_socket_type
+ (of-object "GSocket")
+ (c-name "g_socket_get_socket_type")
+ (return-type "GSocketType")
+)
+
+(define-method get_protocol
+ (of-object "GSocket")
+ (c-name "g_socket_get_protocol")
+ (return-type "GSocketProtocol")
+)
+
+(define-method get_local_address
+ (of-object "GSocket")
+ (c-name "g_socket_get_local_address")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method get_remote_address
+ (of-object "GSocket")
+ (c-name "g_socket_get_remote_address")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method set_blocking
+ (of-object "GSocket")
+ (c-name "g_socket_set_blocking")
+ (return-type "none")
+ (parameters
+ '("gboolean" "blocking")
+ )
+)
+
+(define-method get_blocking
+ (of-object "GSocket")
+ (c-name "g_socket_get_blocking")
+ (return-type "gboolean")
+)
+
+(define-method set_keepalive
+ (of-object "GSocket")
+ (c-name "g_socket_set_keepalive")
+ (return-type "none")
+ (parameters
+ '("gboolean" "keepalive")
+ )
+)
+
+(define-method get_keepalive
+ (of-object "GSocket")
+ (c-name "g_socket_get_keepalive")
+ (return-type "gboolean")
+)
+
+(define-method get_listen_backlog
+ (of-object "GSocket")
+ (c-name "g_socket_get_listen_backlog")
+ (return-type "gint")
+)
+
+(define-method set_listen_backlog
+ (of-object "GSocket")
+ (c-name "g_socket_set_listen_backlog")
+ (return-type "none")
+ (parameters
+ '("gint" "backlog")
+ )
+)
+
+(define-method is_connected
+ (of-object "GSocket")
+ (c-name "g_socket_is_connected")
+ (return-type "gboolean")
+)
+
+(define-method bind
+ (of-object "GSocket")
+ (c-name "g_socket_bind")
+ (return-type "gboolean")
+ (parameters
+ '("GSocketAddress*" "address")
+ '("gboolean" "allow_reuse")
+ '("GError**" "error")
+ )
+)
+
+(define-method connect
+ (of-object "GSocket")
+ (c-name "g_socket_connect")
+ (return-type "gboolean")
+ (parameters
+ '("GSocketAddress*" "address")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method check_connect_result
+ (of-object "GSocket")
+ (c-name "g_socket_check_connect_result")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method condition_check
+ (of-object "GSocket")
+ (c-name "g_socket_condition_check")
+ (return-type "GIOCondition")
+ (parameters
+ '("GIOCondition" "condition")
+ )
+)
+
+(define-method condition_wait
+ (of-object "GSocket")
+ (c-name "g_socket_condition_wait")
+ (return-type "gboolean")
+ (parameters
+ '("GIOCondition" "condition")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method accept
+ (of-object "GSocket")
+ (c-name "g_socket_accept")
+ (return-type "GSocket*")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method listen
+ (of-object "GSocket")
+ (c-name "g_socket_listen")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method receive
+ (of-object "GSocket")
+ (c-name "g_socket_receive")
+ (return-type "gssize")
+ (parameters
+ '("gchar*" "buffer")
+ '("gsize" "size")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method receive_from
+ (of-object "GSocket")
+ (c-name "g_socket_receive_from")
+ (return-type "gssize")
+ (parameters
+ '("GSocketAddress**" "address")
+ '("gchar*" "buffer")
+ '("gsize" "size")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method send
+ (of-object "GSocket")
+ (c-name "g_socket_send")
+ (return-type "gssize")
+ (parameters
+ '("const-gchar*" "buffer")
+ '("gsize" "size")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method send_to
+ (of-object "GSocket")
+ (c-name "g_socket_send_to")
+ (return-type "gssize")
+ (parameters
+ '("GSocketAddress*" "address")
+ '("const-gchar*" "buffer")
+ '("gsize" "size")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method receive_message
+ (of-object "GSocket")
+ (c-name "g_socket_receive_message")
+ (return-type "gssize")
+ (parameters
+ '("GSocketAddress**" "address")
+ '("GInputVector*" "vectors")
+ '("gint" "num_vectors")
+ '("GSocketControlMessage***" "messages")
+ '("gint*" "num_messages")
+ '("gint*" "flags")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method send_message
+ (of-object "GSocket")
+ (c-name "g_socket_send_message")
+ (return-type "gssize")
+ (parameters
+ '("GSocketAddress*" "address")
+ '("GOutputVector*" "vectors")
+ '("gint" "num_vectors")
+ '("GSocketControlMessage**" "messages")
+ '("gint" "num_messages")
+ '("gint" "flags")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method close
+ (of-object "GSocket")
+ (c-name "g_socket_close")
+ (return-type "gboolean")
+ (parameters
+ '("GError**" "error")
+ )
+)
+
+(define-method shutdown
+ (of-object "GSocket")
+ (c-name "g_socket_shutdown")
+ (return-type "gboolean")
+ (parameters
+ '("gboolean" "shutdown_read")
+ '("gboolean" "shutdown_write")
+ '("GError**" "error")
+ )
+)
+
+(define-method is_closed
+ (of-object "GSocket")
+ (c-name "g_socket_is_closed")
+ (return-type "gboolean")
+)
+
+(define-method create_source
+ (of-object "GSocket")
+ (c-name "g_socket_create_source")
+ (return-type "GSource*")
+ (parameters
+ '("GIOCondition" "condition")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ )
+)
+
+(define-method speaks_ipv4
+ (of-object "GSocket")
+ (c-name "g_socket_speaks_ipv4")
+ (return-type "gboolean")
+)
+
+
+
+;; From gsocketlistener.h
+
+(define-function socket_listener_get_type
+ (c-name "g_socket_listener_get_type")
+ (return-type "GType")
+)
+
+(define-function socket_listener_new
+ (c-name "g_socket_listener_new")
+ (is-constructor-of "GSocketListener")
+ (return-type "GSocketListener*")
+)
+
+(define-method set_backlog
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_set_backlog")
+ (return-type "none")
+ (parameters
+ '("int" "listen_backlog")
+ )
+)
+
+(define-method add_socket
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_add_socket")
+ (return-type "gboolean")
+ (parameters
+ '("GSocket*" "socket")
+ '("GObject*" "source_object")
+ '("GError**" "error")
+ )
+)
+
+(define-method add_address
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_add_address")
+ (return-type "gboolean")
+ (parameters
+ '("GSocketAddress*" "address")
+ '("GSocketType" "type")
+ '("GSocketProtocol" "protocol")
+ '("GObject*" "source_object")
+ '("GSocketAddress**" "effective_address")
+ '("GError**" "error")
+ )
+)
+
+(define-method add_inet_port
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_add_inet_port")
+ (return-type "gboolean")
+ (parameters
+ '("guint16" "port")
+ '("GObject*" "source_object")
+ '("GError**" "error")
+ )
+)
+
+(define-method accept_socket
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_accept_socket")
+ (return-type "GSocket*")
+ (parameters
+ '("GObject**" "source_object")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method accept_socket_async
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_accept_socket_async")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method accept_socket_finish
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_accept_socket_finish")
+ (return-type "GSocket*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GObject**" "source_object")
+ '("GError**" "error")
+ )
+)
+
+(define-method accept
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_accept")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("GObject**" "source_object")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GError**" "error")
+ )
+)
+
+(define-method accept_async
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_accept_async")
+ (return-type "none")
+ (parameters
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method accept_finish
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_accept_finish")
+ (return-type "GSocketConnection*")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GObject**" "source_object")
+ '("GError**" "error")
+ )
+)
+
+(define-method close
+ (of-object "GSocketListener")
+ (c-name "g_socket_listener_close")
+ (return-type "none")
+)
+
+
+
+;; From gsocketservice.h
+
+(define-function socket_service_get_type
+ (c-name "g_socket_service_get_type")
+ (return-type "GType")
+)
+
+(define-function socket_service_new
+ (c-name "g_socket_service_new")
+ (is-constructor-of "GSocketService")
+ (return-type "GSocketService*")
+)
+
+(define-method start
+ (of-object "GSocketService")
+ (c-name "g_socket_service_start")
+ (return-type "none")
+)
+
+(define-method stop
+ (of-object "GSocketService")
+ (c-name "g_socket_service_stop")
+ (return-type "none")
+)
+
+(define-method is_active
+ (of-object "GSocketService")
+ (c-name "g_socket_service_is_active")
+ (return-type "gboolean")
+)
+
+
+
+;; From gsrvtarget.h
+
+(define-function srv_target_get_type
+ (c-name "g_srv_target_get_type")
+ (return-type "GType")
+)
+
+(define-function srv_target_new
+ (c-name "g_srv_target_new")
+ (is-constructor-of "GSrvTarget")
+ (return-type "GSrvTarget*")
+ (parameters
+ '("const-gchar*" "hostname")
+ '("guint16" "port")
+ '("guint16" "priority")
+ '("guint16" "weight")
+ )
+)
+
+(define-method copy
+ (of-object "GSrvTarget")
+ (c-name "g_srv_target_copy")
+ (return-type "GSrvTarget*")
+)
+
+(define-method free
+ (of-object "GSrvTarget")
+ (c-name "g_srv_target_free")
+ (return-type "none")
+)
+
+(define-method get_hostname
+ (of-object "GSrvTarget")
+ (c-name "g_srv_target_get_hostname")
+ (return-type "const-gchar*")
+)
+
+(define-method get_port
+ (of-object "GSrvTarget")
+ (c-name "g_srv_target_get_port")
+ (return-type "guint16")
+)
+
+(define-method get_priority
+ (of-object "GSrvTarget")
+ (c-name "g_srv_target_get_priority")
+ (return-type "guint16")
+)
+
+(define-method get_weight
+ (of-object "GSrvTarget")
+ (c-name "g_srv_target_get_weight")
+ (return-type "guint16")
+)
+
+(define-function srv_target_list_sort
+ (c-name "g_srv_target_list_sort")
+ (return-type "GList*")
+ (parameters
+ '("GList*" "targets")
+ )
+)
+
+
+
+;; From gthemedicon.h
+
+(define-function themed_icon_get_type
+ (c-name "g_themed_icon_get_type")
+ (return-type "GType")
+)
+
+(define-function themed_icon_new
+ (c-name "g_themed_icon_new")
+ (is-constructor-of "GThemedIcon")
+ (return-type "GIcon*")
+ (properties
+ '("name" (argname "iconname"))
+ )
+)
+
+(define-function themed_icon_new_with_default_fallbacks
+ (c-name "g_themed_icon_new_with_default_fallbacks")
+ (return-type "GIcon*")
+ (parameters
+ '("const-char*" "iconname")
+ )
+)
+
+(define-function themed_icon_new_from_names
+ (c-name "g_themed_icon_new_from_names")
+ (return-type "GIcon*")
+ (parameters
+ '("char**" "iconnames")
+ '("int" "len")
+ )
+)
+
+(define-method prepend_name
+ (of-object "GThemedIcon")
+ (c-name "g_themed_icon_prepend_name")
+ (return-type "none")
+ (parameters
+ '("const-char*" "iconname")
+ )
+)
+
+;;
+;; wrapped in gicon.override
+;;
+(define-method get_names
+ (c-name "g_themed_icon_get_names")
+ (of-object "GThemedIcon")
+ (return-type "const-gchar*-const*")
+)
+
+(define-method append_name
+ (c-name "g_themed_icon_append_name")
+ (of-object "GThemedIcon")
+ (return-type "none")
+ (parameters
+ '("char*" "iconname")
+ )
+)
+
+
+
+;; From gthreadedsocketservice.h
+
+(define-function threaded_socket_service_get_type
+ (c-name "g_threaded_socket_service_get_type")
+ (return-type "GType")
+)
+
+(define-function threaded_socket_service_new
+ (c-name "g_threaded_socket_service_new")
+ (is-constructor-of "GThreadedSocketService")
+ (return-type "GSocketService*")
+ (parameters
+ '("int" "max_threads")
+ )
+)
+
+
+
+;; 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 gvfs.h
+
+(define-function vfs_get_type
+ (c-name "g_vfs_get_type")
+ (return-type "GType")
+)
+
+(define-method is_active
+ (of-object "GVfs")
+ (c-name "g_vfs_is_active")
+ (return-type "gboolean")
+)
+
+(define-method get_file_for_path
+ (of-object "GVfs")
+ (c-name "g_vfs_get_file_for_path")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "path")
+ )
+)
+
+(define-method get_file_for_uri
+ (of-object "GVfs")
+ (c-name "g_vfs_get_file_for_uri")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "uri")
+ )
+)
+
+(define-method parse_name
+ (of-object "GVfs")
+ (c-name "g_vfs_parse_name")
+ (return-type "GFile*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "parse_name")
+ )
+)
+
+(define-function vfs_get_default
+ (c-name "g_vfs_get_default")
+ (return-type "GVfs*")
+)
+
+(define-function vfs_get_local
+ (c-name "g_vfs_get_local")
+ (return-type "GVfs*")
+)
+
+;;
+;; wrapped in gio.override
+;;
+(define-method get_supported_uri_schemes
+ (docstring
+"VFS.get_supported_uri_schemes() -> [uri, ..]\n"
+"Gets a list of URI schemes supported by vfs.")
+ (of-object "GVfs")
+ (c-name "g_vfs_get_supported_uri_schemes")
+ (return-type "const-char*-const*")
+)
+
+
+
+;; From gwin32appinfo.h
+
+(define-function win32_app_info_get_type
+ (c-name "g_win32_app_info_get_type")
+ (return-type "GType")
+)
+
+
+
+;; From gvolume.h
+
+(define-function volume_get_type
+ (c-name "g_volume_get_type")
+ (return-type "GType")
+)
+
+(define-method get_name
+ (of-object "GVolume")
+ (c-name "g_volume_get_name")
+ (return-type "char*")
+)
+
+(define-method get_icon
+ (of-object "GVolume")
+ (c-name "g_volume_get_icon")
+ (return-type "GIcon*")
+ (caller-owns-return #t)
+)
+
+(define-method get_uuid
+ (of-object "GVolume")
+ (c-name "g_volume_get_uuid")
+ (return-type "char*")
+)
+
+(define-method get_drive
+ (of-object "GVolume")
+ (c-name "g_volume_get_drive")
+ (return-type "GDrive*")
+ (caller-owns-return #t)
+)
+
+(define-method get_mount
+ (of-object "GVolume")
+ (c-name "g_volume_get_mount")
+ (return-type "GMount*")
+ (caller-owns-return #t)
+)
+
+(define-method can_mount
+ (of-object "GVolume")
+ (c-name "g_volume_can_mount")
+ (return-type "gboolean")
+)
+
+(define-method can_eject
+ (of-object "GVolume")
+ (c-name "g_volume_can_eject")
+ (return-type "gboolean")
+)
+
+(define-method should_automount
+ (of-object "GVolume")
+ (c-name "g_volume_should_automount")
+ (return-type "gboolean")
+)
+
+;;
+;; wrapped in gvolume.override
+;;
+(define-method mount
+ (of-object "GVolume")
+ (c-name "g_volume_mount")
+ (return-type "none")
+ (parameters
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method mount_finish
+ (of-object "GVolume")
+ (c-name "g_volume_mount_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+;;
+;; wrapped in gvolume.override
+;;
+(define-method eject
+ (of-object "GVolume")
+ (c-name "g_volume_eject")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags" (default "G_MOUNT_UNMOUNT_NONE"))
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_finish
+ (of-object "GVolume")
+ (c-name "g_volume_eject_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+ (deprecated "use gio.Drive.eject_with_operation_finish instead.")
+)
+
+(define-method get_identifier
+ (of-object "GVolume")
+ (c-name "g_volume_get_identifier")
+ (return-type "char*")
+ (parameters
+ '("const-char*" "kind")
+ )
+)
+
+;;
+;; wrapped in gvolume.override
+;;
+(define-method enumerate_identifiers
+ (of-object "GVolume")
+ (c-name "g_volume_enumerate_identifiers")
+ (return-type "char**")
+)
+
+(define-method get_activation_root
+ (of-object "GVolume")
+ (c-name "g_volume_get_activation_root")
+ (return-type "GFile*")
+)
+
+(define-method eject_with_operation
+ (of-object "GVolume")
+ (c-name "g_volume_eject_with_operation")
+ (return-type "none")
+ (parameters
+ '("GMountUnmountFlags" "flags")
+ '("GMountOperation*" "mount_operation")
+ '("GCancellable*" "cancellable" (null-ok) (default "NULL"))
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-method eject_with_operation_finish
+ (of-object "GVolume")
+ (c-name "g_volume_eject_with_operation_finish")
+ (return-type "gboolean")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gvolumemonitor.h
+
+(define-function volume_monitor_get_type
+ (c-name "g_volume_monitor_get_type")
+ (return-type "GType")
+)
+
+(define-function volume_monitor_get
+ (c-name "g_volume_monitor_get")
+ (return-type "GVolumeMonitor*")
+)
+
+;;
+;; wrapped in gvolumemonitor.override
+;;
+(define-method get_connected_drives
+ (of-object "GVolumeMonitor")
+ (c-name "g_volume_monitor_get_connected_drives")
+ (return-type "GList*")
+)
+
+;;
+;; wrapped in gvolumemonitor.override
+;;
+(define-method get_volumes
+ (of-object "GVolumeMonitor")
+ (c-name "g_volume_monitor_get_volumes")
+ (return-type "GList*")
+)
+
+;;
+;; wrapped in gvolumemonitor.override
+;;
+(define-method get_mounts
+ (of-object "GVolumeMonitor")
+ (c-name "g_volume_monitor_get_mounts")
+ (return-type "GList*")
+)
+
+(define-method get_volume_for_uuid
+ (of-object "GVolumeMonitor")
+ (c-name "g_volume_monitor_get_volume_for_uuid")
+ (return-type "GVolume*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "uuid")
+ )
+)
+
+(define-method get_mount_for_uuid
+ (of-object "GVolumeMonitor")
+ (c-name "g_volume_monitor_get_mount_for_uuid")
+ (return-type "GMount*")
+ (caller-owns-return #t)
+ (parameters
+ '("const-char*" "uuid")
+ )
+)
+
+(define-function volume_monitor_adopt_orphan_mount
+ (c-name "g_volume_monitor_adopt_orphan_mount")
+ (return-type "GVolume*")
+ (parameters
+ '("GMount*" "mount")
+ )
+)
+
diff --git a/gio/gio.override b/gio/gio.override
new file mode 100644
index 0000000..7fdcb1c
--- /dev/null
+++ b/gio/gio.override
@@ -0,0 +1,409 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gio.override: 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+modulename gio
+%%
+import gobject.GObject as PyGObject_Type
+import glib.PollFD as PyGPollFD_Type
+%%
+headers
+#define NO_IMPORT_PYGOBJECT
+#include <pygobject.h>
+#include <gio/gio.h>
+#include "pygio-utils.h"
+#include "pyglib.h"
+#include "pygsource.h"
+
+#define BUFSIZE 8192
+
+typedef struct _PyGIONotify PyGIONotify;
+
+struct _PyGIONotify {
+ gboolean referenced;
+ PyObject *callback;
+ PyObject *data;
+ gboolean attach_self;
+ gpointer buffer;
+ gsize buffer_size;
+
+ /* If a structure has any 'slaves', those will reference their
+ * callbacks and be freed together with the 'master'. */
+ PyGIONotify *slaves;
+};
+
+static GQuark
+pygio_notify_get_internal_quark(void)
+{
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_string("pygio::notify");
+ return quark;
+}
+
+static PyGIONotify *
+pygio_notify_new(void)
+{
+ return g_slice_new0(PyGIONotify);
+}
+
+static PyGIONotify *
+pygio_notify_new_slave(PyGIONotify* master)
+{
+ PyGIONotify *slave = pygio_notify_new();
+
+ while (master->slaves)
+ master = master->slaves;
+ master->slaves = slave;
+
+ return slave;
+}
+
+static gboolean
+pygio_notify_using_optional_callback(PyGIONotify *notify)
+{
+ if (notify->callback)
+ return TRUE;
+ else {
+ notify->data = NULL;
+ return FALSE;
+ }
+}
+
+static gboolean
+pygio_notify_callback_is_valid_full(PyGIONotify *notify, const gchar *name)
+{
+ if (!notify->callback) {
+ PyErr_SetString(PyExc_RuntimeError, "internal error: callback is not set");
+ return FALSE;
+ }
+
+ if (!PyCallable_Check(notify->callback)) {
+ gchar *error_message = g_strdup_printf("%s argument not callable", name);
+
+ PyErr_SetString(PyExc_TypeError, error_message);
+ g_free(error_message);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+pygio_notify_callback_is_valid(PyGIONotify *notify)
+{
+ return pygio_notify_callback_is_valid_full(notify, "callback");
+}
+
+static void
+pygio_notify_reference_callback(PyGIONotify *notify)
+{
+ if (!notify->referenced) {
+ notify->referenced = TRUE;
+ Py_XINCREF(notify->callback);
+ Py_XINCREF(notify->data);
+
+ if (notify->slaves)
+ pygio_notify_reference_callback(notify->slaves);
+ }
+}
+
+static void
+pygio_notify_copy_buffer(PyGIONotify *notify, gpointer buffer, gsize buffer_size)
+{
+ if (buffer_size > 0) {
+ notify->buffer = g_slice_copy(buffer_size, buffer);
+ notify->buffer_size = buffer_size;
+ }
+}
+
+static gboolean
+pygio_notify_allocate_buffer(PyGIONotify *notify, gsize buffer_size)
+{
+ if (buffer_size > 0) {
+ notify->buffer = g_slice_alloc(buffer_size);
+ if (!notify->buffer) {
+ PyErr_Format(PyExc_MemoryError, "failed to allocate %" G_GSIZE_FORMAT " bytes", buffer_size);
+ return FALSE;
+ }
+
+ notify->buffer_size = buffer_size;
+ }
+
+ return TRUE;
+}
+
+static void
+pygio_notify_attach_to_result(PyGIONotify *notify)
+{
+ notify->attach_self = TRUE;
+}
+
+static PyGIONotify *
+pygio_notify_get_attached(PyGObject *result)
+{
+ return g_object_get_qdata(G_OBJECT(result->obj), pygio_notify_get_internal_quark());
+}
+
+static void
+pygio_notify_free(PyGIONotify *notify)
+{
+ if (notify) {
+ if (notify->slaves)
+ pygio_notify_free(notify->slaves);
+
+ if (notify->referenced) {
+ PyGILState_STATE state;
+
+ state = pyg_gil_state_ensure();
+ Py_XDECREF(notify->callback);
+ Py_XDECREF(notify->data);
+ pyg_gil_state_release(state);
+ }
+
+ if (notify->buffer)
+ g_slice_free1(notify->buffer_size, notify->buffer);
+
+ g_slice_free(PyGIONotify, notify);
+ }
+}
+
+static void
+async_result_callback_marshal(GObject *source_object,
+ GAsyncResult *result,
+ PyGIONotify *notify)
+{
+ PyObject *ret;
+ PyGILState_STATE state;
+
+ state = pyg_gil_state_ensure();
+
+ if (!notify->referenced)
+ g_warning("pygio_notify_reference_callback() hasn't been called before using the structure");
+
+ if (notify->attach_self) {
+ g_object_set_qdata_full(G_OBJECT(result), pygio_notify_get_internal_quark(),
+ notify, (GDestroyNotify) pygio_notify_free);
+ }
+
+ if (notify->data)
+ ret = PyEval_CallFunction(notify->callback, "NNO",
+ pygobject_new(source_object),
+ pygobject_new((GObject *)result),
+ notify->data);
+ else
+ ret = PyObject_CallFunction(notify->callback, "NN",
+ pygobject_new(source_object),
+ pygobject_new((GObject *)result));
+
+ if (ret == NULL) {
+ PyErr_Print();
+ PyErr_Clear();
+ }
+
+ Py_XDECREF(ret);
+
+ /* Otherwise the structure is attached to 'result' and will be
+ * freed when that object dies. */
+ if (!notify->attach_self)
+ pygio_notify_free(notify);
+
+ pyg_gil_state_release(state);
+}
+%%
+include
+ gappinfo.override
+ gapplaunchcontext.override
+ gbufferedinputstream.override
+ gcancellable.override
+ gdatainputstream.override
+ gdrive.override
+ gfile.override
+ gfileattribute.override
+ gfileenumerator.override
+ gfileinfo.override
+ gfileinputstream.override
+ gfileiostream.override
+ gfileoutputstream.override
+ gicon.override
+ giostream.override
+ gmemoryinputstream.override
+ gmemoryoutputstream.override
+ gmount.override
+ ginputstream.override
+ goutputstream.override
+ gresolver.override
+ gsocket.override
+ gvolume.override
+ gvolumemonitor.override
+%%
+ignore-glob
+ *_get_type
+ *free
+ *_ref
+ *_unref
+ g_async_result_get_user_data
+ g_file_new_from_commandline_arg
+ g_file_new_from_path
+ g_file_new_from_uri
+ g_file_hash
+ g_io_error_quark
+ g_simple_async_result_new_error
+ g_simple_async_report_error_in_idle
+ g_simple_async_result_set_op_res_gpointer
+ g_simple_async_result_get_op_res_gpointer
+ g_simple_async_result_get_source_tag
+ g_simple_async_result_run_in_thread
+ g_simple_async_result_set_from_error
+ g_simple_async_result_set_error
+ g_simple_async_result_set_error_va
+ g_io_module*
+ g_io_scheduler_*
+%%
+override g_app_info_get_all noargs
+static PyObject *
+_wrap_g_app_info_get_all (PyGObject *self)
+{
+ GList *list, *l;
+ PyObject *ret;
+
+ list = g_app_info_get_all ();
+
+ ret = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ GObject *obj = l->data;
+ PyObject *item = pygobject_new(obj);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ g_list_free(list);
+
+ return ret;
+}
+%%
+override g_app_info_get_all_for_type args
+static PyObject *
+_wrap_g_app_info_get_all_for_type (PyGObject *self, PyObject *args)
+{
+ GList *list, *l;
+ PyObject *ret;
+ gchar *type;
+
+ if (!PyArg_ParseTuple (args, "s:app_info_get_all_for_type", &type))
+ return NULL;
+
+ list = g_app_info_get_all_for_type (type);
+
+ ret = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ GObject *obj = l->data;
+ PyObject *item = pygobject_new(obj);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+ }
+ g_list_free(list);
+
+ return ret;
+}
+%%
+override g_content_type_guess kwargs
+static PyObject *
+_wrap_g_content_type_guess(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ char *kwlist[] = {"filename", "data", "want_uncertain", NULL};
+ char *filename = NULL, *data = NULL, *type;
+#ifdef PY_SSIZE_T_CLEAN
+ Py_ssize_t data_size = 0;
+#else
+ int data_size = 0;
+#endif
+
+ gboolean result_uncertain, want_uncertain = FALSE;
+ PyObject *ret;
+
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs,
+ "|zz#i:g_content_type_guess",
+ kwlist,
+ &filename, &data, &data_size,
+ &want_uncertain))
+ return NULL;
+
+ if (!filename && !data) {
+ PyErr_SetString(PyExc_TypeError, "need at least one argument");
+ return NULL;
+ }
+
+ type = g_content_type_guess(filename, (guchar *) data,
+ data_size, &result_uncertain);
+
+ if (want_uncertain) {
+ ret = Py_BuildValue("zN", type, PyBool_FromLong(result_uncertain));
+
+ } else {
+ ret = PyString_FromString(type);
+ }
+
+ g_free(type);
+ return ret;
+}
+%%
+override g_vfs_get_supported_uri_schemes noargs
+static PyObject *
+_wrap_g_vfs_get_supported_uri_schemes(PyGObject *self)
+{
+ const char * const *names;
+ PyObject *ret;
+
+ names = g_vfs_get_supported_uri_schemes(G_VFS(self->obj));
+
+ ret = PyList_New(0);
+ while (names && *names) {
+ PyObject *item = PyString_FromString(names[0]);
+ PyList_Append(ret, item);
+ Py_DECREF(item);
+
+ names++;
+ }
+
+ return ret;
+}
+%%
+override g_content_types_get_registered noargs
+static PyObject *
+_wrap_g_content_types_get_registered(PyObject *self)
+{
+ GList *list, *l;
+ PyObject *ret;
+
+ list = g_content_types_get_registered();
+
+ ret = PyList_New(0);
+ for (l = list; l; l = l->next) {
+ char *content_type = l->data;
+ PyObject *string = PyString_FromString(content_type);
+ PyList_Append(ret, string);
+ Py_DECREF(string);
+ g_free(content_type);
+ }
+ g_list_free(list);
+
+ return ret;
+}
diff --git a/gio/giomodule.c b/gio/giomodule.c
new file mode 100644
index 0000000..a9ddd38
--- /dev/null
+++ b/gio/giomodule.c
@@ -0,0 +1,208 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <Python.h>
+#include <pyglib.h>
+#include <pygobject.h>
+#include <pyglib-python-compat.h>
+
+#include <gio/gio.h>
+
+#define PYGIO_MAJOR_VERSION PYGOBJECT_MAJOR_VERSION
+#define PYGIO_MINOR_VERSION PYGOBJECT_MINOR_VERSION
+#define PYGIO_MICRO_VERSION PYGOBJECT_MICRO_VERSION
+
+/* include any extra headers needed here */
+
+void pygio_register_classes(PyObject *d);
+void pygio_add_constants(PyObject *module, const gchar *strip_prefix);
+
+extern PyMethodDef pygio_functions[];
+
+PYGLIB_INIT_FUNCTION(_gio, "gio._gio", pygio_functions)
+{
+ PyObject *d;
+ PyObject *tuple;
+ PyObject *e;
+
+ /* perform any initialisation required by the library here */
+
+ d = PyModule_GetDict(module);
+
+ g_type_init();
+ pyglib_init();
+
+ if (pygobject_init(2, 15, 2) == NULL)
+ return -1;
+
+ pygio_register_classes(d);
+ pygio_add_constants(module, "G_IO_");
+
+ PyModule_AddStringConstant(module, "ERROR", g_quark_to_string(G_IO_ERROR));
+ e = pyglib_register_exception_for_domain("gio.Error", G_IO_ERROR);
+ PyDict_SetItemString(d, "Error", e);
+ Py_DECREF(e);
+
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_TYPE",
+ G_FILE_ATTRIBUTE_STANDARD_TYPE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_IS_HIDDEN",
+ G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_IS_BACKUP",
+ G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_IS_SYMLINK",
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL",
+ G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_NAME",
+ G_FILE_ATTRIBUTE_STANDARD_NAME);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME",
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_EDIT_NAME",
+ G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_COPY_NAME",
+ G_FILE_ATTRIBUTE_STANDARD_COPY_NAME);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_DESCRIPTION",
+ G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_ICON",
+ G_FILE_ATTRIBUTE_STANDARD_ICON);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE",
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE",
+ G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_SIZE",
+ G_FILE_ATTRIBUTE_STANDARD_SIZE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET",
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_TARGET_URI",
+ G_FILE_ATTRIBUTE_STANDARD_TARGET_URI);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_STANDARD_SORT_ORDER",
+ G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ETAG_VALUE",
+ G_FILE_ATTRIBUTE_ETAG_VALUE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ID_FILE",
+ G_FILE_ATTRIBUTE_ID_FILE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ID_FILESYSTEM",
+ G_FILE_ATTRIBUTE_ID_FILESYSTEM);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ACCESS_CAN_READ",
+ G_FILE_ATTRIBUTE_ACCESS_CAN_READ);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ACCESS_CAN_WRITE",
+ G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE",
+ G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ACCESS_CAN_DELETE",
+ G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ACCESS_CAN_TRASH",
+ G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_ACCESS_CAN_RENAME",
+ G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT",
+ G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT",
+ G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT",
+ G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE",
+ G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI",
+ G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_MODIFIED",
+ G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_MODIFIED_USEC",
+ G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_ACCESS",
+ G_FILE_ATTRIBUTE_TIME_ACCESS);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_ACCESS_USEC",
+ G_FILE_ATTRIBUTE_TIME_ACCESS_USEC);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_CHANGED",
+ G_FILE_ATTRIBUTE_TIME_CHANGED);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_CHANGED_USEC",
+ G_FILE_ATTRIBUTE_TIME_CHANGED_USEC);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_CREATED",
+ G_FILE_ATTRIBUTE_TIME_CREATED);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TIME_CREATED_USEC",
+ G_FILE_ATTRIBUTE_TIME_CREATED_USEC);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_DEVICE",
+ G_FILE_ATTRIBUTE_UNIX_DEVICE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_INODE",
+ G_FILE_ATTRIBUTE_UNIX_INODE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_MODE",
+ G_FILE_ATTRIBUTE_UNIX_MODE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_NLINK",
+ G_FILE_ATTRIBUTE_UNIX_NLINK);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_UID",
+ G_FILE_ATTRIBUTE_UNIX_UID);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_GID",
+ G_FILE_ATTRIBUTE_UNIX_GID);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_RDEV",
+ G_FILE_ATTRIBUTE_UNIX_RDEV);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_BLOCK_SIZE",
+ G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_BLOCKS",
+ G_FILE_ATTRIBUTE_UNIX_BLOCKS);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT",
+ G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_DOS_IS_ARCHIVE",
+ G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_DOS_IS_SYSTEM",
+ G_FILE_ATTRIBUTE_DOS_IS_SYSTEM);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_OWNER_USER",
+ G_FILE_ATTRIBUTE_OWNER_USER);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_OWNER_USER_REAL",
+ G_FILE_ATTRIBUTE_OWNER_USER_REAL);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_OWNER_GROUP",
+ G_FILE_ATTRIBUTE_OWNER_GROUP);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_THUMBNAIL_PATH",
+ G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_THUMBNAILING_FAILED",
+ G_FILE_ATTRIBUTE_THUMBNAILING_FAILED);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_FILESYSTEM_SIZE",
+ G_FILE_ATTRIBUTE_FILESYSTEM_SIZE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_FILESYSTEM_FREE",
+ G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_FILESYSTEM_TYPE",
+ G_FILE_ATTRIBUTE_FILESYSTEM_TYPE);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_FILESYSTEM_READONLY",
+ G_FILE_ATTRIBUTE_FILESYSTEM_READONLY);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW",
+ G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_GVFS_BACKEND",
+ G_FILE_ATTRIBUTE_GVFS_BACKEND);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_SELINUX_CONTEXT",
+ G_FILE_ATTRIBUTE_SELINUX_CONTEXT);
+ PyModule_AddStringConstant(module, "FILE_ATTRIBUTE_TRASH_ITEM_COUNT",
+ G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT);
+
+ PyModule_AddStringConstant(module, "ERROR", g_quark_to_string(G_IO_ERROR));
+
+ /* pygio version */
+ tuple = Py_BuildValue ("(iii)",
+ PYGIO_MAJOR_VERSION,
+ PYGIO_MINOR_VERSION,
+ PYGIO_MICRO_VERSION);
+ PyDict_SetItemString(d, "pygio_version", tuple);
+ Py_DECREF(tuple);
+
+ return 0;
+}
+
diff --git a/gio/giostream.override b/gio/giostream.override
new file mode 100644
index 0000000..29ec801
--- /dev/null
+++ b/gio/giostream.override
@@ -0,0 +1,68 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * giostream.override: module overrides for GIOStream
+ *
+ * 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_io_stream_close_async kwargs
+static PyObject *
+_wrap_g_io_stream_close_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority", "cancellable",
+ "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:IOStream.close_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_io_stream_close_async(G_IO_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gmemoryinputstream.override b/gio/gmemoryinputstream.override
new file mode 100644
index 0000000..0495338
--- /dev/null
+++ b/gio/gmemoryinputstream.override
@@ -0,0 +1,91 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gmemoryinputstream.override: module overrides for GMemoryInputStream
+ *
+ * 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_input_stream_add_data kwargs
+static PyObject *
+_wrap_g_memory_input_stream_add_data(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "data", NULL };
+ PyObject *data;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:gio.MemoryInputStream.add_data",
+ kwlist, &data))
+ return NULL;
+
+ if (data != Py_None) {
+ char *copy;
+ int length;
+
+ if (!PyString_Check(data)) {
+ PyErr_SetString(PyExc_TypeError, "data must be a string or None");
+ return NULL;
+ }
+
+ length = PyString_Size(data);
+ copy = g_malloc(length);
+ memcpy(copy, PyString_AsString(data), length);
+
+ g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(self->obj),
+ copy, length, (GDestroyNotify) g_free);
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+%%
+override g_memory_input_stream_new_from_data kwargs
+static PyObject *
+_wrap_g_memory_input_stream_new_from_data(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "data", NULL };
+ PyObject *data;
+ GInputStream *stream = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O:gio.memory_input_stream_new_from_data",
+ kwlist, &data))
+ return NULL;
+
+ if (data != Py_None) {
+ char *copy;
+ int length;
+
+ if (!PyString_Check(data)) {
+ PyErr_SetString(PyExc_TypeError, "data must be a string or None");
+ return NULL;
+ }
+
+ length = PyString_Size(data);
+ copy = g_malloc(length);
+ memcpy(copy, PyString_AsString(data), length);
+
+ stream = g_memory_input_stream_new_from_data(copy, length,
+ (GDestroyNotify) g_free);
+ }
+
+ return pygobject_new((GObject *)stream);
+}
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)));
+}
diff --git a/gio/gmount.override b/gio/gmount.override
new file mode 100644
index 0000000..9fb0828
--- /dev/null
+++ b/gio/gmount.override
@@ -0,0 +1,454 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gmount.override: module overrides for GMount
+ *
+ * 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_mount_guess_content_type kwargs
+static PyObject *
+_wrap_g_mount_guess_content_type(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "force_rescan",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ gboolean force_rescan;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "Oi|OO:Mount.guess_content_type",
+ kwlist,
+ ¬ify->callback,
+ &force_rescan,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_mount_guess_content_type(G_MOUNT(self->obj),
+ force_rescan,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_mount_guess_content_type_finish kwargs
+static PyObject *
+_wrap_g_mount_guess_content_type_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GError *error = NULL;
+ char **ret;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:Mount.guess_content_type_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &result))
+ return NULL;
+
+ ret = g_mount_guess_content_type_finish(G_MOUNT(self->obj),
+ G_ASYNC_RESULT(result->obj), &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret && ret[0] != NULL) {
+ py_ret = strv_to_pylist(ret);
+ g_strfreev (ret);
+ } else {
+ py_ret = Py_None;
+ Py_INCREF(py_ret);
+ }
+ return py_ret;
+}
+%%
+override g_mount_guess_content_type_sync kwargs
+static PyObject *
+_wrap_g_mount_guess_content_type_sync(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "force_rescan", "cancellable", NULL };
+ gboolean force_rescan;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ GError *error = NULL;
+ char **ret;
+ PyObject *py_ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "i|O:Mount.guess_content_type_sync",
+ kwlist,
+ &force_rescan,
+ &py_cancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ ret = g_mount_guess_content_type_sync(G_MOUNT(self->obj), force_rescan,
+ cancellable, &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret && ret[0] != NULL) {
+ py_ret = strv_to_pylist(ret);
+ g_strfreev (ret);
+ } else {
+ py_ret = Py_None;
+ Py_INCREF(py_ret);
+ }
+ return py_ret;
+}
+%%
+override g_mount_remount kwargs
+static PyObject *
+_wrap_g_mount_remount(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyObject *py_mount_operation = Py_None;
+ GMountOperation *mount_operation = NULL;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Mount.remount",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &py_mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_mount_operation != Py_None) {
+ if (!pygobject_check(py_mount_operation, &PyGMountOperation_Type)) {
+ PyErr_SetString(PyExc_TypeError,
+ "mount_operation must be a gio.MountOperation or None");
+ goto error;
+ }
+
+ mount_operation = G_MOUNT_OPERATION(pygobject_get(py_mount_operation));
+ }
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ pyg_begin_allow_threads;
+
+ g_mount_remount(G_MOUNT(self->obj),
+ flags,
+ mount_operation,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ pyg_end_allow_threads;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_mount_unmount kwargs
+static PyObject *
+_wrap_g_mount_unmount(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:gio.Mount.unmount",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ pyg_begin_allow_threads;
+
+ g_mount_unmount(G_MOUNT(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ pyg_end_allow_threads;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_mount_eject kwargs
+static PyObject *
+_wrap_g_mount_eject(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:gio.Mount.eject",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer) &flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ pyg_begin_allow_threads;
+
+ g_mount_eject(G_MOUNT(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ pyg_end_allow_threads;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override-slot GMount.tp_repr
+static PyObject *
+_wrap_g_mount_tp_repr(PyGObject *self)
+{
+ char *name = g_mount_get_name(G_MOUNT(self->obj));
+ char *uuid = g_mount_get_uuid(G_MOUNT(self->obj));
+ gchar *representation;
+ PyObject *result;
+
+ if (name) {
+ if (uuid) {
+ representation = g_strdup_printf("<%s at %p: %s (%s)>",
+ self->ob_type->tp_name, self, name, uuid);
+ }
+ else {
+ representation = g_strdup_printf("<%s at %p: %s>",
+ self->ob_type->tp_name, self, name);
+ }
+ }
+ else
+ representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self);
+
+ g_free(name);
+ g_free(uuid);
+
+ result = PyString_FromString(representation);
+ g_free(representation);
+ return result;
+}
+%%
+override g_mount_unmount_with_operation kwargs
+static PyObject *
+_wrap_g_mount_unmount_with_operation(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Mount.unmount_with_operation",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_mount_unmount_with_operation(G_MOUNT(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_mount_eject_with_operation kwargs
+static PyObject *
+_wrap_g_mount_eject_with_operation(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Mount.eject_with_operation",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_mount_eject_with_operation(G_MOUNT(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/goutputstream.override b/gio/goutputstream.override
new file mode 100644
index 0000000..337a84c
--- /dev/null
+++ b/gio/goutputstream.override
@@ -0,0 +1,292 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * 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 (!pygio_check_cancellable(pycancellable, &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);
+}
+%%
+override g_output_stream_write_all kwargs
+static PyObject *
+_wrap_g_output_stream_write_all(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;
+ gsize written;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s#|O!:OutputStream.write",
+ kwlist, &buffer, &count,
+ &PyGCancellable_Type, &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ pyg_begin_allow_threads;
+ g_output_stream_write_all(G_OUTPUT_STREAM(self->obj),
+ buffer, count, &written, cancellable, &error);
+ pyg_end_allow_threads;
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ return PyInt_FromLong(written);
+}
+%%
+override g_output_stream_write_async kwargs
+static PyObject *
+_wrap_g_output_stream_write_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "buffer", "callback", "io_priority", "cancellable",
+ "user_data", NULL };
+ gchar *buffer;
+ long count = -1;
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s#O|iOO:OutputStream.write_async",
+ kwlist, &buffer,
+ &count,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+ pygio_notify_copy_buffer(notify, buffer, count);
+
+ g_output_stream_write_async(G_OUTPUT_STREAM(self->obj),
+ notify->buffer,
+ notify->buffer_size,
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_output_stream_close_async kwargs
+static PyObject *
+_wrap_g_output_stream_close_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:OutputStream.close_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_output_stream_close_async(G_OUTPUT_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_output_stream_flush_async kwargs
+static PyObject *
+_wrap_g_output_stream_flush_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "io_priority",
+ "cancellable", "user_data", NULL };
+ int io_priority = G_PRIORITY_DEFAULT;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|iOO:OutputStream.flush_async",
+ kwlist,
+ ¬ify->callback,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_output_stream_flush_async(G_OUTPUT_STREAM(self->obj),
+ io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_output_stream_splice_async kwargs
+static PyObject *
+_wrap_g_output_stream_splice_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "source", "callback", "flags", "io_priority",
+ "cancellable", "user_data", NULL };
+
+ int io_priority = G_PRIORITY_DEFAULT;
+ GOutputStreamSpliceFlags flags = G_OUTPUT_STREAM_SPLICE_NONE;
+ PyObject *py_flags = NULL;
+ PyGObject *source;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ PyGIONotify *notify;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!O|OiOO:OutputStream.splice_async",
+ kwlist,
+ &PyGInputStream_Type,
+ &source,
+ ¬ify->callback,
+ &py_flags,
+ &io_priority,
+ &pycancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_output_stream_splice_async(G_OUTPUT_STREAM(self->obj),
+ G_INPUT_STREAM(source->obj), flags, io_priority,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+
+/* GOutputStream.write_all: No ArgType for const-void* */
diff --git a/gio/gresolver.override b/gio/gresolver.override
new file mode 100644
index 0000000..ddde73b
--- /dev/null
+++ b/gio/gresolver.override
@@ -0,0 +1,312 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gresolver.override: module overrides for GResolver
+ *
+ * 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_resolver_lookup_by_name kwargs
+static PyObject *
+_wrap_g_resolver_lookup_by_name(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "hostname", "cancellable", NULL };
+ gchar *hostname;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ GList *addr;
+ GError *error = NULL;
+ PyObject *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "s|O:gio.Resolver.lookup_by_name",
+ kwlist,
+ &hostname,
+ &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ addr = g_resolver_lookup_by_name(G_RESOLVER(self->obj),
+ hostname, cancellable, &error);
+
+ if (addr) {
+ PYLIST_FROMGLIST(ret, addr, pygobject_new(list_item), g_resolver_free_addresses, NULL);
+ return ret;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_resolver_lookup_by_name_async kwargs
+static PyObject *
+_wrap_g_resolver_lookup_by_name_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "hostname",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ gchar *hostname;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "Os|OO:gio.Resolver.lookup_by_name_async",
+ kwlist,
+ ¬ify->callback,
+ &hostname,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_resolver_lookup_by_name_async(G_RESOLVER(self->obj),
+ hostname,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_resolver_lookup_by_name_finish kwargs
+static PyObject *
+_wrap_g_resolver_lookup_by_name_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GList *addr;
+ PyObject *ret;
+ GError *error = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.Resolver.lookup_by_name_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &result))
+ return NULL;
+
+ addr = g_resolver_lookup_by_name_finish(G_RESOLVER(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (addr) {
+ PYLIST_FROMGLIST(ret, addr, pygobject_new(list_item),
+ g_resolver_free_addresses, NULL);
+ return ret;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_resolver_lookup_by_address_async kwargs
+static PyObject *
+_wrap_g_resolver_lookup_by_address_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "address",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *address;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "OO|OO:gio.Resolver.lookup_by_address_async",
+ kwlist,
+ ¬ify->callback,
+ &address,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_resolver_lookup_by_address_async(G_RESOLVER(self->obj),
+ G_INET_ADDRESS(address->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_resolver_lookup_service kwargs
+static PyObject *
+_wrap_g_resolver_lookup_service(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "service", "protocol",
+ "domain", "cancellable", NULL };
+ gchar *service, *protocol, *domain;
+ PyGObject *pycancellable = NULL;
+ GCancellable *cancellable;
+ GList *targets;
+ GError *error = NULL;
+ PyObject *ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sss|O:gio.Resolver.lookup_service",
+ kwlist,
+ &service,
+ &protocol,
+ &domain,
+ &pycancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(pycancellable, &cancellable))
+ return NULL;
+
+ targets = g_resolver_lookup_service(G_RESOLVER(self->obj),
+ service, protocol, domain,
+ cancellable, &error);
+
+ if (targets) {
+ PYLIST_FROMGLIST(ret, targets,
+ pyg_boxed_new(G_TYPE_SRV_TARGET, list_item, TRUE, TRUE),
+ g_resolver_free_targets, NULL);
+ return ret;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_resolver_lookup_service_async kwargs
+static PyObject *
+_wrap_g_resolver_lookup_service_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "service", "protocol", "domain",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ gchar *service, *protocol, *domain;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "Osss|OO:gio.Resolver.lookup_service_async",
+ kwlist,
+ ¬ify->callback,
+ &service,
+ &protocol,
+ &domain,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_resolver_lookup_service_async(G_RESOLVER(self->obj),
+ service, protocol, domain,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_resolver_lookup_service_finish kwargs
+static PyObject *
+_wrap_g_resolver_lookup_service_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ PyGObject *result;
+ GList *targets;
+ PyObject *ret;
+ GError *error = NULL;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O!:gio.Resolver.lookup_service_finish",
+ kwlist,
+ &PyGAsyncResult_Type,
+ &result))
+ return NULL;
+
+ targets = g_resolver_lookup_service_finish(G_RESOLVER(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (targets) {
+ PYLIST_FROMGLIST(ret, targets,
+ pyg_boxed_new(G_TYPE_SRV_TARGET, list_item, TRUE, TRUE),
+ g_resolver_free_targets, NULL);
+ return ret;
+ } else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
diff --git a/gio/gsocket.override b/gio/gsocket.override
new file mode 100644
index 0000000..8f66653
--- /dev/null
+++ b/gio/gsocket.override
@@ -0,0 +1,575 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2009 Gian Mario Tagliaretti
+ *
+ * gsocket.override: module overrides for GSocket and related types
+ *
+ * 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_socket_condition_check kwargs
+static PyObject *
+_wrap_g_socket_condition_check(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "condition", NULL };
+ gint condition, ret;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "i:gio.Socket.condition_check",
+ kwlist, &condition))
+ return NULL;
+
+ ret = g_socket_condition_check(G_SOCKET(self->obj), condition);
+
+ return pyg_flags_from_gtype(G_TYPE_IO_CONDITION, ret);
+}
+%%
+override g_socket_condition_wait kwargs
+static PyObject *
+_wrap_g_socket_condition_wait(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "condition", "cancellable", NULL };
+ gboolean ret;
+ gint condition;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ GError *error;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "i|O:gio.Socket.condition_wait",
+ kwlist, &condition, &cancellable))
+ return NULL;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ ret = g_socket_condition_wait(G_SOCKET(self->obj), condition,
+ cancellable, &error);
+
+ return PyBool_FromLong(ret);
+}
+%%
+override g_socket_address_enumerator_next_async kwargs
+static PyObject *
+_wrap_g_socket_address_enumerator_next_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:gio.SocketAddressEnumerator.next_async",
+ kwlist,
+ ¬ify->callback,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_socket_address_enumerator_next_async(G_SOCKET_ADDRESS_ENUMERATOR(self->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_socket_client_connect_async kwargs
+static PyObject *
+_wrap_g_socket_client_connect_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "connectable", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ PyGObject *py_connectable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "OO|OO:gio.SocketClient.connect_async",
+ kwlist,
+ ¬ify->callback,
+ &py_connectable,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_socket_client_connect_async(G_SOCKET_CLIENT(self->obj),
+ G_SOCKET_CONNECTABLE(py_connectable->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_socket_client_connect_to_host_async kwargs
+static PyObject *
+_wrap_g_socket_client_connect_to_host_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "host_and_port", "default_port",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ gchar *host_and_port;
+ guint16 default_port;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "OsH|OO:gio.SocketClient.connect_to_host_async",
+ kwlist,
+ ¬ify->callback,
+ &host_and_port,
+ &default_port,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_socket_client_connect_to_host_async(G_SOCKET_CLIENT(self->obj),
+ host_and_port, default_port,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_socket_client_connect_to_service_async kwargs
+static PyObject *
+_wrap_g_socket_client_connect_to_service_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "domain", "service",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ gchar *domain, *service;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "Oss|OO:gio.SocketClient.connect_to_service_async",
+ kwlist,
+ ¬ify->callback,
+ &domain,
+ &service,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_socket_client_connect_to_service_async(G_SOCKET_CLIENT(self->obj),
+ domain, service,
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_socket_listener_add_address kwargs
+static PyObject *
+_wrap_g_socket_listener_add_address(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "address", "type", "protocol",
+ "source_object", NULL };
+ GSocketProtocol protocol;
+ PyObject *py_type = NULL, *py_protocol = NULL;
+ GError *error = NULL;
+ gboolean ret;
+ GSocketType type;
+ GSocketAddress *effective_address;
+ PyGObject *address, *py_source_object = NULL;
+ GObject *source_object;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!OO|O!:gio.SocketListener.add_address",
+ kwlist,
+ &PyGSocketAddress_Type, &address,
+ &py_type, &py_protocol,
+ &PyGObject_Type, &source_object,
+ &PyGSocketAddress_Type, &effective_address))
+ return NULL;
+
+ if (pyg_enum_get_value(G_TYPE_SOCKET_TYPE, py_type, (gpointer)&type))
+ return NULL;
+
+ if (pyg_enum_get_value(G_TYPE_SOCKET_PROTOCOL, py_protocol, (gpointer)&protocol))
+ return NULL;
+
+ if (py_source_object == NULL || (PyObject*)py_source_object == Py_None)
+ source_object = NULL;
+ else if (pygobject_check(py_source_object, &PyGObject_Type))
+ source_object = G_OBJECT(py_source_object->obj);
+ else {
+ PyErr_SetString(PyExc_TypeError, "source_object should be a gobject.GObject or None");
+ return NULL;
+ }
+
+ ret = g_socket_listener_add_address(G_SOCKET_LISTENER(self->obj),
+ G_SOCKET_ADDRESS(address->obj),
+ type, protocol,
+ source_object,
+ &effective_address,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (ret)
+ return pygobject_new((GObject *)effective_address);
+ else {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+}
+%%
+override g_socket_listener_accept kwargs
+static PyObject *
+_wrap_g_socket_listener_accept(PyGObject *self, PyObject *args, PyObject *kwargs)
+{
+ static char *kwlist[] = { "cancellable", NULL };
+ GError *error = NULL;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ PyObject *py_connection, *py_source_object;
+ GObject *source_object;
+ GSocketConnection *connection;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"|O:gio.SocketListener.accept",
+ kwlist,
+ &py_cancellable))
+ return NULL;
+
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ connection = g_socket_listener_accept(G_SOCKET_LISTENER(self->obj),
+ &source_object,
+ cancellable,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (connection)
+ py_connection = pygobject_new((GObject *)connection);
+ else {
+ py_connection = Py_None;
+ Py_INCREF(py_connection);
+ }
+
+ if (source_object)
+ py_source_object = pygobject_new((GObject *)source_object);
+ else {
+ py_source_object= Py_None;
+ Py_INCREF(py_source_object);
+ }
+ return Py_BuildValue("(NN)", py_connection, py_source_object);
+}
+%%
+override g_socket_listener_accept_async kwargs
+static PyObject *
+_wrap_g_socket_listener_accept_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:gio.SocketListener.accept_async",
+ kwlist,
+ ¬ify->callback,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_socket_listener_accept_async(G_SOCKET_LISTENER(self->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_socket_listener_accept_finish kwargs
+static PyObject *
+_wrap_g_socket_listener_accept_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ GError *error = NULL;
+ PyGObject *result;
+ PyObject *py_connection, *py_source_object;
+ GObject *source_object;
+ GSocketConnection *connection;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:gio.SocketListener.accept_finish",
+ kwlist,
+ &PyGAsyncResult_Type, &result))
+ return NULL;
+
+ connection = g_socket_listener_accept_finish(G_SOCKET_LISTENER(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &source_object,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (connection)
+ py_connection = pygobject_new((GObject *)connection);
+ else {
+ py_connection = Py_None;
+ Py_INCREF(py_connection);
+ }
+
+ if (source_object)
+ py_source_object = pygobject_new((GObject *)source_object);
+ else {
+ py_source_object= Py_None;
+ Py_INCREF(py_source_object);
+ }
+ return Py_BuildValue("(NN)", py_connection, py_source_object);
+}
+%%
+override g_socket_listener_accept_socket kwargs
+static PyObject *
+_wrap_g_socket_listener_accept_socket(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "cancellable", NULL };
+ GError *error = NULL;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+ PyObject *py_socket, *py_source_object;
+ GObject *source_object;
+ GSocket *socket;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"|O:gio.SocketListener.accept_socket",
+ kwlist,
+ &py_cancellable))
+ return NULL;
+
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ return NULL;
+
+ socket = g_socket_listener_accept_socket(G_SOCKET_LISTENER(self->obj),
+ &source_object,
+ cancellable,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (socket)
+ py_socket = pygobject_new((GObject *)socket);
+ else {
+ py_socket = Py_None;
+ Py_INCREF(py_socket);
+ }
+
+ if (source_object)
+ py_source_object = pygobject_new((GObject *)source_object);
+ else {
+ py_source_object= Py_None;
+ Py_INCREF(py_source_object);
+ }
+ return Py_BuildValue("(NN)", py_socket, py_source_object);
+}
+%%
+override g_socket_listener_accept_socket_async kwargs
+static PyObject *
+_wrap_g_socket_listener_accept_socket_async(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyGObject *py_cancellable = NULL;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OO:gio.SocketListener.accept_socket_async",
+ kwlist,
+ ¬ify->callback,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_socket_listener_accept_socket_async(G_SOCKET_LISTENER(self->obj),
+ cancellable,
+ (GAsyncReadyCallback) async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_socket_listener_accept_socket_finish kwargs
+static PyObject *
+_wrap_g_socket_listener_accept_socket_finish(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "result", NULL };
+ GError *error = NULL;
+ PyGObject *result;
+ PyObject *py_socket, *py_source_object;
+ GObject *source_object;
+ GSocket *socket;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:gio.SocketListener.accept_socket_finish",
+ kwlist,
+ &PyGAsyncResult_Type, &result))
+ return NULL;
+
+ socket = g_socket_listener_accept_socket_finish(G_SOCKET_LISTENER(self->obj),
+ G_ASYNC_RESULT(result->obj),
+ &source_object,
+ &error);
+
+ if (pyg_error_check(&error))
+ return NULL;
+
+ if (socket)
+ py_socket = pygobject_new((GObject *)socket);
+ else {
+ py_socket= Py_None;
+ Py_INCREF(py_socket);
+ }
+
+ if (source_object)
+ py_source_object = pygobject_new((GObject *)source_object);
+ else {
+ py_source_object= Py_None;
+ Py_INCREF(py_source_object);
+ }
+ return Py_BuildValue("(NN)", py_socket, py_source_object);
+}
+
+/* Could not write method GSocketAddress.to_native: No ArgType for gpointer */
+/* Could not write method GSocket.receive_from: No ArgType for GSocketAddress** */
+/* Could not write method GSocket.receive_message: No ArgType for GSocketAddress** */
+/* Could not write method GSocket.send_message: No ArgType for GOutputVector* */
+/* Could not write method GSocket.create_source: No ArgType for GIOCondition */
+/* Could not write method GSocketControlMessage.serialize: No ArgType for gpointer */
+/* Could not write function socket_address_new_from_native: No ArgType for gpointer */
+/* Could not write function socket_control_message_deserialize: No ArgType for gpointer */
diff --git a/gio/gvolume.override b/gio/gvolume.override
new file mode 100644
index 0000000..89c27e4
--- /dev/null
+++ b/gio/gvolume.override
@@ -0,0 +1,237 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * Copyright (C) 2008 Johan Dahlin
+ *
+ * gvolume.override: module overrides for GVolume
+ *
+ * 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_volume_mount kwargs
+static PyObject *
+_wrap_g_volume_mount(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "mount_operation", "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *py_mount_operation = NULL;
+ GMountOperation *mount_operation = NULL;
+ PyGObject *py_cancellable = NULL;
+ GMountMountFlags flags = G_MOUNT_MOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "OO|OOO:Volume.mount",
+ kwlist,
+ &py_mount_operation,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if ((PyObject *)py_mount_operation == Py_None)
+ mount_operation = NULL;
+
+ else if (py_mount_operation && pygobject_check(py_mount_operation,
+ &PyGMountOperation_Type))
+ mount_operation = G_MOUNT_OPERATION(py_mount_operation->obj);
+
+ else if (py_mount_operation) {
+ PyErr_SetString(PyExc_TypeError,
+ "mount_operation should be a GMountOperation or None");
+ return NULL;
+ }
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_MOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_volume_mount(G_VOLUME(self->obj),
+ flags,
+ mount_operation,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override g_volume_eject kwargs
+static PyObject *
+_wrap_g_volume_eject(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOO:Volume.eject",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_volume_eject(G_VOLUME(self->obj),
+ flags,
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
+%%
+override-slot GVolume.tp_repr
+static PyObject *
+_wrap_g_volume_tp_repr(PyGObject *self)
+{
+ char *name = g_volume_get_name(G_VOLUME(self->obj));
+ gchar *representation;
+ PyObject *result;
+
+ if (name) {
+ representation = g_strdup_printf("<%s at %p: %s>", self->ob_type->tp_name, self, name);
+ g_free(name);
+ }
+ else
+ representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", self->ob_type->tp_name, self);
+
+ result = PyString_FromString(representation);
+ g_free(representation);
+ return result;
+}
+%%
+override g_volume_enumerate_identifiers noargs
+static PyObject *
+_wrap_g_volume_enumerate_identifiers (PyGObject *self)
+{
+ char **ids;
+ PyObject *ret;
+
+ pyg_begin_allow_threads;
+
+ ids = g_volume_enumerate_identifiers(G_VOLUME (self->obj));
+
+ pyg_end_allow_threads;
+
+ if (ids && ids[0] != NULL) {
+ ret = strv_to_pylist(ids);
+ g_strfreev (ids);
+ } else {
+ ret = Py_None;
+ Py_INCREF(ret);
+ }
+ return ret;
+}
+%%
+override g_volume_eject_with_operation kwargs
+static PyObject *
+_wrap_g_volume_eject_with_operation(PyGObject *self,
+ PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "callback", "flags", "mount_operation",
+ "cancellable", "user_data", NULL };
+ PyGIONotify *notify;
+ PyObject *py_flags = NULL;
+ PyGObject *mount_operation;
+ PyGObject *py_cancellable = NULL;
+ GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE;
+ GCancellable *cancellable;
+
+ notify = pygio_notify_new();
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "O|OOOO:gio.Volume.eject_with_operation",
+ kwlist,
+ ¬ify->callback,
+ &py_flags,
+ &mount_operation,
+ &py_cancellable,
+ ¬ify->data))
+ goto error;
+
+ if (!pygio_notify_callback_is_valid(notify))
+ goto error;
+
+ if (py_flags && pyg_flags_get_value(G_TYPE_MOUNT_UNMOUNT_FLAGS,
+ py_flags, (gpointer)&flags))
+ goto error;
+
+ if (!pygio_check_cancellable(py_cancellable, &cancellable))
+ goto error;
+
+ pygio_notify_reference_callback(notify);
+
+ g_volume_eject_with_operation(G_VOLUME(self->obj),
+ flags,
+ G_MOUNT_OPERATION(mount_operation->obj),
+ cancellable,
+ (GAsyncReadyCallback)async_result_callback_marshal,
+ notify);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+
+ error:
+ pygio_notify_free(notify);
+ return NULL;
+}
diff --git a/gio/gvolumemonitor.override b/gio/gvolumemonitor.override
new file mode 100644
index 0000000..4ffedf3
--- /dev/null
+++ b/gio/gvolumemonitor.override
@@ -0,0 +1,94 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygobject - Python bindings for GObject
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+override-slot GVolumeMonitor.tp_new
+static PyObject *
+_wrap_g_volume_monitor_tp_new(PyObject *type, PyObject *args, PyObject *kwargs)
+{
+ return pygobject_new(G_OBJECT(g_volume_monitor_get()));
+}
+%%
+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_object_unref(drive);
+ }
+ 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_object_unref(volume);
+ }
+ 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_object_unref(mount);
+ }
+ g_list_free(list);
+
+ return ret;
+}
diff --git a/gio/pygio-utils.c b/gio/pygio-utils.c
new file mode 100644
index 0000000..f89c4b9
--- /dev/null
+++ b/gio/pygio-utils.c
@@ -0,0 +1,236 @@
+/* -*- Mode: C; c-basic-offset: 4 -*-
+ * pygtk- Python bindings for the GTK toolkit.
+ * Copyright (C) 2008 Johan Dahlin
+ * Copyright (C) 2008 Gian Mario Tagliaretti
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+
+#include "pygio-utils.h"
+#include <pyglib-python-compat.h>
+
+/**
+ * pygio_check_cancellable:
+ * @pycancellable:
+ * @cancellable:
+ *
+ * Returns:
+ */
+gboolean
+pygio_check_cancellable(PyGObject *pycancellable,
+ GCancellable **cancellable)
+{
+ if (pycancellable == NULL || (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 FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * pygio_check_launch_context:
+ * @pycontext:
+ * @context:
+ *
+ * Returns:
+ */
+gboolean
+pygio_check_launch_context(PyGObject *pycontext,
+ GAppLaunchContext **context)
+{
+ if (pycontext == NULL || (PyObject*)pycontext == Py_None)
+ *context = NULL;
+ else if (pygobject_check(pycontext, &PyGAppLaunchContext_Type))
+ *context = G_APP_LAUNCH_CONTEXT(pycontext->obj);
+ else
+ {
+ PyErr_SetString(PyExc_TypeError,
+ "launch_context should be a GAppLaunchContext or None");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * pygio_pylist_to_gfile_glist:
+ * @pyfile_list:
+ *
+ * Returns:
+ */
+GList *
+pygio_pylist_to_gfile_glist(PyObject *pyfile_list)
+{
+ GList *file_list = NULL;
+ PyObject *item;
+ int len, i;
+
+ len = PySequence_Size(pyfile_list);
+ for (i = 0; i < len; i++) {
+ item = PySequence_GetItem(pyfile_list, i);
+ if (!PyObject_TypeCheck(item, &PyGFile_Type)) {
+ PyErr_SetString(PyExc_TypeError,
+ "files must be a list or tuple of GFile");
+ g_list_free(file_list);
+ return NULL;
+ }
+ file_list = g_list_prepend(file_list, ((PyGObject *)item)->obj);
+ }
+ file_list = g_list_reverse(file_list);
+
+ return file_list;
+}
+
+/**
+ * pygio_pylist_to_uri_glist:
+ * @pyfile_list:
+ *
+ * Returns:
+ */
+GList *
+pygio_pylist_to_uri_glist(PyObject *pyfile_list)
+{
+ GList *file_list = NULL;
+ PyObject *item;
+ int len, i;
+
+ len = PySequence_Size(pyfile_list);
+ for (i = 0; i < len; i++) {
+ item = PySequence_GetItem(pyfile_list, i);
+ if (!PYGLIB_PyUnicode_Check(item)) {
+ PyErr_SetString(PyExc_TypeError,
+ "files must be strings");
+ g_list_free(file_list);
+ return NULL;
+ }
+
+#if PY_VERSION_HEX < 0x03000000
+ file_list = g_list_prepend(file_list, g_strdup(PyString_AsString(item)));
+#else
+ {
+ PyObject *utf8_bytes_obj = PyUnicode_AsUTF8String (item);
+ if (!utf8_bytes_obj) {
+ g_list_free(file_list);
+ return NULL;
+ }
+ file_list = g_list_prepend(file_list, g_strdup(PyBytes_AsString(utf8_bytes_obj)));
+ Py_DECREF (utf8_bytes_obj);
+ }
+#endif
+
+ }
+ file_list = g_list_reverse(file_list);
+
+ return file_list;
+}
+
+/**
+ * strv_to_pylist:
+ * @strv: array of strings
+ *
+ * Returns: A python list of strings
+ */
+PyObject *
+strv_to_pylist (char **strv)
+{
+ gsize len, i;
+ PyObject *list;
+
+ len = strv ? g_strv_length (strv) : 0;
+ list = PyList_New (len);
+
+ for (i = 0; i < len; i++) {
+ PyList_SetItem (list, i, PYGLIB_PyUnicode_FromString (strv[i]));
+ }
+ return list;
+}
+
+/**
+ * pylist_to_strv:
+ * @strvp: a pointer to an array where return strings.
+ *
+ * Returns: TRUE if the list of strings could be converted, FALSE otherwise.
+ */
+gboolean
+pylist_to_strv (PyObject *list,
+ char ***strvp)
+{
+ int i, len;
+ char **ret;
+
+ *strvp = NULL;
+
+ if (list == Py_None)
+ return TRUE;
+
+ if (!PySequence_Check (list))
+ {
+ PyErr_Format (PyExc_TypeError, "argument must be a list or tuple of strings");
+ return FALSE;
+ }
+
+ if ((len = PySequence_Size (list)) < 0)
+ return FALSE;
+
+ ret = g_new (char*, len + 1);
+ for (i = 0; i <= len; ++i)
+ ret[i] = NULL;
+
+ for (i = 0; i < len; ++i)
+ {
+ PyObject *item = PySequence_GetItem (list, i);
+
+ if (!item)
+ {
+ g_strfreev (ret);
+ return FALSE;
+ }
+
+ if (!PYGLIB_PyUnicode_Check (item))
+ {
+ Py_DECREF (item);
+ g_strfreev (ret);
+ PyErr_Format (PyExc_TypeError, "argument must be a list of strings");
+ return FALSE;
+ }
+
+#if PY_VERSION_HEX < 0x03000000
+ ret[i] = g_strdup (PyString_AsString (item));
+#else
+ {
+ PyObject *utf8_bytes_obj = PyUnicode_AsUTF8String (item);
+ if (!utf8_bytes_obj) {
+ Py_DECREF (item);
+ g_strfreev (ret);
+ return FALSE;
+ }
+ ret[i] = g_strdup (PyBytes_AsString(utf8_bytes_obj));
+ Py_DECREF (utf8_bytes_obj);
+ }
+#endif
+ Py_DECREF (item);
+ }
+
+ *strvp = ret;
+ return TRUE;
+}
diff --git a/gio/pygio-utils.h b/gio/pygio-utils.h
new file mode 100644
index 0000000..76bfde3
--- /dev/null
+++ b/gio/pygio-utils.h
@@ -0,0 +1,49 @@
+/* -*- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+
+#ifndef __PYGIO_UTILS_H__
+#define __PYGIO_UTILS_H__
+
+#define NO_IMPORT_PYGOBJECT
+#include <Python.h>
+#include <pygobject.h>
+#include <gio/gio.h>
+
+extern PyTypeObject PyGCancellable_Type;
+extern PyTypeObject PyGAppLaunchContext_Type;
+extern PyTypeObject PyGFile_Type;
+
+gboolean pygio_check_cancellable(PyGObject *pycancellable,
+ GCancellable **cancellable);
+
+gboolean pygio_check_launch_context(PyGObject *pycontext,
+ GAppLaunchContext **context);
+
+GList* pygio_pylist_to_gfile_glist(PyObject *pycontext);
+
+GList* pygio_pylist_to_uri_glist(PyObject *pycontext);
+
+PyObject* strv_to_pylist (char **strv);
+
+gboolean pylist_to_strv (PyObject *list, char ***strvp);
+
+#endif /* __PYGIO_UTILS_H__ */
diff --git a/gio/unix-types.defs b/gio/unix-types.defs
new file mode 100644
index 0000000..ed1ed9f
--- /dev/null
+++ b/gio/unix-types.defs
@@ -0,0 +1,55 @@
+;; -*- scheme -*-
+
+(define-object Connection
+ (in-module "giounix")
+ (parent "GSocketConnection")
+ (c-name "GUnixConnection")
+ (gtype-id "G_TYPE_UNIX_CONNECTION")
+)
+
+(define-object DesktopAppInfo
+ (docstring
+ "DesktopAppInfo(desktop_id) -> gio.unix.DesktopAppInfo\n\n"
+ "gio.Unix.DesktopAppInfo is an implementation of gio.AppInfo\n"
+ "based on desktop files."
+ )
+ (in-module "giounix")
+ (parent "GObject")
+ (c-name "GDesktopAppInfo")
+ (gtype-id "G_TYPE_DESKTOP_APP_INFO")
+)
+
+(define-object FDMessage
+ (in-module "giounix")
+ (parent "GSocketControlMessage")
+ (c-name "GUnixFDMessage")
+ (gtype-id "G_TYPE_UNIX_FD_MESSAGE")
+)
+
+(define-object InputStream
+ (in-module "giounix")
+ (parent "GInputStream")
+ (c-name "GUnixInputStream")
+ (gtype-id "G_TYPE_UNIX_INPUT_STREAM")
+)
+
+(define-object OutputStream
+ (in-module "giounix")
+ (parent "GOutputStream")
+ (c-name "GUnixOutputStream")
+ (gtype-id "G_TYPE_UNIX_OUTPUT_STREAM")
+)
+
+(define-pointer MountEntry
+ (in-module "giounix")
+ (c-name "GUnixMountEntry")
+ (gtype-id "GIO_UNIX_MOUNT_ENTRY_TYPE")
+)
+
+(define-object SocketAddress
+ (in-module "giounix")
+ (parent "GSocketAddress")
+ (c-name "GUnixSocketAddress")
+ (gtype-id "G_TYPE_UNIX_SOCKET_ADDRESS")
+)
+
diff --git a/gio/unix.defs b/gio/unix.defs
new file mode 100644
index 0000000..ff43ed6
--- /dev/null
+++ b/gio/unix.defs
@@ -0,0 +1,475 @@
+;; -*- scheme -*-
+
+(include "unix-types.defs")
+
+;; From gunixconnection.h
+
+(define-function g_unix_connection_get_type
+ (c-name "g_unix_connection_get_type")
+ (return-type "GType")
+)
+
+(define-method send_fd
+ (of-object "GUnixConnection")
+ (c-name "g_unix_connection_send_fd")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "fd")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+(define-method receive_fd
+ (of-object "GUnixConnection")
+ (c-name "g_unix_connection_receive_fd")
+ (return-type "gint")
+ (parameters
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gdesktopappinfo.h
+
+(define-function desktop_app_info_get_type
+ (c-name "g_desktop_app_info_get_type")
+ (return-type "GType")
+)
+
+(define-function desktop_app_info_new_from_filename
+ (c-name "g_desktop_app_info_new_from_filename")
+ (return-type "GDesktopAppInfo*")
+ (parameters
+ '("const-char*" "filename")
+ )
+)
+
+(define-function g_desktop_app_info_new_from_keyfile
+ (c-name "g_desktop_app_info_new_from_keyfile")
+ (return-type "GDesktopAppInfo*")
+ (parameters
+ '("GKeyFile*" "key_file")
+ )
+)
+
+(define-function desktop_app_info_new
+ (c-name "g_desktop_app_info_new")
+ (is-constructor-of "GDesktopAppInfo")
+ (return-type "GDesktopAppInfo*")
+ (parameters
+ '("const-char*" "desktop_id")
+ )
+)
+
+(define-method get_is_hidden
+ (of-object "GDesktopAppInfo")
+ (c-name "g_desktop_app_info_get_is_hidden")
+ (return-type "gboolean")
+)
+
+(define-function desktop_app_info_set_desktop_env
+ (c-name "g_desktop_app_info_set_desktop_env")
+ (return-type "none")
+ (parameters
+ '("const-char*" "desktop_env")
+ )
+)
+
+
+
+;; From gunixfdmessage.h
+
+(define-function g_unix_fd_message_get_type
+ (c-name "g_unix_fd_message_get_type")
+ (return-type "GType")
+)
+
+(define-function g_unix_fd_message_new
+ (c-name "g_unix_fd_message_new")
+ (is-constructor-of "GUnixFdMessage")
+ (return-type "GSocketControlMessage*")
+)
+
+(define-method steal_fds
+ (of-object "GUnixFDMessage")
+ (c-name "g_unix_fd_message_steal_fds")
+ (return-type "gint*")
+ (parameters
+ '("gint*" "length")
+ )
+)
+
+(define-method append_fd
+ (of-object "GUnixFDMessage")
+ (c-name "g_unix_fd_message_append_fd")
+ (return-type "gboolean")
+ (parameters
+ '("gint" "fd")
+ '("GError**" "error")
+ )
+)
+
+
+
+;; From gunixmounts.h
+
+(define-function unix_mount_free
+ (c-name "g_unix_mount_free")
+ (return-type "none")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-method free
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_free")
+ (return-type "none")
+)
+
+(define-function unix_mount_compare
+ (c-name "g_unix_mount_compare")
+ (return-type "gint")
+ (parameters
+ '("GUnixMountEntry*" "mount1")
+ '("GUnixMountEntry*" "mount2")
+ )
+)
+
+(define-function unix_mount_get_mount_path
+ (c-name "g_unix_mount_get_mount_path")
+ (return-type "const-char*")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_get_device_path
+ (c-name "g_unix_mount_get_device_path")
+ (return-type "const-char*")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_get_fs_type
+ (c-name "g_unix_mount_get_fs_type")
+ (return-type "const-char*")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_is_readonly
+ (c-name "g_unix_mount_is_readonly")
+ (return-type "gboolean")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_is_system_internal
+ (c-name "g_unix_mount_is_system_internal")
+ (return-type "gboolean")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_guess_can_eject
+ (c-name "g_unix_mount_guess_can_eject")
+ (return-type "gboolean")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_guess_should_display
+ (c-name "g_unix_mount_guess_should_display")
+ (return-type "gboolean")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_guess_name
+ (c-name "g_unix_mount_guess_name")
+ (return-type "char*")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-function unix_mount_guess_icon
+ (c-name "g_unix_mount_guess_icon")
+ (return-type "GIcon*")
+ (parameters
+ '("GUnixMountEntry*" "mount_entry")
+ )
+)
+
+(define-method compare
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_compare")
+ (return-type "gint")
+ (parameters
+ '("GUnixMountPoint*" "mount2")
+ )
+)
+
+(define-method get_mount_path
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_get_mount_path")
+ (return-type "const-char*")
+)
+
+(define-method get_device_path
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_get_device_path")
+ (return-type "const-char*")
+)
+
+(define-method get_fs_type
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_get_fs_type")
+ (return-type "const-char*")
+)
+
+(define-method is_readonly
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_is_readonly")
+ (return-type "gboolean")
+)
+
+(define-method is_user_mountable
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_is_user_mountable")
+ (return-type "gboolean")
+)
+
+(define-method is_loopback
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_is_loopback")
+ (return-type "gboolean")
+)
+
+(define-method guess_can_eject
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_guess_can_eject")
+ (return-type "gboolean")
+)
+
+(define-method guess_name
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_guess_name")
+ (return-type "char*")
+)
+
+(define-method guess_icon
+ (of-object "GUnixMountPoint")
+ (c-name "g_unix_mount_point_guess_icon")
+ (return-type "GIcon*")
+)
+
+(define-function unix_mount_points_get
+ (c-name "g_unix_mount_points_get")
+ (return-type "GList*")
+ (parameters
+ '("guint64*" "time_read")
+ )
+)
+
+(define-function unix_mounts_get
+ (c-name "g_unix_mounts_get")
+ (return-type "GList*")
+ (parameters
+ '("guint64*" "time_read")
+ )
+)
+
+(define-function unix_mount_at
+ (c-name "g_unix_mount_at")
+ (return-type "GUnixMountEntry*")
+ (parameters
+ '("const-char*" "mount_path")
+ '("guint64*" "time_read")
+ )
+)
+
+(define-function unix_mounts_changed_since
+ (c-name "g_unix_mounts_changed_since")
+ (return-type "gboolean")
+ (parameters
+ '("guint64" "time")
+ )
+)
+
+(define-function unix_mount_points_changed_since
+ (c-name "g_unix_mount_points_changed_since")
+ (return-type "gboolean")
+ (parameters
+ '("guint64" "time")
+ )
+)
+
+(define-function unix_mount_monitor_get_type
+ (c-name "g_unix_mount_monitor_get_type")
+ (return-type "GType")
+)
+
+(define-function unix_mount_monitor_new
+ (c-name "g_unix_mount_monitor_new")
+ (is-constructor-of "GUnixMountMonitor")
+ (return-type "GUnixMountMonitor*")
+)
+
+(define-method set_rate_limit
+ (of-object "GUnixMountMonitor")
+ (c-name "g_unix_mount_monitor_set_rate_limit")
+ (return-type "none")
+ (parameters
+ '("int" "limit_msec")
+ )
+)
+
+(define-function unix_is_mount_path_system_internal
+ (c-name "g_unix_is_mount_path_system_internal")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "mount_path")
+ )
+)
+
+
+
+;; 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")
+ )
+)
+
+(define-method set_close_fd
+ (of-object "GUnixInputStream")
+ (c-name "g_unix_input_stream_set_close_fd")
+ (return-type "none")
+ (parameters
+ '("gboolean" "close_fd")
+ )
+)
+
+(define-method get_close_fd
+ (of-object "GUnixInputStream")
+ (c-name "g_unix_input_stream_get_close_fd")
+ (return-type "gboolean")
+)
+
+(define-method get_fd
+ (of-object "GUnixInputStream")
+ (c-name "g_unix_input_stream_get_fd")
+ (return-type "gint")
+)
+
+
+
+;; From gunixoutputstream.h
+
+(define-function unix_output_stream_get_type
+ (c-name "g_unix_output_stream_get_type")
+ (return-type "GType")
+)
+
+(define-function unix_output_stream_new
+ (c-name "g_unix_output_stream_new")
+ (is-constructor-of "GUnixOutputStream")
+ (return-type "GOutputStream*")
+ (parameters
+ '("int" "fd")
+ '("gboolean" "close_fd_at_close")
+ )
+)
+
+(define-method set_close_fd
+ (of-object "GUnixOutputStream")
+ (c-name "g_unix_output_stream_set_close_fd")
+ (return-type "none")
+ (parameters
+ '("gboolean" "close_fd")
+ )
+)
+
+(define-method get_close_fd
+ (of-object "GUnixOutputStream")
+ (c-name "g_unix_output_stream_get_close_fd")
+ (return-type "gboolean")
+)
+
+(define-method get_fd
+ (of-object "GUnixOutputStream")
+ (c-name "g_unix_output_stream_get_fd")
+ (return-type "gint")
+)
+
+
+
+;; From gunixsocketaddress.h
+
+(define-function g_unix_socket_address_get_type
+ (c-name "g_unix_socket_address_get_type")
+ (return-type "GType")
+)
+
+(define-function g_unix_socket_address_new
+ (c-name "g_unix_socket_address_new")
+ (is-constructor-of "GUnixSocketAddress")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("const-gchar*" "path")
+ )
+)
+
+(define-function g_unix_socket_address_new_abstract
+ (c-name "g_unix_socket_address_new_abstract")
+ (return-type "GSocketAddress*")
+ (parameters
+ '("const-gchar*" "path")
+ '("int" "path_len")
+ )
+)
+
+(define-method get_path
+ (of-object "GUnixSocketAddress")
+ (c-name "g_unix_socket_address_get_path")
+ (return-type "const-char*")
+)
+
+(define-method get_path_len
+ (of-object "GUnixSocketAddress")
+ (c-name "g_unix_socket_address_get_path_len")
+ (return-type "gsize")
+)
+
+(define-method get_is_abstract
+ (of-object "GUnixSocketAddress")
+ (c-name "g_unix_socket_address_get_is_abstract")
+ (return-type "gboolean")
+)
+
+(define-function g_unix_socket_address_abstract_names_supported
+ (c-name "g_unix_socket_address_abstract_names_supported")
+ (return-type "gboolean")
+)
+
diff --git a/gio/unix.override b/gio/unix.override
new file mode 100644
index 0000000..aebc6fc
--- /dev/null
+++ b/gio/unix.override
@@ -0,0 +1,62 @@
+/* -*- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+%%
+headers
+#define NO_IMPORT_PYGOBJECT
+#include <pygobject.h>
+#include <gio/gio.h>
+#include <gio/gdesktopappinfo.h>
+#include <gio/gunixinputstream.h>
+#include <gio/gunixmounts.h>
+#include <gio/gunixoutputstream.h>
+#define GIO_COMPILATION
+#include <gio/gunixconnection.h>
+#undef GIO_COMPILATION
+#include <gio/gunixfdmessage.h>
+#include <gio/gunixsocketaddress.h>
+
+#define GIO_UNIX_MOUNT_ENTRY_TYPE (_gio_unix_mount_entry_get_type ())
+
+static GType _gio_unix_mount_entry_get_type (void)
+{
+ static GType our_type = 0;
+
+ if (our_type == 0)
+ our_type = g_pointer_type_register_static ("GUnixMountEntry");
+
+ return our_type;
+}
+
+%%
+modulename gio.unix
+%%
+import gobject.GObject as PyGObject_Type
+import gio.InputStream as PyGInputStream_Type
+import gio.OutputStream as PyGOutputStream_Type
+import gio.SocketAddress as PyGSocketAddress_Type
+import gio.Cancellable as PyGCancellable_Type
+import gio.SocketConnection as PyGSocketConnection_Type
+import gio.SocketControlMessage as PyGSocketControlMessage_Type
+%%
+ignore-glob
+ *_get_type
+%%
diff --git a/gio/unixmodule.c b/gio/unixmodule.c
new file mode 100644
index 0000000..7a49856
--- /dev/null
+++ b/gio/unixmodule.c
@@ -0,0 +1,52 @@
+/* -*- 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+#include <Python.h>
+#include <pygobject.h>
+
+#include <gio/gio.h>
+
+/* include any extra headers needed here */
+
+void pyunix_register_classes(PyObject *d);
+void pyunix_add_constants(PyObject *module, const gchar *strip_prefix);
+
+extern PyMethodDef pyunix_functions[];
+
+DL_EXPORT(void)
+initunix(void)
+{
+ PyObject *m, *d;
+
+ /* perform any initialisation required by the library here */
+
+ m = Py_InitModule("gio.unix", pyunix_functions);
+ d = PyModule_GetDict(m);
+
+ init_pygobject();
+
+ pyunix_register_classes(d);
+
+}
+
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 23d049b..7e2ccd9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -80,6 +80,15 @@ TEST_FILES = \
test_thread.py \
test_uris.py
+if BUILD_GIO
+TEST_FILES += \
+ test_gio.py \
+ test_gresolver.py \
+ test_gsocket.py \
+ test_gicon.py \
+ test_gcancellable.py
+endif
+
if ENABLE_INTROSPECTION
TEST_FILES += \
test_everything.py \
diff --git a/tests/runtests-windows.py b/tests/runtests-windows.py
index 6915a3c..90154b4 100644
--- a/tests/runtests-windows.py
+++ b/tests/runtests-windows.py
@@ -16,6 +16,9 @@ gobject.threads_init()
SKIP_FILES = ['runtests',
+ 'test_gio', # python crash
+ 'test_gresolver', # python crash
+ 'test_gsocket', # blocks on test_socket_condition_wait
'test_mainloop', # no os.fork on windows
'test_subprocess'] # blocks on testChildWatch
diff --git a/tests/test_gcancellable.py b/tests/test_gcancellable.py
new file mode 100644
index 0000000..f911572
--- /dev/null
+++ b/tests/test_gcancellable.py
@@ -0,0 +1,15 @@
+# -*- Mode: Python -*-
+
+import unittest
+
+import glib
+import gio
+
+
+class TestResolver(unittest.TestCase):
+ def setUp(self):
+ self.cancellable = gio.Cancellable()
+
+ def test_make_poll_fd(self):
+ poll = self.cancellable.make_pollfd()
+ self.failUnless(isinstance(poll, glib.PollFD))
diff --git a/tests/test_gicon.py b/tests/test_gicon.py
new file mode 100644
index 0000000..b9af6ff
--- /dev/null
+++ b/tests/test_gicon.py
@@ -0,0 +1,112 @@
+# -*- Mode: Python -*-
+
+import os
+import unittest
+
+import glib
+import gio
+
+
+class TestIcon(unittest.TestCase):
+ def test_eq(self):
+ self.assertEquals(gio.FileIcon(gio.File('foo.png')),
+ gio.FileIcon(gio.File('foo.png')))
+ self.assertEquals(gio.ThemedIcon('foo'),
+ gio.ThemedIcon('foo'))
+
+ self.assertNotEqual(gio.FileIcon(gio.File('foo.png')),
+ gio.FileIcon(gio.File('bar.png')))
+ self.assertNotEquals(gio.ThemedIcon('foo'),
+ gio.ThemedIcon('bar'))
+ self.assertNotEquals(gio.FileIcon(gio.File('foo.png')),
+ gio.ThemedIcon('foo'))
+
+ def test_hash(self):
+ self.assertEquals(hash(gio.FileIcon(gio.File('foo.png'))),
+ hash(gio.FileIcon(gio.File('foo.png'))))
+ self.assertEquals(hash(gio.ThemedIcon('foo')),
+ hash(gio.ThemedIcon('foo')))
+
+class TestLoadableIcon(unittest.TestCase):
+ def setUp(self):
+ self.file = open('temp.svg', 'w')
+ self.svg = ('<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
+ '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" '
+ '"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">'
+ '<svg width="32" height="32"/>')
+ self.file.write(self.svg)
+ self.file.close()
+ self.icon = gio.FileIcon(gio.File('temp.svg'))
+
+ def tearDown(self):
+ if os.path.exists('temp.svg'):
+ os.unlink('temp.svg')
+
+ def test_load(self):
+ stream, type = self.icon.load()
+ try:
+ self.assert_(isinstance(stream, gio.InputStream))
+ self.assertEquals(self.svg, stream.read())
+ finally:
+ stream.close()
+
+ def test_load_async(self):
+ def callback(icon, result):
+ try:
+ stream, type = icon.load_finish(result)
+ self.assert_(isinstance(stream, gio.InputStream))
+ self.assertEquals(self.svg, stream.read())
+ finally:
+ loop.quit()
+ stream.close()
+
+ self.icon.load_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestFileIcon(unittest.TestCase):
+ def test_constructor(self):
+ file = gio.File('foo.png')
+ self.assert_(file is gio.FileIcon(file).get_file())
+
+class TestThemedIcon(unittest.TestCase):
+ def setUp(self):
+ self.icon = gio.ThemedIcon("open")
+
+ def test_constructor(self):
+ have_use_default_fallbacks = ('use_default_fallbacks'
+ in gio.ThemedIcon.props.__members__)
+ icon = gio.ThemedIcon('foo')
+ self.assertEquals(['foo'], icon.props.names)
+ self.assert_(not have_use_default_fallbacks
+ or not icon.props.use_default_fallbacks)
+
+ icon = gio.ThemedIcon(['foo', 'bar', 'baz'])
+ self.assertEquals(['foo', 'bar', 'baz'], icon.props.names)
+ self.assert_(not have_use_default_fallbacks
+ or not icon.props.use_default_fallbacks)
+
+ icon = gio.ThemedIcon('xxx-yyy-zzz', True)
+ self.assertEquals(['xxx-yyy-zzz', 'xxx-yyy', 'xxx'], icon.props.names)
+ self.assert_(not have_use_default_fallbacks
+ or icon.props.use_default_fallbacks)
+
+ def test_constructor_illegals(self):
+ self.assertRaises(TypeError, lambda: gio.ThemedIcon(42))
+ self.assertRaises(TypeError, lambda: gio.ThemedIcon(['foo', 42, 'bar']))
+
+ def test_get_names(self):
+ self.assertEquals(self.icon.get_names(), ['open'])
+
+ def test_append_name(self):
+ self.assertEquals(self.icon.get_names(), ['open'])
+ self.icon.append_name('close')
+ self.assertEquals(self.icon.get_names(), ['open', 'close'])
+
+class TestEmblemedIcon(unittest.TestCase):
+ def test_emblemed_icon(self):
+ icon = gio.FileIcon(gio.File('foo.png'))
+ emblem = gio.Emblem(icon)
+ emblemed = gio.EmblemedIcon(icon, emblem)
+ self.assertEquals(emblemed.get_emblems()[0], emblem)
diff --git a/tests/test_gio.py b/tests/test_gio.py
new file mode 100644
index 0000000..7c8251e
--- /dev/null
+++ b/tests/test_gio.py
@@ -0,0 +1,1138 @@
+# -*- Mode: Python -*-
+
+import os
+import unittest
+
+import glib
+import gio
+
+
+class TestFile(unittest.TestCase):
+ def setUp(self):
+ self._f = open("file.txt", "w+")
+ self.file = gio.File("file.txt")
+
+ def tearDown(self):
+ self._f.close()
+ if os.path.exists('file.txt'):
+ os.unlink("file.txt")
+
+ def testReadAsync(self):
+ self._f.write("testing")
+ self._f.seek(0)
+
+ def callback(file, result):
+ try:
+ stream = file.read_finish(result)
+ self.failUnless(isinstance(stream, gio.InputStream))
+ self.assertEquals(stream.read(), "testing")
+ finally:
+ loop.quit()
+
+ self.file.read_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testAppendToAsync(self):
+ self._f.write("append_to ")
+ self._f.close()
+
+ def callback(file, result):
+ try:
+ stream = file.append_to_finish(result)
+ self.failUnless(isinstance(stream, gio.OutputStream))
+ w = stream.write("testing")
+ cont, leng, etag = self.file.load_contents()
+ self.assertEqual(cont, "append_to testing")
+ finally:
+ loop.quit()
+
+ self.file.append_to_async(callback, gio.FILE_CREATE_NONE,
+ glib.PRIORITY_HIGH)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testAppendToAsyncNoargs(self):
+ self._f.write("append_to ")
+ self._f.close()
+
+ def callback(file, result):
+ try:
+ stream = file.append_to_finish(result)
+ self.failUnless(isinstance(stream, gio.OutputStream))
+ w = stream.write("testing")
+ cont, leng, etag = self.file.load_contents()
+ self.assertEqual(cont, "append_to testing")
+ finally:
+ loop.quit()
+
+ self.file.append_to_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testCreateAsync(self):
+ def callback(file, result):
+ try:
+ stream = file.create_finish(result)
+ self.failUnless(isinstance(stream, gio.OutputStream))
+ w = stream.write("testing")
+ cont, leng, etag = file.load_contents()
+ self.assertEqual(cont, "testing")
+ finally:
+ if os.path.exists('temp.txt'):
+ os.unlink("temp.txt")
+ loop.quit()
+
+ gfile = gio.File("temp.txt")
+ gfile.create_async(callback, gio.FILE_CREATE_NONE,
+ glib.PRIORITY_HIGH)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testCreateReadWriteAsync(self):
+ def callback(file, result):
+ try:
+ iostream = file.create_readwrite_finish(result)
+ self.failUnless(isinstance(iostream, gio.FileIOStream))
+
+ ostream = iostream.get_output_stream()
+ self.failUnless(isinstance(ostream, gio.OutputStream))
+
+ w = ostream.write("testing")
+ cont, leng, etag = file.load_contents()
+ self.assertEqual(cont, "testing")
+ finally:
+ if os.path.exists('temp.txt'):
+ os.unlink("temp.txt")
+ loop.quit()
+
+ gfile = gio.File("temp.txt")
+ gfile.create_readwrite_async(callback, gio.FILE_CREATE_NONE,
+ glib.PRIORITY_HIGH)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testCreateAsyncNoargs(self):
+ def callback(file, result):
+ try:
+ stream = file.create_finish(result)
+ self.failUnless(isinstance(stream, gio.OutputStream))
+ w = stream.write("testing")
+ cont, leng, etag = file.load_contents()
+ self.assertEqual(cont, "testing")
+ finally:
+ if os.path.exists('temp.txt'):
+ os.unlink("temp.txt")
+ loop.quit()
+
+ gfile = gio.File("temp.txt")
+ gfile.create_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testReplaceAsync(self):
+ self._f.write("testing")
+ self._f.close()
+
+ def callback(file, result):
+ try:
+ stream = file.replace_finish(result)
+ self.failUnless(isinstance(stream, gio.OutputStream))
+ stream.write("some new string")
+ stream.close()
+ cont, leng, etag = file.load_contents()
+ self.assertEqual(cont, "some new string")
+ finally:
+ loop.quit()
+
+
+ self.file.replace_async(callback, None, True, gio.FILE_CREATE_NONE,
+ glib.PRIORITY_HIGH)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testReplaceAsyncNoargs(self):
+ self._f.write("testing")
+ self._f.close()
+
+ def callback(file, result):
+ try:
+ stream = file.replace_finish(result)
+ self.failUnless(isinstance(stream, gio.OutputStream))
+ stream.write("some new string")
+ stream.close()
+ cont, leng, etag = file.load_contents()
+ self.assertEqual(cont, "some new string")
+ finally:
+ loop.quit()
+
+
+ self.file.replace_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testReadAsyncError(self):
+ self.assertRaises(TypeError, self.file.read_async)
+ self.assertRaises(TypeError, self.file.read_async, "foo", "bar")
+ self.assertRaises(TypeError, self.file.read_async, "foo",
+ priority="bar")
+ self.assertRaises(TypeError, self.file.read_async, "foo",
+ priority="bar")
+ self.assertRaises(TypeError, self.file.read_async, "foo",
+ priority=1, cancellable="bar")
+ self.assertRaises(TypeError, self.file.read_async, "foo", 1, "bar")
+
+ def testConstructor(self):
+ for gfile in [gio.File("/"),
+ gio.File("file:///"),
+ gio.File(uri="file:///"),
+ gio.File(path="/"),
+ gio.File(u"/"),
+ gio.File(path=u"/")]:
+ self.failUnless(isinstance(gfile, gio.File))
+ self.assertEquals(gfile.get_path(), "/")
+ self.assertEquals(gfile.get_uri(), "file:///")
+
+ def testConstructorError(self):
+ self.assertRaises(TypeError, gio.File)
+ self.assertRaises(TypeError, gio.File, 1)
+ self.assertRaises(TypeError, gio.File, "foo", "bar")
+ self.assertRaises(TypeError, gio.File, foo="bar")
+ self.assertRaises(TypeError, gio.File, uri=1)
+ self.assertRaises(TypeError, gio.File, path=1)
+
+ def testLoadContents(self):
+ self._f.write("testing load_contents")
+ self._f.seek(0)
+ c = gio.Cancellable()
+ cont, leng, etag = self.file.load_contents(cancellable=c)
+ self.assertEqual(cont, "testing load_contents")
+ self.assertEqual(leng, 21)
+ self.assertNotEqual(etag, '')
+
+ def testLoadContentsAsync(self):
+ self._f.write("testing load_contents_async")
+ self._f.seek(0)
+
+ def callback(contents, result):
+ try:
+ cont, leng, etag = contents.load_contents_finish(result)
+ self.assertEqual(cont, "testing load_contents_async")
+ self.assertEqual(leng, 27)
+ self.assertNotEqual(etag, '')
+ finally:
+ loop.quit()
+
+ canc = gio.Cancellable()
+ self.file.load_contents_async(callback, cancellable=canc)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testQueryInfoAsync(self):
+ def callback(file, result):
+ try:
+ info = file.query_info_finish(result)
+ self.failUnless(isinstance(info, gio.FileInfo))
+ self.failUnless(info.get_name(), "file.txt")
+ finally:
+ loop.quit()
+
+ self.file.query_info_async("standard", callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testMountMountable(self):
+ gfile = gio.File('localtest:')
+ def unmount_done(mount, result):
+ try:
+ retval = mount.unmount_finish(result)
+ self.failUnless(retval)
+ finally:
+ loop.quit()
+
+ def mount_enclosing_volume_done(gfile, result):
+ try:
+ try:
+ retval = gfile.mount_enclosing_volume_finish(result)
+ except gio.Error, e:
+ # If we run the tests too fast
+ if e.code == gio.ERROR_ALREADY_MOUNTED:
+ print ('WARNING: testfile is already mounted, '
+ 'skipping test')
+ loop.quit()
+ return
+ raise
+ self.failUnless(retval)
+ finally:
+ try:
+ mount = gfile.find_enclosing_mount()
+ except gio.Error:
+ loop.quit()
+ return
+ mount.unmount(unmount_done)
+
+ mount_operation = gio.MountOperation()
+ gfile.mount_enclosing_volume(mount_operation,
+ mount_enclosing_volume_done)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testCopy(self):
+ if os.path.exists('copy.txt'):
+ os.unlink("copy.txt")
+
+ source = gio.File('file.txt')
+ destination = gio.File('copy.txt')
+ try:
+ retval = source.copy(destination)
+ self.failUnless(retval)
+
+ self.failUnless(os.path.exists('copy.txt'))
+ self.assertEqual(open('file.txt').read(),
+ open('copy.txt').read())
+ finally:
+ os.unlink("copy.txt")
+
+ self.called = False
+ def callback(current, total):
+ self.called = True
+ source = gio.File('file.txt')
+ destination = gio.File('copy.txt')
+ try:
+ retval = source.copy(destination, callback)
+ self.failUnless(retval)
+
+ self.failUnless(os.path.exists('copy.txt'))
+ self.assertEqual(open('file.txt').read(),
+ open('copy.txt').read())
+ self.failUnless(self.called)
+ finally:
+ os.unlink("copy.txt")
+
+ def test_copy_async(self):
+ if os.path.exists('copy.txt'):
+ os.unlink("copy.txt")
+
+ source = gio.File('file.txt')
+ destination = gio.File('copy.txt')
+
+ def copied(source_, result):
+ try:
+ self.assert_(source_ is source)
+ self.failUnless(source_.copy_finish(result))
+ finally:
+ loop.quit()
+
+ def progress(current, total):
+ self.assert_(isinstance(current, long))
+ self.assert_(isinstance(total, long))
+ self.assert_(0 <= current <= total)
+
+ try:
+ loop = glib.MainLoop()
+ source.copy_async(destination, copied, progress_callback = progress)
+ loop.run()
+
+ self.failUnless(os.path.exists('copy.txt'))
+ self.assertEqual(open('file.txt').read(),
+ open('copy.txt').read())
+ finally:
+ os.unlink("copy.txt")
+
+ # See bug 546591.
+ def test_copy_progress(self):
+ source = gio.File('file.txt')
+ destination = gio.File('copy.txt')
+
+ def progress(current, total):
+ self.assert_(isinstance(current, long))
+ self.assert_(isinstance(total, long))
+ self.assert_(0 <= current <= total)
+
+ try:
+ retval = source.copy(destination,
+ flags=gio.FILE_COPY_OVERWRITE,
+ progress_callback=progress)
+ self.failUnless(retval)
+
+ self.failUnless(os.path.exists('copy.txt'))
+ self.assertEqual(open('file.txt').read(),
+ open('copy.txt').read())
+ finally:
+ os.unlink("copy.txt")
+
+ def testMove(self):
+ if os.path.exists('move.txt'):
+ os.unlink("move.txt")
+
+ source = gio.File('file.txt')
+ destination = gio.File('move.txt')
+ retval = source.move(destination)
+ self.failUnless(retval)
+
+ self.failIf(os.path.exists('file.txt'))
+ self.failUnless(os.path.exists('move.txt'))
+
+ self.called = False
+ def callback(current, total):
+ self.called = True
+ source = gio.File('move.txt')
+ destination = gio.File('move-2.txt')
+ try:
+ retval = source.move(destination, callback)
+ self.failUnless(retval)
+
+ self.failIf(os.path.exists('move.txt'))
+ self.failUnless(os.path.exists('move-2.txt'))
+ self.failUnless(self.called)
+ finally:
+ os.unlink("move-2.txt")
+
+ def testInfoList(self):
+ infolist = self.file.query_settable_attributes()
+ for info in infolist:
+ if info.name == "time::modified":
+ self.assertEqual(info.type, gio.FILE_ATTRIBUTE_TYPE_UINT64)
+ self.assertEqual(info.name, "time::modified")
+ self.assertEqual(info.flags,
+ gio.FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED |
+ gio.FILE_ATTRIBUTE_INFO_COPY_WITH_FILE)
+
+ def testQueryWritableNamespaces(self):
+ infolist = self.file.query_writable_namespaces()
+ for info in infolist:
+ if info.name == "xattr":
+ self.assertEqual(info.type, gio.FILE_ATTRIBUTE_TYPE_STRING)
+
+ def testSetAttribute(self):
+ self._f.write("testing attributes")
+ self._f.seek(0)
+ infolist = self.file.query_settable_attributes()
+
+ self.assertNotEqual(len(infolist), 0)
+
+ for info in infolist:
+ if info.name == "time::modified-usec":
+ ret = self.file.set_attribute("time::modified-usec",
+ gio.FILE_ATTRIBUTE_TYPE_UINT32,
+ 10, gio.FILE_QUERY_INFO_NONE)
+ self.assertEqual(ret, True)
+
+ def testSetAttributesAsync(self):
+ def callback(gfile, result):
+ try:
+ info = gfile.set_attributes_finish(result)
+ usec = info.get_attribute_uint32("time::modified-usec")
+ self.assertEqual(usec, 10)
+ finally:
+ loop.quit()
+
+ info = gio.FileInfo()
+ info.set_attribute_uint32("time::modified-usec", 10)
+
+ canc = gio.Cancellable()
+ self.file.set_attributes_async(info, callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testReplaceContents(self):
+ self.file.replace_contents("testing replace_contents")
+ cont, leng, etag = self.file.load_contents()
+ self.assertEqual(cont, "testing replace_contents")
+
+ caught = False
+ try:
+ self.file.replace_contents("this won't work", etag="wrong")
+ except gio.Error, e:
+ self.assertEqual(e.code, gio.ERROR_WRONG_ETAG)
+ caught = True
+ self.failUnless(caught)
+
+ self.file.replace_contents("testing replace_contents again", etag=etag)
+ cont, leng, etag = self.file.load_contents()
+ self.assertEqual(cont, "testing replace_contents again")
+
+ self.file.replace_contents("testing replace_contents yet again", etag=None)
+ cont, leng, etag = self.file.load_contents()
+ self.assertEqual(cont, "testing replace_contents yet again")
+
+ def testReplaceContentsAsync(self):
+
+ def callback(contents, result):
+ try:
+ newetag = contents.replace_contents_finish(result)
+ cont, leng, etag = self.file.load_contents()
+ self.assertEqual(cont, "testing replace_contents_async")
+ self.assertEqual(leng, 30)
+ self.assertEqual(etag, newetag)
+ self.assertNotEqual(newetag, '')
+ finally:
+ loop.quit()
+
+ canc = gio.Cancellable()
+ self.file.replace_contents_async("testing replace_contents_async", callback, cancellable=canc)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def test_eq(self):
+ self.assertEqual(gio.File('foo'),
+ gio.File('foo'))
+ self.assertNotEqual(gio.File('foo'),
+ gio.File('bar'))
+
+ def test_hash(self):
+ self.assertEquals(hash(gio.File('foo')),
+ hash(gio.File('foo')))
+
+ def testSetDisplayNameAsync(self):
+ def callback(gfile, result):
+ try:
+ new_gfile = gfile.set_display_name_finish(result)
+ new_name = new_gfile.get_basename()
+ self.assertEqual(new_name, "new.txt")
+ deleted = new_gfile.delete()
+ self.assertEqual(deleted, True)
+ finally:
+ loop.quit()
+
+ canc = gio.Cancellable()
+ self.file.set_display_name_async("new.txt", callback, cancellable=canc)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestGFileEnumerator(unittest.TestCase):
+ def setUp(self):
+ self.file = gio.File(".")
+
+ def testEnumerateChildren(self):
+ enumerator = self.file.enumerate_children(
+ "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)
+ for file_info in enumerator:
+ if file_info.get_name() == 'test_gio.py':
+ break
+ else:
+ raise AssertionError
+
+ def testEnumerateChildrenAsync(self):
+ def callback(gfile, result):
+ try:
+ for file_info in gfile.enumerate_children_finish(result):
+ if file_info.get_name() == 'test_gio.py':
+ break
+ else:
+ raise AssertionError
+ finally:
+ loop.quit()
+
+ self.file.enumerate_children_async(
+ "standard::*", callback)
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testNextFilesAsync(self):
+ def callback(enumerator, result):
+ try:
+ for file_info in enumerator.next_files_finish(result):
+ if file_info.get_name() == 'test_gio.py':
+ break
+ else:
+ raise AssertionError
+ finally:
+ loop.quit()
+
+ enumerator = self.file.enumerate_children(
+ "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)
+ enumerator.next_files_async(1000, callback)
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testCloseFilesAsync(self):
+ def callback(enumerator, result):
+ try:
+ enumerator.close_finish(result)
+ finally:
+ loop.quit()
+
+ enumerator = self.file.enumerate_children(
+ "standard::*", gio.FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)
+
+ enumerator.close_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+
+class TestInputStream(unittest.TestCase):
+ def setUp(self):
+ self._f = open("inputstream.txt", "w+")
+ self._f.write("testing")
+ self._f.seek(0)
+ self.stream = gio.unix.InputStream(self._f.fileno(), False)
+
+ def tearDown(self):
+ self._f.close()
+ os.unlink("inputstream.txt")
+
+ def testRead(self):
+ self.assertEquals(self.stream.read(), "testing")
+
+ self.stream = gio.MemoryInputStream()
+ self.assertEquals(self.stream.read(), '')
+
+ self.stream = gio.MemoryInputStream()
+ some_data = open("test_gio.py", "rb").read()
+ self.stream.add_data(some_data)
+ self.assertEquals(self.stream.read(), some_data)
+
+ stream = gio.MemoryInputStream()
+ stream.add_data(some_data)
+ self.assertEquals(self._read_in_loop(stream,
+ lambda: stream.read(50),
+ 50),
+ some_data)
+
+ def testSkip(self):
+ self.stream.skip(2)
+ res = self.stream.read()
+ self.assertEqual(res, "sting")
+
+ def testSkipAsync(self):
+ def callback(stream, result):
+ try:
+ size = stream.skip_finish(result)
+ self.assertEqual(size, 2)
+ res = stream.read()
+ self.assertEqual(res, "sting")
+ finally:
+ loop.quit()
+
+ self.stream.skip_async(2, callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def test_read_part(self):
+ self.assertEquals(self._read_in_loop(self.stream,
+ lambda: self.stream.read_part()),
+ 'testing')
+
+ stream = gio.MemoryInputStream()
+ some_data = open('test_gio.py', 'rb').read()
+ stream.add_data(some_data)
+ self.assertEquals(self._read_in_loop(stream,
+ lambda: stream.read_part(50),
+ 50),
+ some_data)
+
+ def _read_in_loop(self, stream, reader, size_limit=0):
+ read_data = ''
+ while True:
+ read_part = reader()
+ if read_part:
+ read_data += read_part
+ if size_limit > 0:
+ self.assert_(len(read_part) <= size_limit,
+ '%d <= %d' % (len(read_part), size_limit))
+ else:
+ return read_data
+
+ def testReadAsync(self):
+ def callback(stream, result):
+ self.assertEquals(result.get_op_res_gssize(), 7)
+ try:
+ data = stream.read_finish(result)
+ self.assertEquals(data, "testing")
+ stream.close()
+ finally:
+ loop.quit()
+
+ self.stream.read_async(7, callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testReadAsyncError(self):
+ self.count = 0
+ def callback(stream, result):
+ try:
+ self.count += 1
+ if self.count == 1:
+ return
+ self.assertRaises(gio.Error, stream.read_finish, result)
+ finally:
+ loop.quit()
+
+ self.stream.read_async(10240, callback)
+ self.stream.read_async(10240, callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ self.assertEquals(self.count, 2)
+
+ self.assertRaises(TypeError, self.stream.read_async)
+ self.assertRaises(TypeError, self.stream.read_async, "foo")
+ self.assertRaises(TypeError, self.stream.read_async, 1024, "bar")
+ self.assertRaises(TypeError, self.stream.read_async, 1024,
+ priority="bar")
+ self.assertRaises(TypeError, self.stream.read_async, 1024,
+ priority="bar")
+ self.assertRaises(TypeError, self.stream.read_async, 1024,
+ priority=1, cancellable="bar")
+ self.assertRaises(TypeError, self.stream.read_async, 1024, 1, "bar")
+
+
+ # FIXME: this makes 'make check' freeze
+ def _testCloseAsync(self):
+ def callback(stream, result):
+ try:
+ self.failUnless(stream.close_finish(result))
+ finally:
+ loop.quit()
+
+ self.stream.close_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+
+class TestDataInputStream(unittest.TestCase):
+ def setUp(self):
+ self.base_stream = gio.MemoryInputStream()
+ self.data_stream = gio.DataInputStream(self.base_stream)
+
+ def test_read_line(self):
+ self.base_stream.add_data('foo\nbar\n\nbaz')
+ self.assertEquals('foo', self.data_stream.read_line())
+ self.assertEquals('bar', self.data_stream.read_line())
+ self.assertEquals('', self.data_stream.read_line())
+ self.assertEquals('baz', self.data_stream.read_line())
+
+ def test_read_line_async(self):
+ def do_read_line_async():
+ loop = glib.MainLoop()
+ line = []
+
+ def callback(stream, result):
+ try:
+ line.append(stream.read_line_finish(result))
+ finally:
+ loop.quit()
+
+ self.data_stream.read_line_async(callback)
+ loop.run()
+ return line[0]
+
+ self.base_stream.add_data('foo\nbar\n\nbaz')
+ self.assertEquals('foo', do_read_line_async())
+ self.assertEquals('bar', do_read_line_async())
+ self.assertEquals('', do_read_line_async())
+ self.assertEquals('baz', do_read_line_async())
+
+ def test_read_until(self):
+ self.base_stream.add_data('sentence.end of line\nthe rest')
+ self.assertEquals('sentence', self.data_stream.read_until('.!?'))
+ self.assertEquals('end of line', self.data_stream.read_until('\n\r'))
+ self.assertEquals('the rest', self.data_stream.read_until('#$%^&'))
+
+ def test_read_until_async(self):
+ def do_read_until_async(stop_chars):
+ loop = glib.MainLoop()
+ data = []
+
+ def callback(stream, result):
+ try:
+ data.append(stream.read_until_finish(result))
+ finally:
+ loop.quit()
+
+ self.data_stream.read_until_async(stop_chars, callback)
+ loop.run()
+ return data[0]
+
+ # Note the weird difference between synchronous and
+ # asynchronous version. See bug #584284.
+ self.base_stream.add_data('sentence.end of line\nthe rest')
+ self.assertEquals('sentence', do_read_until_async('.!?'))
+ self.assertEquals('.end of line', do_read_until_async('\n\r'))
+ self.assertEquals('\nthe rest', do_read_until_async('#$%^&'))
+
+
+class TestMemoryInputStream(unittest.TestCase):
+ def setUp(self):
+ self.stream = gio.MemoryInputStream()
+
+ def test_add_data(self):
+ self.stream.add_data('foobar')
+ self.assertEquals('foobar', self.stream.read())
+
+ self.stream.add_data('ham ')
+ self.stream.add_data(None)
+ self.stream.add_data('spam')
+ self.assertEquals('ham spam', self.stream.read())
+
+ def test_new_from_data(self):
+ stream = gio.memory_input_stream_new_from_data('spam')
+ self.assertEquals('spam', stream.read())
+
+
+class TestOutputStream(unittest.TestCase):
+ def setUp(self):
+ self._f = open("outputstream.txt", "w")
+ self.stream = gio.unix.OutputStream(self._f.fileno(), False)
+
+ def tearDown(self):
+ self._f.close()
+ os.unlink("outputstream.txt")
+
+ def testWrite(self):
+ self.stream.write("testing")
+ self.stream.close()
+ self.failUnless(os.path.exists("outputstream.txt"))
+ self.assertEquals(open("outputstream.txt").read(), "testing")
+
+ def test_write_part(self):
+ stream = gio.MemoryOutputStream()
+ some_data = open('test_gio.py', 'rb').read()
+ buffer = some_data
+
+ # In fact this makes only one looping (memory stream is fast,
+ # write_part behaves just like write), but let's still be
+ # complete.
+ while buffer:
+ written = stream.write_part(buffer)
+ if written == len(buffer):
+ break
+ else:
+ buffer = buffer[written:]
+
+ self.assertEquals(stream.get_contents(), some_data)
+
+ def testWriteAsync(self):
+ def callback(stream, result):
+ self.assertEquals(result.get_op_res_gssize(), 7)
+ try:
+ self.assertEquals(stream.write_finish(result), 7)
+ self.failUnless(os.path.exists("outputstream.txt"))
+ self.assertEquals(open("outputstream.txt").read(), "testing")
+ finally:
+ loop.quit()
+
+ self.stream.write_async("testing", callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testWriteAsyncError(self):
+ def callback(stream, result):
+ self.assertEquals(result.get_op_res_gssize(), 0)
+ try:
+ self.assertRaises(gio.Error, stream.write_finish, result)
+ finally:
+ loop.quit()
+
+ self.stream.close()
+ self.stream.write_async("testing", callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ self.assertRaises(TypeError, self.stream.write_async)
+ self.assertRaises(TypeError, self.stream.write_async, 1138)
+ self.assertRaises(TypeError, self.stream.write_async, "foo", "bar")
+ self.assertRaises(TypeError, self.stream.write_async, "foo",
+ priority="bar")
+ self.assertRaises(TypeError, self.stream.write_async, "foo",
+ priority="bar")
+ self.assertRaises(TypeError, self.stream.write_async, "foo",
+ priority=1, cancellable="bar")
+ self.assertRaises(TypeError, self.stream.write_async, "foo", 1, "bar")
+
+ # FIXME: this makes 'make check' freeze
+ def _testCloseAsync(self):
+ def callback(stream, result):
+ try:
+ self.failUnless(stream.close_finish(result))
+ finally:
+ loop.quit()
+
+ self.stream.close_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testFlushAsync(self):
+ def callback(stream, result):
+ try:
+ self.failUnless(stream.flush_finish(result))
+ finally:
+ loop.quit()
+
+ self.stream.flush_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def testSpliceAsync(self):
+ _f = open("stream.txt", "w+")
+ _f.write("testing")
+ _f.seek(0)
+ instream = gio.unix.InputStream(_f.fileno(), False)
+
+ def callback(stream, result):
+ try:
+ size = stream.splice_finish(result)
+ self.assertEqual(size, 7)
+
+ finally:
+ os.unlink("stream.txt")
+ loop.quit()
+
+ self.stream.splice_async(instream, callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestMemoryOutputStream(unittest.TestCase):
+ def setUp(self):
+ self.stream = gio.MemoryOutputStream()
+
+ def test_get_contents(self):
+ self.stream.write('foobar')
+ self.assertEquals('foobar', self.stream.get_contents())
+
+ self.stream.write('baz')
+ self.assertEquals('foobarbaz', self.stream.get_contents())
+
+
+class TestVolumeMonitor(unittest.TestCase):
+ def setUp(self):
+ self.monitor = gio.volume_monitor_get()
+
+ def testGetConnectedDrives(self):
+ drives = self.monitor.get_connected_drives()
+ self.failUnless(isinstance(drives, list))
+
+ def testGetVolumes(self):
+ volumes = self.monitor.get_volumes()
+ self.failUnless(isinstance(volumes, list))
+
+ def testGetMounts(self):
+ mounts = self.monitor.get_mounts()
+ self.failUnless(isinstance(mounts, list))
+ if not mounts:
+ return
+
+ self.failUnless(isinstance(mounts[0], gio.Mount))
+ # Bug 538601
+ icon = mounts[0].get_icon()
+ if not icon:
+ return
+ self.failUnless(isinstance(icon, gio.Icon))
+
+
+class TestContentTypeGuess(unittest.TestCase):
+ def testFromName(self):
+ mime_type = gio.content_type_guess('diagram.svg')
+ self.assertEquals('image/svg+xml', mime_type)
+
+ def testFromContents(self):
+ mime_type = gio.content_type_guess(data='<html></html>')
+ self.assertEquals('text/html', mime_type)
+
+ def testFromContentsUncertain(self):
+ mime_type, result_uncertain = gio.content_type_guess(
+ data='<html></html>', want_uncertain=True)
+ self.assertEquals('text/html', mime_type)
+ self.assertEquals(bool, type(result_uncertain))
+
+
+class TestFileInfo(unittest.TestCase):
+ def setUp(self):
+ self.fileinfo = gio.File("test_gio.py").query_info("*")
+
+ def testListAttributes(self):
+ attributes = self.fileinfo.list_attributes("standard")
+ self.failUnless(attributes)
+ self.failUnless('standard::name' in attributes)
+
+ def testGetModificationTime(self):
+ mtime = self.fileinfo.get_modification_time()
+ self.assertEqual(type(mtime), float)
+
+ def testSetModificationTime(self):
+ self.fileinfo.set_modification_time(1000)
+ mtime = self.fileinfo.get_modification_time()
+ self.assertEqual(mtime, 1000)
+
+
+class TestAppInfo(unittest.TestCase):
+ def setUp(self):
+ self.appinfo = gio.AppInfo("does-not-exist")
+
+ def testSimple(self):
+ self.assertEquals(self.appinfo.get_description(),
+ "Custom definition for does-not-exist")
+
+ def test_eq(self):
+ info1 = gio.app_info_get_all()[0]
+ info2 = info1.dup()
+ self.assert_(info1 is not info2)
+ self.assertEquals(info1, info2)
+
+ self.assertNotEqual(gio.app_info_get_all()[0], gio.app_info_get_all()[1])
+
+class TestVfs(unittest.TestCase):
+ def setUp(self):
+ self.vfs = gio.vfs_get_default()
+
+ def testGetSupportedURISchemes(self):
+ result = self.vfs.get_supported_uri_schemes()
+ self.failUnless(type(result), [])
+
+class TestVolume(unittest.TestCase):
+ def setUp(self):
+ self.monitor = gio.volume_monitor_get()
+
+ def testVolumeEnumerate(self):
+ volumes = self.monitor.get_volumes()
+ self.failUnless(isinstance(volumes, list))
+ for v in volumes:
+ if v is not None:
+ ids = v.enumerate_identifiers()
+ self.failUnless(isinstance(ids, list))
+ for id in ids:
+ if id is not None:
+ self.failUnless(isinstance(id, str))
+
+class TestFileInputStream(unittest.TestCase):
+ def setUp(self):
+ self._f = open("file.txt", "w+")
+ self._f.write("testing")
+ self._f.seek(0)
+ self.file = gio.File("file.txt")
+
+ def tearDown(self):
+ self._f.close()
+ if os.path.exists('file.txt'):
+ os.unlink("file.txt")
+
+ def testQueryInfoAsync(self):
+ def callback(stream, result):
+ try:
+ info = stream.query_info_finish(result)
+ self.failUnless(isinstance(info, gio.FileInfo))
+ self.failUnless(info.get_attribute_uint64("standard::size"), 7)
+ finally:
+ loop.quit()
+
+ inputstream = self.file.read()
+ inputstream.query_info_async("standard", callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestFileOutputStream(unittest.TestCase):
+ def setUp(self):
+ self._f = open("file.txt", "w+")
+ self._f.write("testing")
+ self._f.seek(0)
+ self.file = gio.File("file.txt")
+
+ def tearDown(self):
+ self._f.close()
+ if os.path.exists('file.txt'):
+ os.unlink("file.txt")
+
+ def testQueryInfoAsync(self):
+ def callback(stream, result):
+ try:
+ info = stream.query_info_finish(result)
+ self.failUnless(isinstance(info, gio.FileInfo))
+ self.failUnless(info.get_attribute_uint64("standard::size"), 7)
+ finally:
+ loop.quit()
+
+ outputstream = self.file.append_to()
+ outputstream.query_info_async("standard", callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestBufferedInputStream(unittest.TestCase):
+ def setUp(self):
+ self._f = open("buffer.txt", "w+")
+ self._f.write("testing")
+ self._f.seek(0)
+ stream = gio.unix.InputStream(self._f.fileno(), False)
+ self.buffered = gio.BufferedInputStream(stream)
+
+ def tearDown(self):
+ self._f.close()
+ os.unlink("buffer.txt")
+
+ def test_fill_async(self):
+ def callback(stream, result):
+ try:
+ size = stream.fill_finish(result)
+ self.failUnlessEqual(size, 4)
+ finally:
+ loop.quit()
+
+ self.buffered.fill_async(4, callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestIOStream(unittest.TestCase):
+ def setUp(self):
+ self.file = gio.File("file.txt")
+ self.iofile = self.file.create_readwrite(gio.FILE_CREATE_NONE)
+
+ def tearDown(self):
+ if os.path.exists('file.txt'):
+ os.unlink("file.txt")
+
+ def testIOStreamCloseAsync(self):
+ def callback(stream, result):
+ try:
+ self.failUnless(stream.close_finish(result))
+ finally:
+ loop.quit()
+
+ self.iofile.close_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+
+ def testQueryInfoAsync(self):
+ def callback(stream, result):
+ try:
+ info = stream.query_info_finish(result)
+ self.failUnless(isinstance(info, gio.FileInfo))
+ self.failUnless(info.get_attribute_uint64("standard::size"), 7)
+ finally:
+ loop.quit()
+
+ ostream = self.iofile.get_output_stream()
+ ostream.write("testing")
+
+ self.iofile.query_info_async("standard", callback)
+
+ loop = glib.MainLoop()
+ loop.run()
diff --git a/tests/test_gresolver.py b/tests/test_gresolver.py
new file mode 100644
index 0000000..4238df7
--- /dev/null
+++ b/tests/test_gresolver.py
@@ -0,0 +1,68 @@
+# -*- Mode: Python -*-
+
+import unittest
+
+import glib
+import gio
+
+
+class TestResolver(unittest.TestCase):
+ def setUp(self):
+ self.resolver = gio.resolver_get_default()
+
+ def test_resolver_lookup_by_name(self):
+ addresses = self.resolver.lookup_by_name("pygtk.org", cancellable=None)
+ self.failUnless(isinstance(addresses[0], gio.InetAddress))
+
+ def test_resolver_lookup_by_address(self):
+ address = gio.inet_address_new_from_string("8.8.8.8")
+ dns = self.resolver.lookup_by_address(address, cancellable=None)
+ self.failUnlessEqual(dns, "google-public-dns-a.google.com")
+
+ def test_resolver_lookup_by_name_async(self):
+ def callback(resolver, result):
+ try:
+ addresses = resolver.lookup_by_name_finish(result)
+ self.failUnless(isinstance(addresses[0], gio.InetAddress))
+ finally:
+ loop.quit()
+
+ self.resolver.lookup_by_name_async(callback, "pygtk.org")
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def test_resolver_lookup_by_address_async(self):
+ def callback(resolver, result):
+ try:
+ dns = resolver.lookup_by_address_finish(result)
+ self.failUnlessEqual(dns, "google-public-dns-b.google.com")
+ finally:
+ loop.quit()
+
+ address = gio.inet_address_new_from_string("8.8.4.4")
+ self.resolver.lookup_by_address_async(callback, address)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+""" Commented out because this requires an active internet connection and a
+ router that supports SRV lookups
+
+ def test_resolver_lookup_service(self):
+ targets = self.resolver.lookup_service("xmpp-client", "tcp", "google.com")
+ self.failUnless(isinstance(targets[0], gio.SrvTarget))
+
+ def test_resolver_lookup_service_async(self):
+ def callback(resolver, result):
+ try:
+ targets = resolver.lookup_service_finish(result)
+ self.failUnless(isinstance(targets[0], gio.SrvTarget))
+ finally:
+ loop.quit()
+
+ self.resolver.lookup_service_async(callback, "xmpp-client", "tcp", "google.com")
+
+ loop = glib.MainLoop()
+ loop.run()
+"""
diff --git a/tests/test_gsocket.py b/tests/test_gsocket.py
new file mode 100644
index 0000000..627f6fd
--- /dev/null
+++ b/tests/test_gsocket.py
@@ -0,0 +1,126 @@
+# -*- Mode: Python -*-
+
+import os
+import unittest
+
+import glib
+import gobject
+import gio
+
+
+class TestSocket(unittest.TestCase):
+ def setUp(self):
+ self.sock = gio.Socket(gio.SOCKET_FAMILY_IPV4,
+ gio.SOCKET_TYPE_STREAM,
+ gio.SOCKET_PROTOCOL_TCP)
+
+ def test_socket_condition_check(self):
+ check = self.sock.condition_check(glib.IO_OUT)
+ self.failUnless(isinstance(check, gobject.GFlags))
+ self.failUnlessEqual(check, glib.IO_OUT | glib.IO_HUP)
+
+ def test_socket_condition_wait(self):
+ res = self.sock.condition_wait(glib.IO_OUT)
+ self.failUnless(res)
+
+ def tearDown(self):
+ self.sock.close()
+
+class TestSocketAddress(unittest.TestCase):
+ def test_socket_address_enumerator_next_async(self):
+ def callback(enumerator, result):
+ try:
+ address = enumerator.next_finish(result)
+ self.failUnless(isinstance(address, gio.SocketAddress))
+ finally:
+ loop.quit()
+
+ socket = gio.NetworkAddress("www.pygtk.org", 80)
+ enumerator = socket.enumerate()
+ enumerator.next_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+class TestSocketListener(unittest.TestCase):
+ def test_socket_listener_add_address(self):
+ address = gio.inet_address_new_from_string("127.0.0.1")
+ inetsock = gio.InetSocketAddress(address, 1024)
+
+ listener = gio.SocketListener()
+ effective = listener.add_address(inetsock, gio.SOCKET_TYPE_STREAM, gio.SOCKET_PROTOCOL_TCP)
+ self.failUnless(isinstance(effective, gio.InetSocketAddress))
+
+ def test_socket_listener_accept(self):
+ address = gio.inet_address_new_from_string("127.0.0.1")
+ inetsock = gio.InetSocketAddress(address, 1024)
+
+ listener = gio.SocketListener()
+ listener.add_address(inetsock, gio.SOCKET_TYPE_STREAM, gio.SOCKET_PROTOCOL_TCP)
+
+ client = gio.SocketClient()
+ client.connect_to_host("127.0.0.1:1024", 1024)
+
+ connection, source = listener.accept(cancellable=None)
+ self.failUnless(isinstance(connection, gio.TcpConnection))
+
+ def test_socket_listener_accept_socket(self):
+ address = gio.inet_address_new_from_string("127.0.0.1")
+ inetsock = gio.InetSocketAddress(address, 1024)
+
+ listener = gio.SocketListener()
+ listener.add_address(inetsock, gio.SOCKET_TYPE_STREAM, gio.SOCKET_PROTOCOL_TCP)
+
+ client = gio.SocketClient()
+ client.connect_to_host("127.0.0.1:1024", 1024)
+
+ socket, source = listener.accept_socket(cancellable=None)
+ self.failUnless(isinstance(socket, gio.Socket))
+
+ def test_socket_listener_accept_async(self):
+ def callback(listener, result):
+ try:
+ connection, source = listener.accept_finish(result)
+ self.failUnless(isinstance(connection, gio.TcpConnection))
+ finally:
+ loop.quit()
+
+ address = gio.inet_address_new_from_string("127.0.0.1")
+ inetsock = gio.InetSocketAddress(address, 1024)
+
+ listener = gio.SocketListener()
+ listener.add_address(inetsock,
+ gio.SOCKET_TYPE_STREAM,
+ gio.SOCKET_PROTOCOL_TCP)
+
+ client = gio.SocketClient()
+ client.connect_to_host("127.0.0.1:1024", 1024)
+
+ listener.accept_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
+
+ def test_socket_listener_accept_socket_async(self):
+ def callback(listener, result):
+ try:
+ socket, source = listener.accept_socket_finish(result)
+ self.failUnless(isinstance(socket, gio.Socket))
+ finally:
+ loop.quit()
+
+ address = gio.inet_address_new_from_string("127.0.0.1")
+ inetsock = gio.InetSocketAddress(address, 1024)
+
+ listener = gio.SocketListener()
+ listener.add_address(inetsock,
+ gio.SOCKET_TYPE_STREAM,
+ gio.SOCKET_PROTOCOL_TCP)
+
+ client = gio.SocketClient()
+ client.connect_to_host("127.0.0.1:1024", 1024)
+
+ listener.accept_socket_async(callback)
+
+ loop = glib.MainLoop()
+ loop.run()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]