2004-07-28 Anders Carlsson <andersca@gnome.org>
authorAnders Carlsson <andersca@codefactory.se>
Wed, 28 Jul 2004 18:14:55 +0000 (18:14 +0000)
committerAnders Carlsson <andersca@codefactory.se>
Wed, 28 Jul 2004 18:14:55 +0000 (18:14 +0000)
* python/dbus.py:
* python/dbus_bindings.pyx.in:
Add dbus.init_gthreads (), allow emit_signal to pass
arguments to the signal.

ChangeLog
python/dbus.py
python/dbus_bindings.pyx.in

index 85e70a2..cab484f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index de42d74..4b53897 100644 (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):
index 498076d..6e73c85 100644 (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 ()