summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--docs/reference/pygobject-functions.xml36
-rw-r--r--glib/glibmodule.c16
2 files changed, 23 insertions, 29 deletions
diff --git a/docs/reference/pygobject-functions.xml b/docs/reference/pygobject-functions.xml
index 8ad1e40..7ca3918 100644
--- a/docs/reference/pygobject-functions.xml
+++ b/docs/reference/pygobject-functions.xml
@@ -116,10 +116,13 @@ linkend="function-gobject---install-metaclass">gobject._install_metaclass</link>
module but are not directly associated with a specific class.</para>
<note>
- <para>Many functions that previously were in this namespace got moved
- to <link linkend="glib-functions"><literal>glib</literal></link> namespace
- instead. They are still available in <literal>gobject</literal> for backward
- compatibility, but not documented here.</para>
+ <para>
+ Many functions that previously were in this namespace got moved to <link
+ linkend="glib-functions"><literal>glib</literal></link> namespace instead. They
+ are still available in <literal>gobject</literal> for backward compatibility, but
+ not documented here. If you miss documentation for some function, be sure to
+ check <link linkend="glib-functions"><literal>glib</literal></link> first.
+ </para>
</note>
</refsect1>
@@ -755,31 +758,6 @@ properties.</para>
</refsect2>
- <refsect2 id="function-gobject--threads-init">
- <title>gobject.threads_init</title>
-
- <programlisting><methodsynopsis language="python">
- <methodname>gobject.threads_init</methodname>
- <methodparam><parameter></parameter></methodparam>
- </methodsynopsis></programlisting>
- <variablelist role="params">
- <varlistentry>
- <term><emphasis>Returns</emphasis>&nbsp;:</term>
- <listitem><simpara></simpara></listitem>
- </varlistentry>
- </variablelist>
- <note>
- <para>This function is available in PyGTK 2.4 and above.</para>
- </note>
-
- <para>The <function>threads_init</function>() function initializes the
- the use of Python threading in the gobject module. This function is
- different than the <link
- linkend="function-gdk--threads-init"><function>gtk.gdk.threads_init</function>()</link>
- function as that function also initializes the gdk threads.</para>
-
- </refsect2>
-
<refsect2 id="function-gobject--signal-accumulator-true-handled">
<title>gobject.signal_accumulator_true_handled</title>
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"