From 90990c178837d2d31f63df8a9209f49b03cc8ed3 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Sun, 16 Sep 2007 14:32:26 +0000 Subject: * Make hide/show of the treay one button #3475 --- (limited to 'webtoolbar.py') diff --git a/webtoolbar.py b/webtoolbar.py index 6aab4bd..098ac4d 100755 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -38,12 +38,9 @@ class WebToolbar(gtk.Toolbar): 'add-link': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), - 'show-tray': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])), - 'hide-tray': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - ([])) + 'visibility-tray': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, + ([])) } def __init__(self, browser): @@ -87,18 +84,12 @@ class WebToolbar(gtk.Toolbar): self.insert(self._link_add, -1) self._link_add.show() - self._tray_show = ToolButton('tray-show') - self._tray_show.set_tooltip(_('Show Tray')) - self._tray_show.connect('clicked', self._tray_show_clicked_cb) - self.insert(self._tray_show, -1) - self._tray_show.show() - - self._tray_hide = ToolButton('tray-hide') - self._tray_hide.set_tooltip(_('Hide Tray')) - self._tray_hide.connect('clicked', self._tray_hide_clicked_cb) - self.insert(self._tray_hide, -1) - self._tray_hide.show() - + self._tray_vis = ToolButton() + self._tray_vis.connect('clicked', self._tray_vis_clicked_cb) + self.insert(self._tray_vis, -1) + self.tray_set_empty() + self._tray_vis.show() + progress_listener = progresslistener.get_instance() progress_listener.connect('location-changed', self._location_changed_cb) progress_listener.connect('loading-start', self._loading_start_cb) @@ -219,8 +210,19 @@ class WebToolbar(gtk.Toolbar): def _link_add_clicked_cb(self, button): self.emit('add-link') - def _tray_show_clicked_cb(self, button): - self.emit('show-tray') - - def _tray_hide_clicked_cb(self, button): - self.emit('hide-tray') + def tray_set_empty(self): + self._tray_vis.set_icon('tray-empty') + self._tray_vis.set_sensitive(False) + + def tray_set_show(self): + self._tray_vis.set_icon('tray-show') + self._tray_vis.set_tooltip(_('Show Tray')) + self._tray_vis.set_sensitive(True) + + def tray_set_hide(self): + self._tray_vis.set_icon('tray-hide') + self._tray_vis.set_tooltip(_('Hide Tray')) + self._tray_vis.set_sensitive(True) + + def _tray_vis_clicked_cb(self, button): + self.emit('visibility-tray') -- cgit v0.9.1