Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-08-17 12:23:52 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-08-17 12:23:52 (GMT)
commitf65d23c44002fe94477cb3354667e9297e386092 (patch)
treeffa41ac5844b5660288af9f8c80e880e3d5584a7 /shell
parent10f356cb22ffcaddfbbcd0b8332ef65409e5bf5f (diff)
Add icon for activity to the donut.
Add signals in the shell for window open/close and use them in the task view.
Diffstat (limited to 'shell')
-rw-r--r--shell/ActivityHost.py6
-rw-r--r--shell/ChatController.py3
-rw-r--r--shell/HomeWindow.py41
-rwxr-xr-xshell/Shell.py13
4 files changed, 35 insertions, 28 deletions
diff --git a/shell/ActivityHost.py b/shell/ActivityHost.py
index 639c589..84577c1 100644
--- a/shell/ActivityHost.py
+++ b/shell/ActivityHost.py
@@ -20,9 +20,15 @@ class ActivityHost:
self._gdk_window = gtk.gdk.window_foreign_new(self._xid)
self._people_window = PeopleWindow(shell, self)
+ info = self._shell.get_registry().get_activity(self._default_type)
+ self._icon_name = info.get_icon()
+
def get_id(self):
return self._id
+ def get_icon_name(self):
+ return self._icon_name
+
def share(self):
self._people_window.share()
self._activity.share()
diff --git a/shell/ChatController.py b/shell/ChatController.py
index 96d2fd0..00bab80 100644
--- a/shell/ChatController.py
+++ b/shell/ChatController.py
@@ -13,7 +13,8 @@ class ChatController:
self._shell.connect('activity-closed', self.__activity_closed_cb)
- def __activity_closed_cb(self, shell, activity_id):
+ def __activity_closed_cb(self, shell, activity):
+ activity_id = activity.get_id()
if self._id_to_name.has_key(activity_id):
name = self._id_to_name[activity_id]
del self._name_to_chat[name]
diff --git a/shell/HomeWindow.py b/shell/HomeWindow.py
index ed86e6f..26d29cc 100644
--- a/shell/HomeWindow.py
+++ b/shell/HomeWindow.py
@@ -7,35 +7,30 @@ from sugar.canvas.DonutItem import DonutItem
from sugar.canvas.DonutItem import PieceItem
class TasksItem(DonutItem):
- def __init__(self):
+ def __init__(self, shell):
DonutItem.__init__(self, 250)
self._items = {}
- screen = wnck.screen_get_default()
- for window in screen.get_windows():
- if not window.is_skip_tasklist():
- self._add(window)
- screen.connect('window_opened', self.__window_opened_cb)
- screen.connect('window_closed', self.__window_closed_cb)
+ shell.connect('activity_opened', self.__activity_opened_cb)
+ shell.connect('activity_closed', self.__activity_closed_cb)
- def __window_opened_cb(self, screen, window):
- if not window.is_skip_tasklist():
- self._add(window)
+ def __activity_opened_cb(self, shell, activity):
+ self._add(activity)
- def __window_closed_cb(self, screen, window):
- if not window.is_skip_tasklist():
- self._remove(window)
+ def __activity_closed_cb(self, shell, activity):
+ self._remove(activity)
- def _remove(self, window):
- item = self._items[window.get_xid()]
+ def _remove(self, activity):
+ item = self._items[activity.get_id()]
self.remove_child(item)
- del self._items[window.get_xid()]
+ del self._items[activity.get_id()]
- def _add(self, window):
- item = self.add_piece(100 / 8)
- item.set_data('window', window)
- self._items[window.get_xid()] = item
+ def _add(self, activity):
+ icon_name = activity.get_icon_name()
+ item = self.add_piece(100 / 8, icon_name, 'blue')
+ item.set_data('activity', activity)
+ self._items[activity.get_id()] = item
class ActivityItem(IconItem):
def __init__(self, activity):
@@ -91,7 +86,7 @@ class Model(goocanvas.CanvasModelSimple):
activity_bar.translate(50, 860)
root.add_child(activity_bar)
- tasks = TasksItem()
+ tasks = TasksItem(shell)
tasks.translate(600, 450)
root.add_child(tasks)
@@ -130,8 +125,8 @@ class HomeWindow(gtk.Window):
self._shell.start_activity(activity_id)
def __task_button_press_cb(self, view, target, event):
- window = view.get_item().get_data('window')
- window.activate(gtk.get_current_event_time())
+ activity = view.get_item().get_data('activity')
+ activity.present()
def __realize_cb(self, window):
self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
diff --git a/shell/Shell.py b/shell/Shell.py
index 614e1d1..50072fb 100755
--- a/shell/Shell.py
+++ b/shell/Shell.py
@@ -39,7 +39,10 @@ class ShellDbusService(dbus.service.Object):
class Shell(gobject.GObject):
__gsignals__ = {
- 'activity-closed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([str]))
+ 'activity-opened': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])),
+ 'activity-closed': (gobject.SIGNAL_RUN_FIRST,
+ gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT]))
}
def __init__(self, registry):
@@ -71,14 +74,16 @@ class Shell(gobject.GObject):
def __window_opened_cb(self, screen, window):
if window.get_window_type() == wnck.WINDOW_NORMAL:
- self._hosts[window.get_xid()] = ActivityHost(self, window)
+ host = ActivityHost(self, window)
+ self._hosts[window.get_xid()] = host
+ self.emit('activity-opened', host)
def __window_closed_cb(self, screen, window):
if window.get_window_type() == wnck.WINDOW_NORMAL:
xid = window.get_xid()
- activity = self._hosts[xid]
- self.emit('activity-closed', activity.get_id())
+ host = self._hosts[xid]
+ self.emit('activity-closed', host)
del self._hosts[xid]