From 3f4f7645c6ede853202a433758322a2dc432a88c Mon Sep 17 00:00:00 2001
From: Manuel Kaufmann <humitos@gmail.com>
Date: Wed, 26 Sep 2012 09:01:54 -0300
Subject: [PATCH v2 Browse] Show Bookmark toolbar when a bookmark is added SL
#3868
- The Bookmark toolbar is shown when the first bookmark is added by
the user.
- Set the correct tooltip when the bookmark tray is hidden or visible
- Use ToggleToolButton for Show / Hide bookmark tray button
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
---
viewtoolbar.py | 18 ++++++++++++------
webactivity.py | 1 -
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/viewtoolbar.py b/viewtoolbar.py
index e7ad13e..4313db5 100644
a
|
b
|
from gi.repository import Gtk |
21 | 21 | from gi.repository import GObject |
22 | 22 | |
23 | 23 | from sugar3.graphics.toolbutton import ToolButton |
| 24 | from sugar3.graphics.toggletoolbutton import ToggleToolButton |
24 | 25 | |
25 | 26 | from browser import Browser |
26 | 27 | from browser import ZOOM_ORIGINAL |
… |
… |
class ViewToolbar(Gtk.Toolbar): |
65 | 66 | self.insert(self.fullscreen, -1) |
66 | 67 | self.fullscreen.show() |
67 | 68 | |
68 | | self.traybutton = ToolButton('tray-hide') |
69 | | self.traybutton.connect('clicked', self.__tray_clicked_cb) |
| 69 | self.traybutton = ToggleToolButton('tray-show') |
| 70 | self.traybutton.connect('toggled', self.__tray_toggled_cb) |
70 | 71 | self.traybutton.props.sensitive = False |
| 72 | self.traybutton.props.active = False |
71 | 73 | self.insert(self.traybutton, -1) |
72 | 74 | self.traybutton.show() |
73 | 75 | |
… |
… |
class ViewToolbar(Gtk.Toolbar): |
105 | 107 | def __fullscreen_clicked_cb(self, button): |
106 | 108 | self._activity.fullscreen() |
107 | 109 | |
108 | | def __tray_clicked_cb(self, button): |
109 | | if self._activity.tray.props.visible is False: |
| 110 | def __tray_toggled_cb(self, button): |
| 111 | if button.props.active: |
110 | 112 | self._activity.tray.show() |
| 113 | self.tray_set_hide() |
111 | 114 | else: |
112 | 115 | self._activity.tray.hide() |
| 116 | self.tray_set_show() |
113 | 117 | |
114 | 118 | def __map_cb(self, tray): |
115 | 119 | if len(self._activity.tray.get_children()) > 0: |
… |
… |
class ViewToolbar(Gtk.Toolbar): |
120 | 124 | self.tray_set_show() |
121 | 125 | |
122 | 126 | def tray_set_show(self): |
123 | | self.traybutton.set_icon('tray-show') |
| 127 | self.traybutton.set_icon_name('tray-show') |
124 | 128 | self.traybutton.set_tooltip(_('Show Tray')) |
| 129 | self.traybutton.props.active = False |
125 | 130 | |
126 | 131 | def tray_set_hide(self): |
127 | | self.traybutton.set_icon('tray-hide') |
| 132 | self.traybutton.set_icon_name('tray-hide') |
128 | 133 | self.traybutton.set_tooltip(_('Hide Tray')) |
| 134 | self.traybutton.props.active = True |
diff --git a/webactivity.py b/webactivity.py
index 75b857b..3b2827b 100644
a
|
b
|
class WebActivity(activity.Activity): |
173 | 173 | |
174 | 174 | self._tray = HTray() |
175 | 175 | self.set_tray(self._tray, Gtk.PositionType.BOTTOM) |
176 | | self._tray.show() |
177 | 176 | |
178 | 177 | self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self) |
179 | 178 | self._edit_toolbar = EditToolbar(self) |