[Pkg-sugar-commit] [sugar-browse-activity] 13/18: implement OLPC #10364 - Home Button in Browse

Jonas Smedegaard dr at jones.dk
Mon Apr 20 09:47:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 108.1
in repository sugar-browse-activity.

commit 1a1e929370ef3a1917c800d8d948442b4a93f163
Author: Gonzalo Odiard <godiard at sugarlabs.org>
Date:   Tue Oct 19 10:18:28 2010 -0300

    implement OLPC #10364 - Home Button in Browse
    
    Add a button in the webtoolbar to go to the home page.
    I have added a new signal to the toolbar to notify to the activity.
---
 webactivity.py |  4 ++++
 webtoolbar.py  | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/webactivity.py b/webactivity.py
index 39bb67e..ec010b0 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -220,6 +220,7 @@ class WebActivity(activity.Activity):
         self._browser.history.connect('session-link-changed', 
                                       self._session_history_changed_cb)
         self._web_toolbar.connect('add-link', self._link_add_button_cb)
+        self._web_toolbar.connect('go-home', self._go_home_button_cb)
 
         self._browser.connect("notify::title", self._title_changed_cb)
 
@@ -443,6 +444,9 @@ class WebActivity(activity.Activity):
     def _link_add_button_cb(self, button):
         _logger.debug('button: Add link: %s.' % self.current)                
         self._add_link()
+
+    def _go_home_button_cb(self, button):
+        self._load_homepage()
             
     def _key_press_cb(self, widget, event):
         if event.state & gtk.gdk.CONTROL_MASK:
diff --git a/webtoolbar.py b/webtoolbar.py
index d87dbd8..227e4ef 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -217,6 +217,9 @@ class WebToolbar(gtk.Toolbar):
     __gsignals__ = {
         'add-link': (gobject.SIGNAL_RUN_FIRST,
                      gobject.TYPE_NONE,
+                     ([])),
+        'go-home': (gobject.SIGNAL_RUN_FIRST,
+                     gobject.TYPE_NONE,
                      ([]))
     }
 
@@ -241,6 +244,12 @@ class WebToolbar(gtk.Toolbar):
         self.insert(self._forward, -1)
         self._forward.show()
 
+        self._go_home = ToolButton('go-home')
+        self._go_home.set_tooltip(_('Home page'))
+        self._go_home.connect('clicked', self._go_home_cb)
+        self.insert(self._go_home, -1)
+        self._go_home.show()
+
         self._stop_and_reload = ToolButton('media-playback-stop')
         self._stop_and_reload.connect('clicked', self._stop_and_reload_cb)
         self.insert(self._stop_and_reload, -1)
@@ -329,6 +338,10 @@ class WebToolbar(gtk.Toolbar):
     def _go_forward_cb(self, button):
         self._browser.web_navigation.goForward()
 
+    def _go_home_cb(self, button):
+        self.emit('go-home')
+        self._activity.load_homepage()
+
     def _title_changed_cb(self, embed, spec):
         self._set_title(embed.props.title)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-browse-activity.git



More information about the pkg-sugar-commit mailing list