Fullscreen support and tray support in activity window

Fullscreen mode hides toolbox and tray
master
Simon Schampijer 17 years ago
parent 5084ecf4f4
commit 58f7dca355

@ -1,3 +1,6 @@
* Fullscreen support (hide toolbar and tray) and tray support in activity
window (erikos)
Snapshot 276e1ee517
* #4266 Avoid misleading warning every time an activity starts (smcv)

@ -16,60 +16,95 @@
# Boston, MA 02111-1307, USA.
import gtk
import hippo
class Window(gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
self.connect('realize', self._window_realize_cb)
self.connect('realize', self.__window_realize_cb)
self.connect('window-state-event', self.__window_state_event_cb)
self.toolbox = None
self._alerts = []
self.alert_position = -1
self.canvas = None
self.tray = None
self._vbox = gtk.VBox()
self._hbox = gtk.HBox()
self._vbox.pack_start(self._hbox)
self._hbox.show()
self.add(self._vbox)
self._vbox.show()
def set_canvas(self, canvas):
if self.canvas:
self._vbox.remove(self.canvas)
self._hbox.remove(self.canvas)
self._vbox.pack_start(canvas)
self._vbox.reorder_child(canvas, -1)
self._hbox.pack_start(canvas)
self.canvas = canvas
def set_toolbox(self, toolbox):
if self.toolbox:
self._vbox.remove(self.toolbox)
self._vbox.pack_start(toolbox, False)
self._vbox.reorder_child(toolbox, 0)
self.toolbox = toolbox
def set_tray(self, tray, position):
if self.tray:
box = self.tray.get_parent()
box.remove(self.tray)
if position == gtk.POS_LEFT:
self._hbox.pack_start(tray, False)
elif position == gtk.POS_RIGHT:
self._hbox.pack_end(tray, False)
elif position == gtk.POS_BOTTOM:
self._vbox.pack_end(tray, False)
self.tray = tray
def add_alert(self, alert):
self._alerts.append(alert)
if len(self._alerts) == 1:
self._vbox.pack_start(alert, False)
self._vbox.reorder_child(alert, self.alert_position)
if self.toolbox is not None:
self._vbox.reorder_child(alert, 1)
else:
self._vbox.reorder_child(alert, 0)
def remove_alert(self, alert):
if alert in self._alerts:
self._alerts.remove(alert)
self._vbox.remove(alert)
if len(self._alerts) >= 1:
self._vbox.pack_start(self._alerts[0], False)
self._vbox.reorder_child(self._alerts[0], self.alert_position)
def _window_realize_cb(self, window):
if self.toolbox is not None:
self._vbox.reorder_child(self._alerts[0], 1)
else:
self._vbox.reorder_child(self._alert[0], 0)
def __window_realize_cb(self, window):
group = gtk.Window()
group.realize()
window.window.set_group(group.window)
def __window_state_event_cb(self, window, event):
if event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN:
if self.toolbox is not None:
self.toolbox.hide()
if self.tray is not None:
self.tray.hide()
elif event.new_window_state == 0:
if self.toolbox is not None:
self.toolbox.show()
if self.tray is not None:
self.tray.show()
def get_canvas_screenshot(self):
if not self.canvas:
return None

@ -5,3 +5,4 @@
<Alt>n=next
<Alt>p=prev
<Alt>c=close
<Alt>return=fullscreen

Loading…
Cancel
Save