2004-07-28 Anders Carlsson <andersca@gnome.org>

* python/dbus.py:
	* python/dbus_bindings.pyx.in:
	Add dbus.init_gthreads (), allow emit_signal to pass
	arguments to the signal.
This commit is contained in:
Anders Carlsson 2004-07-28 18:14:55 +00:00
parent c3cac7a6bf
commit b72fe8c67d
3 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,10 @@
2004-07-28 Anders Carlsson <andersca@gnome.org>
* python/dbus.py:
* python/dbus_bindings.pyx.in:
Add dbus.init_gthreads (), allow emit_signal to pass
arguments to the signal.
2004-07-24 Havoc Pennington <hp@redhat.com>
* AUTHORS: add some people, not really comprehensively, let me

View file

@ -43,6 +43,13 @@ print(dbus_object.ListServices())
import dbus_bindings
_threads_initialized = 0
def init_gthreads ():
global _threads_initialized
if not _threads_initialized:
dbus_bindings.init_gthreads ()
_threads_initialized = 1
class Bus:
"""A connection to a DBus daemon.
@ -285,8 +292,12 @@ class Object:
self._connection.register_object_path(object_path, self._unregister_cb, self._message_cb)
def emit_signal(self, interface, signal_name):
def emit_signal(self, interface, signal_name, *args):
message = dbus_bindings.Signal(self._object_path, interface, signal_name)
iter = message.get_iter()
for arg in args:
iter.append(arg)
self._connection.send(message)
def _unregister_cb(self, connection):

View file

@ -18,6 +18,7 @@ cdef extern from "dbus-glib.h":
GMainContext *context)
cdef void dbus_server_setup_with_g_main (DBusServer *server,
GMainContext *context)
cdef void dbus_g_thread_init ()
cdef extern from "Python.h":
void Py_XINCREF (object)
@ -1136,3 +1137,6 @@ def bus_remove_match(Connection connection, rule):
if dbus_error_is_set(&error):
raise DBusException, error.message
def init_gthreads ():
dbus_g_thread_init ()