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-09-18 09:56:53 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-09-18 09:56:53 (GMT)
commit180c65e81c80bd48362a30719502c688ab660985 (patch)
tree9a51f04c43cff529baa6ada30830639e08f6e851 /shell
parent1f3187e0b548ff87463a0a1ea98fa15779361c1b (diff)
Implement close button for the activity.
Some fixes.
Diffstat (limited to 'shell')
-rw-r--r--shell/view/ActivityHost.py3
-rw-r--r--shell/view/Shell.py3
-rw-r--r--shell/view/frame/RightPanel.py7
-rw-r--r--shell/view/frame/TopPanel.py16
4 files changed, 22 insertions, 7 deletions
diff --git a/shell/view/ActivityHost.py b/shell/view/ActivityHost.py
index 0e81acd..0845448 100644
--- a/shell/view/ActivityHost.py
+++ b/shell/view/ActivityHost.py
@@ -70,6 +70,9 @@ class ActivityHost:
def present(self):
self._window.activate(gtk.get_current_event_time())
+ def close(self):
+ self._window.close(gtk.get_current_event_time())
+
def show_dialog(self, dialog):
dialog.show()
dialog.window.set_transient_for(self._gdk_window)
diff --git a/shell/view/Shell.py b/shell/view/Shell.py
index f56f62d..821442c 100644
--- a/shell/view/Shell.py
+++ b/shell/view/Shell.py
@@ -77,8 +77,7 @@ class Shell(gobject.GObject):
if window == None:
self._model.set_current_activity(None)
self.emit('activity-changed', None)
-
- if window.get_window_type() == wnck.WINDOW_NORMAL:
+ elif window.get_window_type() == wnck.WINDOW_NORMAL:
activity_host = self._hosts[window.get_xid()]
current = self._model.get_current_activity()
diff --git a/shell/view/frame/RightPanel.py b/shell/view/frame/RightPanel.py
index 1412059..3cc2935 100644
--- a/shell/view/frame/RightPanel.py
+++ b/shell/view/frame/RightPanel.py
@@ -70,8 +70,11 @@ class RightPanel(CanvasBox):
'buddy-left', self.__buddy_left_cb)
def __activity_changed_cb(self, group, activity):
- activity_ps = self._pservice.get_activity(activity.get_id())
- self._set_activity_ps(activity_ps)
+ if activity:
+ ps = self._pservice.get_activity(activity.get_id())
+ self._set_activity_ps(ps)
+ else:
+ self._set_activity_ps(None)
def __buddy_joined_cb(self, activity, buddy):
self.add(buddy)
diff --git a/shell/view/frame/TopPanel.py b/shell/view/frame/TopPanel.py
index 188a7d7..35df67f 100644
--- a/shell/view/frame/TopPanel.py
+++ b/shell/view/frame/TopPanel.py
@@ -9,6 +9,7 @@ import sugar
class ActivityMenu(Menu):
ACTION_SHARE = 1
+ ACTION_CLOSE = 2
def __init__(self, grid, activity_host):
title = activity_host.get_title()
@@ -17,6 +18,9 @@ class ActivityMenu(Menu):
icon = IconItem(icon_name='stock-share')
self.add_action(icon, ActivityMenu.ACTION_SHARE)
+ icon = IconItem(icon_name='stock-close-activity')
+ self.add_action(icon, ActivityMenu.ACTION_CLOSE)
+
class ActivityIcon(MenuIcon):
def __init__(self, shell, activity_host):
self._shell = shell
@@ -36,10 +40,16 @@ class ActivityIcon(MenuIcon):
return menu
def _action_cb(self, menu, action):
+ self.popdown()
+
+ activity = self._shell.get_current_activity()
+ if activity == None:
+ return
+
if action == ActivityMenu.ACTION_SHARE:
- activity = shell.get_current_activity()
- if activity != None:
- activity.share()
+ activity.share()
+ if action == ActivityMenu.ACTION_CLOSE:
+ activity.close()
class TopPanel(goocanvas.Group):
def __init__(self, shell):