From 6b181ced1307e9e02d43735fd364befbcdfa972a Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 16 Aug 2006 00:41:51 +0200 Subject: [PATCH] Some cleanups --- sugar/logger.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sugar/logger.py b/sugar/logger.py index 7f9dab1f..e5bc37cf 100644 --- a/sugar/logger.py +++ b/sugar/logger.py @@ -20,21 +20,21 @@ class MessageQueue: self._console_id = console_id self._levels = [] self._messages = [] - + self._bus = dbus.SessionBus() + if self._console == None: - bus = dbus.SessionBus() - con = bus._connection + con = self._bus._connection if dbus.dbus_bindings.bus_name_has_owner(con, CONSOLE_BUS_NAME): - print >> sys.stderr, 'Setup now' self.setup_console() else: - bus.add_signal_receiver(self.__name_owner_changed, - dbus_interface = "org.freedesktop.DBus", - signal_name = "NameOwnerChanged") + self._bus.add_signal_receiver( + self.__name_owner_changed, + dbus_interface = "org.freedesktop.DBus", + signal_name = "NameOwnerChanged") def setup_console(self): - bus = dbus.SessionBus() - proxy_obj = bus.get_object(CONSOLE_BUS_NAME, CONSOLE_OBJECT_PATH) + proxy_obj = self._bus.get_object(CONSOLE_BUS_NAME, + CONSOLE_OBJECT_PATH) self._console = dbus.Interface(proxy_obj, CONSOLE_IFACE) self._queue_log()