Some cleanups

This commit is contained in:
Marco Pesenti Gritti 2006-08-16 00:41:51 +02:00
parent 1cfd208f7b
commit 6b181ced13

View File

@ -20,21 +20,21 @@ class MessageQueue:
self._console_id = console_id self._console_id = console_id
self._levels = [] self._levels = []
self._messages = [] self._messages = []
self._bus = dbus.SessionBus()
if self._console == None: if self._console == None:
bus = dbus.SessionBus() con = self._bus._connection
con = bus._connection
if dbus.dbus_bindings.bus_name_has_owner(con, CONSOLE_BUS_NAME): if dbus.dbus_bindings.bus_name_has_owner(con, CONSOLE_BUS_NAME):
print >> sys.stderr, 'Setup now'
self.setup_console() self.setup_console()
else: else:
bus.add_signal_receiver(self.__name_owner_changed, self._bus.add_signal_receiver(
self.__name_owner_changed,
dbus_interface = "org.freedesktop.DBus", dbus_interface = "org.freedesktop.DBus",
signal_name = "NameOwnerChanged") signal_name = "NameOwnerChanged")
def setup_console(self): def setup_console(self):
bus = dbus.SessionBus() proxy_obj = self._bus.get_object(CONSOLE_BUS_NAME,
proxy_obj = bus.get_object(CONSOLE_BUS_NAME, CONSOLE_OBJECT_PATH) CONSOLE_OBJECT_PATH)
self._console = dbus.Interface(proxy_obj, CONSOLE_IFACE) self._console = dbus.Interface(proxy_obj, CONSOLE_IFACE)
self._queue_log() self._queue_log()