2006-09-15 12:40:46 +02:00
|
|
|
from sugar.presence import PresenceService
|
2006-09-15 16:19:56 +02:00
|
|
|
from model.Friends import Friends
|
2006-09-25 16:01:11 +02:00
|
|
|
from model.MeshModel import MeshModel
|
2006-09-15 12:52:37 +02:00
|
|
|
from model.Owner import ShellOwner
|
2006-09-27 23:00:12 +02:00
|
|
|
import gobject
|
|
|
|
|
|
|
|
class ShellModel(gobject.GObject):
|
|
|
|
__gsignals__ = {
|
|
|
|
'activity-changed': (gobject.SIGNAL_RUN_FIRST,
|
|
|
|
gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT]))
|
|
|
|
}
|
2006-09-15 12:40:46 +02:00
|
|
|
|
|
|
|
def __init__(self):
|
2006-09-27 23:00:12 +02:00
|
|
|
gobject.GObject.__init__(self)
|
2006-09-15 12:40:46 +02:00
|
|
|
self._current_activity = None
|
|
|
|
|
|
|
|
PresenceService.start()
|
|
|
|
self._pservice = PresenceService.get_instance()
|
|
|
|
|
2006-09-27 23:00:12 +02:00
|
|
|
self._owner = ShellOwner(self)
|
2006-09-15 12:40:46 +02:00
|
|
|
self._owner.announce()
|
2006-09-15 16:19:56 +02:00
|
|
|
self._friends = Friends()
|
2006-09-25 16:01:11 +02:00
|
|
|
self._mesh = MeshModel()
|
|
|
|
|
|
|
|
def get_mesh(self):
|
|
|
|
return self._mesh
|
2006-09-15 12:40:46 +02:00
|
|
|
|
|
|
|
def get_friends(self):
|
2006-09-15 16:19:56 +02:00
|
|
|
return self._friends
|
2006-09-15 12:40:46 +02:00
|
|
|
|
|
|
|
def get_invites(self):
|
2006-09-15 16:19:56 +02:00
|
|
|
return self._owner.get_invites()
|
2006-09-15 12:40:46 +02:00
|
|
|
|
|
|
|
def get_owner(self):
|
|
|
|
return self._owner
|
|
|
|
|
2006-09-18 11:48:33 +02:00
|
|
|
def set_current_activity(self, activity_id):
|
|
|
|
self._current_activity = activity_id
|
2006-09-27 23:00:12 +02:00
|
|
|
self.emit('activity-changed', activity_id)
|
2006-09-15 12:40:46 +02:00
|
|
|
|
|
|
|
def get_current_activity(self):
|
|
|
|
return self._current_activity
|