[conduit/gsoc09_alexandre: 21/24] Trying to export all objects on DBus (not working).



commit 5ef4821f9a96b4674c978406da6deb6af8329559
Author: Alexandre Rosenfeld <airmind gmail com>
Date:   Tue Aug 4 22:17:46 2009 -0300

    Trying to export all objects on DBus (not working).

 conduit/DBus.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/conduit/DBus.py b/conduit/DBus.py
index 253f8fe..bb01ff8 100644
--- a/conduit/DBus.py
+++ b/conduit/DBus.py
@@ -384,11 +384,30 @@ class SyncSetDBusItem(DBusItem):
         self.syncSet = syncSet
         self.syncSet.connect("conduit-added", self._on_conduit_added)
         self.syncSet.connect("conduit-removed", self._on_conduit_removed)
+
+        self.sync_manager = self.syncSet.syncManager        
+
+        self.conduits = {}
+        #for cond in self.syncSet.conduits:
+        #    i = Utils.uuid_string()
+        #    new = ConduitDBusItem(self.sync_manager, cond, i)
+        #    self.conduits[cond] = new
+
+    def _add_conduit_object(self, cond):
+        i = Utils.uuid_string()
+        new = ConduitDBusItem(self.sync_manager, cond, i)
+        self.conduits[cond] = new    
+        return new
         
     def _on_conduit_added(self, syncset, cond):
+        #if cond not in self.conduits:
+        #    self._add_conduit_object(self)
         self.ConduitAdded()
 
     def _on_conduit_removed(self, syncset, cond):
+        #print dir(self.conduits[cond])
+        if cond in self.conduits:
+            del self.conduits[cond] 
         self.ConduitRemoved()
 
     @dbus.service.signal(SYNCSET_DBUS_IFACE, signature='')
@@ -398,6 +417,10 @@ class SyncSetDBusItem(DBusItem):
     @dbus.service.signal(SYNCSET_DBUS_IFACE, signature='')
     def ConduitRemoved(self):
         self._print("Emmiting DBus signal ConduitRemoved")
+        
+    @dbus.service.method(SYNCSET_DBUS_IFACE, in_signature='', out_signature='ao')
+    def ListConduits(self):
+        return [cond.get_path() for cond in self.conduits]
 
     @dbus.service.method(SYNCSET_DBUS_IFACE, in_signature='o', out_signature='')
     def AddConduit(self, cond):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]