[pygobject] Move threads_init() function from 'gobject' to 'glib'
- From: Paul Pogonyshev <paulp src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [pygobject] Move threads_init() function from 'gobject' to 'glib'
- Date: Tue, 10 Nov 2009 20:38:28 +0000 (UTC)
commit 602afea88c338a38327cd84e08703c5daa384ec6
Author: Paul Pogonyshev <pogonyshev gmx net>
Date: Tue Nov 10 22:32:33 2009 +0200
Move threads_init() function from 'gobject' to 'glib'
Retain in original place for backward compatibility, but remove it
from the docs.
docs/reference/pygobject-functions.xml | 36 ++++++-------------------------
glib/glibmodule.c | 16 ++++++++++++++
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> :</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"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]