sugar-toolkit-gtk3/shell/model/ShellModel.py

82 lines
2.3 KiB
Python
Raw Normal View History

2006-10-15 01:24:45 +02:00
# Copyright (C) 2006, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import os
import gobject
2007-04-09 20:40:56 +02:00
from sugar.presence import presenceservice
2006-10-29 19:05:09 +01:00
from sugar.activity.bundleregistry import BundleRegistry
2006-09-15 16:19:56 +02:00
from model.Friends import Friends
from model.MeshModel import MeshModel
from model.homemodel import HomeModel
2006-09-15 12:52:37 +02:00
from model.Owner import ShellOwner
from model.devices.devicesmodel import DevicesModel
from sugar import env
2006-09-15 12:40:46 +02:00
class ShellModel(gobject.GObject):
STATE_STARTUP = 0
STATE_RUNNING = 1
STATE_SHUTDOWN = 2
__gproperties__ = {
'state' : (int, None, None,
0, 2, STATE_RUNNING,
gobject.PARAM_READWRITE)
}
def __init__(self):
gobject.GObject.__init__(self)
self._current_activity = None
self._state = self.STATE_RUNNING
2006-09-15 12:40:46 +02:00
2007-04-09 20:40:56 +02:00
self._pservice = presenceservice.get_instance()
2006-09-15 12:40:46 +02:00
self._owner = ShellOwner()
self._owner.announce()
2006-10-29 19:05:09 +01:00
self._friends = Friends()
self._mesh = MeshModel()
self._home = HomeModel()
self._devices = DevicesModel()
def do_set_property(self, pspec, value):
if pspec.name == 'state':
self._state = value
def do_get_property(self, pspec):
if pspec.name == 'state':
return self._state
def get_mesh(self):
return self._mesh
2006-09-15 12:40:46 +02:00
def get_friends(self):
return self._friends
2006-09-15 12:40:46 +02:00
def get_invites(self):
return self._owner.get_invites()
2006-09-15 12:40:46 +02:00
def get_home(self):
return self._home
def get_owner(self):
return self._owner
def get_devices(self):
return self._devices