Fullscreen support and tray support in activity window

Fullscreen mode hides toolbox and tray
This commit is contained in:
Simon Schampijer 2007-10-18 23:56:58 +02:00
parent 5084ecf4f4
commit 58f7dca355
3 changed files with 53 additions and 14 deletions

3
NEWS
View File

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

View File

@ -16,29 +16,32 @@
# Boston, MA 02111-1307, USA. # Boston, MA 02111-1307, USA.
import gtk import gtk
import hippo
class Window(gtk.Window): class Window(gtk.Window):
def __init__(self): def __init__(self):
gtk.Window.__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.toolbox = None
self._alerts = [] self._alerts = []
self.alert_position = -1
self.canvas = None self.canvas = None
self.tray = None
self._vbox = gtk.VBox() self._vbox = gtk.VBox()
self._hbox = gtk.HBox()
self._vbox.pack_start(self._hbox)
self._hbox.show()
self.add(self._vbox) self.add(self._vbox)
self._vbox.show() self._vbox.show()
def set_canvas(self, canvas): def set_canvas(self, canvas):
if self.canvas: if self.canvas:
self._vbox.remove(self.canvas) self._hbox.remove(self.canvas)
self._vbox.pack_start(canvas) self._hbox.pack_start(canvas)
self._vbox.reorder_child(canvas, -1)
self.canvas = canvas self.canvas = canvas
@ -51,11 +54,28 @@ class Window(gtk.Window):
self.toolbox = toolbox 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): def add_alert(self, alert):
self._alerts.append(alert) self._alerts.append(alert)
if len(self._alerts) == 1: if len(self._alerts) == 1:
self._vbox.pack_start(alert, False) 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): def remove_alert(self, alert):
if alert in self._alerts: if alert in self._alerts:
@ -63,13 +83,28 @@ class Window(gtk.Window):
self._vbox.remove(alert) self._vbox.remove(alert)
if len(self._alerts) >= 1: if len(self._alerts) >= 1:
self._vbox.pack_start(self._alerts[0], False) self._vbox.pack_start(self._alerts[0], False)
self._vbox.reorder_child(self._alerts[0], self.alert_position) 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): def __window_realize_cb(self, window):
group = gtk.Window() group = gtk.Window()
group.realize() group.realize()
window.window.set_group(group.window) 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): def get_canvas_screenshot(self):
if not self.canvas: if not self.canvas:
return None return None

View File

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