[Bugs] #3119 UNSP: traceback after Sugar startup
Sugar Labs Bugs
bugtracker-noreply at sugarlabs.org
Wed Oct 5 13:04:31 EDT 2011
#3119: traceback after Sugar startup
------------------------------------------+---------------------------------
Reporter: erikos | Owner: erikos
Type: defect | Status: new
Priority: Unspecified by Maintainer | Milestone: 0.94
Component: sugar | Version: 0.93.x
Severity: Major | Keywords: 11.3.0 collaboration
Distribution: Unspecified | Status_field: New
------------------------------------------+---------------------------------
Comment(by erikos):
The issue here is that we do not have a connection yet, when the name
owner changes. It is safer to listen to the connection watcher when a
connection is added.
{{{
diff --git a/src/jarabe/model/buddy.py b/src/jarabe/model/buddy.py
index 8f17d7e..67ab104 100644
--- a/src/jarabe/model/buddy.py
+++ b/src/jarabe/model/buddy.py
@@ -21,6 +21,7 @@ import gobject
import gconf
import dbus
from telepathy.client import Connection
+
from telepathy.interfaces import CONNECTION
from sugar.graphics.xocolor import XoColor
@@ -107,27 +108,8 @@ class OwnerBuddyModel(BaseBuddyModel):
self.connect('notify::nick', self.__property_changed_cb)
self.connect('notify::color', self.__property_changed_cb)
- bus = dbus.SessionBus()
- bus.add_signal_receiver(
- self.__name_owner_changed_cb,
- signal_name='NameOwnerChanged',
- dbus_interface='org.freedesktop.DBus')
-
- bus_object = bus.get_object(dbus.BUS_DAEMON_NAME,
dbus.BUS_DAEMON_PATH)
- for service in bus_object.ListNames(
- dbus_interface=dbus.BUS_DAEMON_IFACE):
- if service.startswith(CONNECTION + '.'):
- path = '/%s' % service.replace('.', '/')
- Connection(service, path, bus,
- ready_handler=self.__connection_ready_cb)
-
- def __connection_ready_cb(self, connection):
- self._sync_properties_on_connection(connection)
-
- def __name_owner_changed_cb(self, name, old, new):
- if name.startswith(CONNECTION + '.') and not old and new:
- path = '/' + name.replace('.', '/')
- Connection(name, path,
ready_handler=self.__connection_ready_cb)
+ conn_watcher = connection_watcher.get_instance()
+ conn_watcher.connect('connection-added',
self.__connection_added_cb)
def __property_changed_cb(self, buddy, pspec):
self._sync_properties()
}}}
--
Ticket URL: <http://bugs.sugarlabs.org/ticket/3119#comment:2>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list