summaryrefslogtreecommitdiffstats
path: root/gio
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-26 10:46:49 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-26 10:46:49 +0000
commita0a89623f6ab41d78dcb8a9602387aca6657225a (patch)
tree3b2793322e00e219bbd051d5a06dae1272eab99a /gio
parent31c7971dcad9d8e02cb59fe603bc6d83bf035666 (diff)
downloadpygobject-a0a89623f6ab41d78dcb8a9602387aca6657225a.tar.gz
pygobject-a0a89623f6ab41d78dcb8a9602387aca6657225a.tar.xz
pygobject-a0a89623f6ab41d78dcb8a9602387aca6657225a.zip
Add a new API for registering exceptions for a GError domain. Register a
2008-07-26 Johan Dahlin <johan@gnome.org> * examples/gio/directory-async.py: * gio/Makefile.am: * gio/giomodule.c (init_gio): * glib/pyglib.c (pyglib_error_check), (pyglib_register_exception_for_domain): * glib/pyglib.h: * tests/test_gio.py: Add a new API for registering exceptions for a GError domain. Register a new exception for G_IO_ERROR, update tests and examples to use the new exception. svn path=/trunk/; revision=863
Diffstat (limited to 'gio')
-rw-r--r--gio/Makefile.am3
-rw-r--r--gio/giomodule.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 61a2cda..12badd2 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -6,6 +6,7 @@ INCLUDES = \
$(PYTHON_INCLUDES) \
$(PYGOBJECT_CFLAGS) \
$(GIO_CFLAGS) \
+ -I$(top_srcdir)/glib \
-I$(top_srcdir)/gobject
# defs files
@@ -49,7 +50,7 @@ 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)
+_gio_la_LIBADD = $(GIO_LIBS) $(top_builddir)/glib/libpyglib-2.0.la
_gio_la_SOURCES = \
giomodule.c \
pygio-utils.c \
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 35603f8..4da69ce 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -23,6 +23,7 @@
# include "config.h"
#endif
#include <Python.h>
+#include <pyglib.h>
#include <pygobject.h>
#include <gio/gio.h>
@@ -43,7 +44,7 @@ init_gio(void)
{
PyObject *m, *d;
PyObject *tuple;
-
+ PyObject *e;
/* perform any initialisation required by the library here */
m = Py_InitModule("gio._gio", pygio_functions);
@@ -55,6 +56,9 @@ init_gio(void)
pygio_add_constants(m, "G_IO_");
PyModule_AddStringConstant(m, "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);
/* pygio version */
tuple = Py_BuildValue ("(iii)",