From 1acbba8a1b8236ed314c6185c8caad50ea63ab29 Mon Sep 17 00:00:00 2001 From: Morten Mjelva Date: Mon, 19 Apr 2010 21:29:25 +0200 Subject: [PATCH] Changed classes as per review comments --- src/client/Makefile.am | 2 ++ src/client/account.py | 16 +++++++--------- src/client/accountmgr.py | 16 +++++++--------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 7050c13..19e87fa 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -1,5 +1,7 @@ clientdir = $(pythondir)/telepathy/client client_PYTHON = \ + accountmgr.py \ + account.py \ channel.py \ connmgr.py \ conn.py \ diff --git a/src/client/account.py b/src/client/account.py index 36aeac4..6beab77 100644 --- a/src/client/account.py +++ b/src/client/account.py @@ -22,9 +22,7 @@ import dbus from telepathy.client.interfacefactory import (InterfaceFactory, default_error_handler, ) -from telepathy.interfaces import ACCOUNT - -DBUS_PROPERTIES = 'org.freedesktop.DBus.Properties' +from telepathy.interfaces import ACCOUNT, ACCOUNT_MANAGER class Account(InterfaceFactory): def __init__(self, object_path, bus=None, ready_handler=None, @@ -32,20 +30,20 @@ class Account(InterfaceFactory): if not bus: bus = dbus.Bus() - self.service_name = 'org.freedesktop.Telepathy.AccountManager' + self.service_name = ACCOUNT_MANAGER self.object_path = object_path self._ready_handler = ready_handler - self.error_cb = error_handler + self._error_cb = error_handler object = bus.get_object(self.service_name, self.object_path) InterfaceFactory.__init__(self, object, ACCOUNT) - self[DBUS_PROPERTIES].Get( + self[dbus.PROPERTIES_IFACE].Get( ACCOUNT, 'Interfaces', - reply_handler=self.get_interfaces_cb, - error_handler=self.error_cb) + reply_handler=self._get_interfaces_cb, + error_handler=self._error_cb) - def get_interfaces_cb(self, interfaces): + def _get_interfaces_cb(self, interfaces): self.get_valid_interfaces().update(interfaces) if self._ready_handler: self._ready_handler(self) diff --git a/src/client/accountmgr.py b/src/client/accountmgr.py index 570016e..daba76c 100644 --- a/src/client/accountmgr.py +++ b/src/client/accountmgr.py @@ -24,28 +24,26 @@ from telepathy.client.interfacefactory import (InterfaceFactory, ) from telepathy.interfaces import ACCOUNT_MANAGER -DBUS_PROPERTIES = 'org.freedesktop.DBus.Properties' - class AccountManager(InterfaceFactory): def __init__(self, bus=None, ready_handler=None, error_handler=default_error_handler): if not bus: bus = dbus.Bus() - self.service_name = 'org.freedesktop.Telepathy.AccountManager' - self.object_path = '/org/freedesktop/Telepathy/AccountManager' + self.service_name = ACCOUNT_MANAGER + self.object_path = '/' + self.service_name.replace('.', '/') self._ready_handler = ready_handler - self.error_cb = error_handler + self._error_cb = error_handler object = bus.get_object(self.service_name, self.object_path) InterfaceFactory.__init__(self, object, ACCOUNT_MANAGER) - self[DBUS_PROPERTIES].Get( + self[dbus.PROPERTIES_IFACE].Get( ACCOUNT_MANAGER, 'Interfaces', - reply_handler=self.get_interfaces_cb, - error_handler=self.error_cb) + reply_handler=self._get_interfaces_cb, + error_handler=self._error_cb) - def get_interfaces_cb(self, interfaces): + def _get_interfaces_cb(self, interfaces): self.get_valid_interfaces().update(interfaces) if self._ready_handler: self._ready_handler(self) -- 1.7.0.4