Use the default service to get activity informations, instead
of Activity ps object.
This commit is contained in:
parent
544e47cbe0
commit
2535a88645
@ -46,8 +46,6 @@ class BrowserActivity(Activity):
|
||||
self.add(vbox)
|
||||
vbox.show()
|
||||
|
||||
self._pservice = PresenceService()
|
||||
|
||||
if service:
|
||||
service.connect('service-appeared', self._service_appeared_cb)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
[Activity]
|
||||
name = Terminal
|
||||
id = org.sugar.Terminal
|
||||
default_type = _terminal_olpc._udp
|
||||
python_module = terminal.TerminalActivity.TerminalActivity
|
||||
|
@ -3,17 +3,17 @@ import xml.sax.saxutils
|
||||
import gobject
|
||||
|
||||
from sugar.presence.PresenceService import PresenceService
|
||||
from ActivityRegistry import ActivityRegistry
|
||||
|
||||
class ActivityInfo:
|
||||
def __init__(self, service):
|
||||
self._service = service
|
||||
|
||||
def get_id(self):
|
||||
activity_id = self._service.get_id()
|
||||
return self._service.get_activity_id()
|
||||
|
||||
def get_type(self):
|
||||
# FIXME
|
||||
return "_web_olpc._udp"
|
||||
return self._service.get_type()
|
||||
|
||||
def get_title(self):
|
||||
return "FIXME Title"
|
||||
@ -29,13 +29,14 @@ class ActivitiesModel(gobject.GObject):
|
||||
([gobject.TYPE_PYOBJECT]))
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, registry):
|
||||
gobject.GObject.__init__(self)
|
||||
|
||||
self._activities = []
|
||||
self._registry = registry
|
||||
|
||||
self._pservice = PresenceService()
|
||||
self._pservice.connect("activity-appeared", self._on_activity_announced_cb)
|
||||
self._pservice.connect("service-appeared", self.__service_appeared_cb)
|
||||
|
||||
def add_activity(self, service):
|
||||
activity_info = ActivityInfo(service)
|
||||
@ -45,5 +46,6 @@ class ActivitiesModel(gobject.GObject):
|
||||
def __iter__(self):
|
||||
return self._activities.__iter__()
|
||||
|
||||
def _on_activity_announced_cb(self, pservice, activity):
|
||||
self.add_activity(activity)
|
||||
def __service_appeared_cb(self, pservice, service):
|
||||
if self._registry.get_activity(service.get_type()) != None:
|
||||
self.add_activity(service)
|
||||
|
@ -144,7 +144,7 @@ class HomeWindow(gtk.Window):
|
||||
vbox.pack_start(label, False)
|
||||
label.show()
|
||||
|
||||
model = ActivitiesModel()
|
||||
model = ActivitiesModel(shell.get_registry())
|
||||
grid = ActivitiesGrid(shell, model)
|
||||
vbox.pack_start(grid)
|
||||
grid.show()
|
||||
|
@ -146,7 +146,7 @@ class Activity(gtk.Window):
|
||||
gtk.Window.__init__(self)
|
||||
|
||||
if service:
|
||||
self._activity_id = service.get_id()
|
||||
self._activity_id = service.get_activity_id()
|
||||
self._shared = True
|
||||
else:
|
||||
self._activity_id = sugar.util.unique_id()
|
||||
@ -156,6 +156,7 @@ class Activity(gtk.Window):
|
||||
self._initial_service = None
|
||||
self._activity_object = None
|
||||
self._default_type = None
|
||||
self._pservice = PresenceService()
|
||||
|
||||
self.connect('realize', self.__realize)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user