diff frontends/src/bridge/DBus.py @ 423:6c20c76abdcc

backend: - bridge async D-Bus method now automatically manage callback and errback, we just have to return a deferred - getParams, getParamsForCategory and getParamsUI are now asynchronous primitivus: management of asynchronous getParamsUI
author Goffi <goffi@goffi.org>
date Mon, 07 Nov 2011 00:09:22 +0100
parents 28e4299d4553
children e4e9187e3b5b
line wrap: on
line diff
--- a/frontends/src/bridge/DBus.py	Sun Nov 06 15:19:51 2011 +0100
+++ b/frontends/src/bridge/DBus.py	Mon Nov 07 00:09:22 2011 +0100
@@ -111,17 +111,17 @@
     def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
         return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key))
 
-    def getParams(self, profile_key="@DEFAULT@"):
-        return unicode(self.db_core_iface.getParams(profile_key))
+    def getParams(self, profile_key="@DEFAULT@", callback=None, errback=None):
+        return unicode(self.db_core_iface.getParams(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
 
     def getParamsCategories(self, ):
         return self.db_core_iface.getParamsCategories()
 
-    def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
-        return unicode(self.db_core_iface.getParamsForCategory(category, profile_key))
+    def getParamsForCategory(self, category, profile_key="@DEFAULT@", callback=None, errback=None):
+        return unicode(self.db_core_iface.getParamsForCategory(category, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
 
-    def getParamsUI(self, profile_key="@DEFAULT@"):
-        return unicode(self.db_core_iface.getParamsUI(profile_key))
+    def getParamsUI(self, profile_key="@DEFAULT@", callback=None, errback=None):
+        return unicode(self.db_core_iface.getParamsUI(profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
 
     def getPresenceStatus(self, profile_key="@DEFAULT@"):
         return self.db_core_iface.getPresenceStatus(profile_key)