diff frontends/src/bridge/DBus.py @ 759:93bd868b8fb6

backend, frontends: callbacks refactoring: - launchAction is now async, and return a dictionary for its result - no more action_id, actionResult* are deprecated - callback system is about to be unified
author Goffi <goffi@goffi.org>
date Tue, 24 Dec 2013 15:19:08 +0100
parents e3ad48a2aab2
children bfabeedbf32e
line wrap: on
line diff
--- a/frontends/src/bridge/DBus.py	Tue Dec 24 15:19:08 2013 +0100
+++ b/frontends/src/bridge/DBus.py	Tue Dec 24 15:19:08 2013 +0100
@@ -190,8 +190,8 @@
     def isConnected(self, profile_key="@DEFAULT@"):
         return self.db_core_iface.isConnected(profile_key)
 
-    def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
-        return unicode(self.db_core_iface.launchAction(action_type, data, profile_key))
+    def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None):
+        return self.db_core_iface.launchAction(callback_id, data, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
 
     def registerNewAccount(self, login, password, email, host, port=5222):
         return unicode(self.db_core_iface.registerNewAccount(login, password, email, host, port))