summaryrefslogtreecommitdiffstats
path: root/glib/glibmodule.c
diff options
context:
space:
mode:
authorPaul Pogonyshev <pogonyshev@gmx.net>2009-11-10 22:32:33 +0200
committerPaul Pogonyshev <pogonyshev@gmx.net>2009-11-10 22:35:57 +0200
commit602afea88c338a38327cd84e08703c5daa384ec6 (patch)
treefe75a8d2d3b2b6d0fe511df8fefa04d1680c9bf3 /glib/glibmodule.c
parent6a69288941e65312fe82649ec72d2f21b2dc618f (diff)
downloadpygobject-602afea88c338a38327cd84e08703c5daa384ec6.tar.gz
pygobject-602afea88c338a38327cd84e08703c5daa384ec6.tar.xz
pygobject-602afea88c338a38327cd84e08703c5daa384ec6.zip
Move threads_init() function from 'gobject' to 'glib'
Retain in original place for backward compatibility, but remove it from the docs.
Diffstat (limited to 'glib/glibmodule.c')
-rw-r--r--glib/glibmodule.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/glib/glibmodule.c b/glib/glibmodule.c
index 58206eb..74a09db 100644
--- a/glib/glibmodule.c
+++ b/glib/glibmodule.c
@@ -90,6 +90,16 @@ get_handler_priority(gint *priority, PyObject *kwargs)
}
static PyObject *
+pyglib_threads_init(PyObject *unused, PyObject *args, PyObject *kwargs)
+{
+ if (!pyglib_enable_threads())
+ return NULL;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+static PyObject *
pyglib_idle_add(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *first, *callback, *cbargs = NULL, *data;
@@ -586,6 +596,12 @@ pyglib_set_prgname(PyObject *self, PyObject *arg)
}
static PyMethodDef _glib_functions[] = {
+ { "threads_init",
+ (PyCFunction) pyglib_threads_init, METH_NOARGS,
+ "threads_init()\n"
+ "Initialize GLib for use from multiple threads. If you also use GTK+\n"
+ "itself (i.e. GUI, not just PyGObject), use gtk.gdk.threads_init()\n"
+ "instead." },
{ "idle_add",
(PyCFunction)pyglib_idle_add, METH_VARARGS|METH_KEYWORDS,
"idle_add(callable, user_data=None, priority=None) -> source id\n"