Ticket #3868: 0001-Show-Bookmark-toolbar-when-a-bookmark-is-added-SL-38.2.patch

File 0001-Show-Bookmark-toolbar-when-a-bookmark-is-added-SL-38.2.patch, 3.0 KB (added by humitos, 12 years ago)

v2 - use ToggleToolButton and set tooltips properly

  • viewtoolbar.py

    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 
    2121from gi.repository import GObject
    2222
    2323from sugar3.graphics.toolbutton import ToolButton
     24from sugar3.graphics.toggletoolbutton import ToggleToolButton
    2425
    2526from browser import Browser
    2627from browser import ZOOM_ORIGINAL
    class ViewToolbar(Gtk.Toolbar): 
    6566        self.insert(self.fullscreen, -1)
    6667        self.fullscreen.show()
    6768
    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)
    7071        self.traybutton.props.sensitive = False
     72        self.traybutton.props.active = False
    7173        self.insert(self.traybutton, -1)
    7274        self.traybutton.show()
    7375
    class ViewToolbar(Gtk.Toolbar): 
    105107    def __fullscreen_clicked_cb(self, button):
    106108        self._activity.fullscreen()
    107109
    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:
    110112            self._activity.tray.show()
     113            self.tray_set_hide()
    111114        else:
    112115            self._activity.tray.hide()
     116            self.tray_set_show()
    113117
    114118    def __map_cb(self, tray):
    115119        if len(self._activity.tray.get_children()) > 0:
    class ViewToolbar(Gtk.Toolbar): 
    120124            self.tray_set_show()
    121125
    122126    def tray_set_show(self):
    123         self.traybutton.set_icon('tray-show')
     127        self.traybutton.set_icon_name('tray-show')
    124128        self.traybutton.set_tooltip(_('Show Tray'))
     129        self.traybutton.props.active = False
    125130
    126131    def tray_set_hide(self):
    127         self.traybutton.set_icon('tray-hide')
     132        self.traybutton.set_icon_name('tray-hide')
    128133        self.traybutton.set_tooltip(_('Hide Tray'))
     134        self.traybutton.props.active = True
  • webactivity.py

    diff --git a/webactivity.py b/webactivity.py
    index 75b857b..3b2827b 100644
    a b class WebActivity(activity.Activity): 
    173173
    174174        self._tray = HTray()
    175175        self.set_tray(self._tray, Gtk.PositionType.BOTTOM)
    176         self._tray.show()
    177176
    178177        self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self)
    179178        self._edit_toolbar = EditToolbar(self)