Merge branch 'master' of git+ssh://dcbw@crank.laptop.org/git/sugar

This commit is contained in:
Dan Williams
2006-06-22 22:42:35 -04:00
12 changed files with 245 additions and 587 deletions
+1 -6
View File
@@ -90,10 +90,9 @@ class PresenceService(gobject.GObject):
return PresenceService.__instance
get_instance = staticmethod(get_instance)
def __init__(self, debug=True):
def __init__(self):
gobject.GObject.__init__(self)
self._debug = debug
self._lock = threading.Lock()
self._started = False
@@ -158,9 +157,6 @@ class PresenceService(gobject.GObject):
db = dbus.Interface(self._bus.get_object(avahi.DBUS_NAME, domain_browser), avahi.DBUS_INTERFACE_DOMAIN_BROWSER)
db.connect_to_signal('ItemNew', self._new_domain_cb_glue)
def set_debug(self, debug):
self._debug = debug
def get_owner(self):
"""Return the owner of this machine/instance, if we've recognized them yet."""
return self._owner
@@ -634,7 +630,6 @@ def main():
import pygtk, gtk
global ps
ps = PresenceService.get_instance()
ps.set_debug(True)
ps.start()
gobject.timeout_add(4000, runTests)
gtk.main()
+14 -5
View File
@@ -69,9 +69,6 @@ def deserialize(sdict):
stype = sdict['stype']
if type(stype) == type(u""):
stype = stype.encode()
activity_id = sdict['activity_id']
if type(activity_id) == type(u""):
activity_id = activity_id.encode()
domain = sdict['domain']
if type(domain) == type(u""):
domain = domain.encode()
@@ -87,7 +84,18 @@ def deserialize(sdict):
address = address.encode()
except KeyError:
pass
name = compose_service_name(name, activity_id)
activity_id = None
try:
activity_id = sdict['activity_id']
if type(activity_id) == type(u""):
activity_id = activity_id.encode()
except KeyError:
pass
if activity_id is not None:
name = compose_service_name(name, activity_id)
return Service(name, stype, domain, address=address,
port=port, properties=properties)
@@ -152,7 +160,8 @@ class Service(object):
else:
sdict['name'] = dbus.Variant(self._name)
sdict['stype'] = dbus.Variant(self._stype)
sdict['activity_id'] = dbus.Variant(self._activity_id)
if self._activity_id:
sdict['activity_id'] = dbus.Variant(self._activity_id)
sdict['domain'] = dbus.Variant(self._domain)
if self._address:
sdict['address'] = dbus.Variant(self._address)