Implement close button for the activity.
Some fixes.
This commit is contained in:
parent
1f3187e0b5
commit
180c65e81c
@ -70,6 +70,9 @@ class ActivityHost:
|
|||||||
def present(self):
|
def present(self):
|
||||||
self._window.activate(gtk.get_current_event_time())
|
self._window.activate(gtk.get_current_event_time())
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self._window.close(gtk.get_current_event_time())
|
||||||
|
|
||||||
def show_dialog(self, dialog):
|
def show_dialog(self, dialog):
|
||||||
dialog.show()
|
dialog.show()
|
||||||
dialog.window.set_transient_for(self._gdk_window)
|
dialog.window.set_transient_for(self._gdk_window)
|
||||||
|
@ -77,8 +77,7 @@ class Shell(gobject.GObject):
|
|||||||
if window == None:
|
if window == None:
|
||||||
self._model.set_current_activity(None)
|
self._model.set_current_activity(None)
|
||||||
self.emit('activity-changed', None)
|
self.emit('activity-changed', None)
|
||||||
|
elif window.get_window_type() == wnck.WINDOW_NORMAL:
|
||||||
if window.get_window_type() == wnck.WINDOW_NORMAL:
|
|
||||||
activity_host = self._hosts[window.get_xid()]
|
activity_host = self._hosts[window.get_xid()]
|
||||||
|
|
||||||
current = self._model.get_current_activity()
|
current = self._model.get_current_activity()
|
||||||
|
@ -70,8 +70,11 @@ class RightPanel(CanvasBox):
|
|||||||
'buddy-left', self.__buddy_left_cb)
|
'buddy-left', self.__buddy_left_cb)
|
||||||
|
|
||||||
def __activity_changed_cb(self, group, activity):
|
def __activity_changed_cb(self, group, activity):
|
||||||
activity_ps = self._pservice.get_activity(activity.get_id())
|
if activity:
|
||||||
self._set_activity_ps(activity_ps)
|
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):
|
def __buddy_joined_cb(self, activity, buddy):
|
||||||
self.add(buddy)
|
self.add(buddy)
|
||||||
|
@ -9,6 +9,7 @@ import sugar
|
|||||||
|
|
||||||
class ActivityMenu(Menu):
|
class ActivityMenu(Menu):
|
||||||
ACTION_SHARE = 1
|
ACTION_SHARE = 1
|
||||||
|
ACTION_CLOSE = 2
|
||||||
|
|
||||||
def __init__(self, grid, activity_host):
|
def __init__(self, grid, activity_host):
|
||||||
title = activity_host.get_title()
|
title = activity_host.get_title()
|
||||||
@ -17,6 +18,9 @@ class ActivityMenu(Menu):
|
|||||||
icon = IconItem(icon_name='stock-share')
|
icon = IconItem(icon_name='stock-share')
|
||||||
self.add_action(icon, ActivityMenu.ACTION_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):
|
class ActivityIcon(MenuIcon):
|
||||||
def __init__(self, shell, activity_host):
|
def __init__(self, shell, activity_host):
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
@ -36,10 +40,16 @@ class ActivityIcon(MenuIcon):
|
|||||||
return menu
|
return menu
|
||||||
|
|
||||||
def _action_cb(self, menu, action):
|
def _action_cb(self, menu, action):
|
||||||
|
self.popdown()
|
||||||
|
|
||||||
|
activity = self._shell.get_current_activity()
|
||||||
|
if activity == None:
|
||||||
|
return
|
||||||
|
|
||||||
if action == ActivityMenu.ACTION_SHARE:
|
if action == ActivityMenu.ACTION_SHARE:
|
||||||
activity = shell.get_current_activity()
|
activity.share()
|
||||||
if activity != None:
|
if action == ActivityMenu.ACTION_CLOSE:
|
||||||
activity.share()
|
activity.close()
|
||||||
|
|
||||||
class TopPanel(goocanvas.Group):
|
class TopPanel(goocanvas.Group):
|
||||||
def __init__(self, shell):
|
def __init__(self, shell):
|
||||||
|
Loading…
Reference in New Issue
Block a user