[Telepathy-commits] [telepathy-qt4/master] account-manager.py: implement Properties.Set on Account
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Jan 7 05:23:30 PST 2009
---
tests/account-manager.py | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/tests/account-manager.py b/tests/account-manager.py
index 188522e..6673247 100644
--- a/tests/account-manager.py
+++ b/tests/account-manager.py
@@ -244,7 +244,34 @@ class Account(Object):
@method(dbus.PROPERTIES_IFACE,
in_signature='ssv')
def Set(self, iface, prop, value):
- raise NotImplementedError('Not implemented')
+ if iface == ACCOUNT_IFACE:
+ if prop == 'DisplayName':
+ self._display_name = unicode(value)
+ elif prop == 'Icon':
+ self._icon = unicode(value)
+ elif prop == 'Enabled':
+ self._enabled = bool(value)
+ elif prop == 'Nickname':
+ self._nickname = unicode(value)
+ elif prop == 'AutomaticPresence':
+ self._automatic_presence = dbus.Struct(
+ (dbus.UInt32(value[0]), unicode(value[1]),
+ unicode(value[2])),
+ signature='uss')
+ elif prop == 'ConnectAutomatically':
+ self._connect_automatically = bool(value)
+ elif prop == 'RequestedPresence':
+ # FIXME: pretend to put the account online, if appropriate?
+ self._requested_presence = dbus.Struct(
+ (dbus.UInt32(value[0]), unicode(value[1]),
+ unicode(value[2])),
+ signature='uss')
+ else:
+ raise ValueError('Read-only or nonexistent property')
+
+ self.AccountPropertyChanged({prop: self._account_props()[prop]})
+ else:
+ raise ValueError('No such interface')
if __name__ == '__main__':
DBusGMainLoop(set_as_default=True)
--
1.5.6.5
More information about the Telepathy-commits
mailing list