Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--icons/tray-hide.svg13
-rw-r--r--icons/tray-show.svg13
-rwxr-xr-xwebactivity.py24
-rwxr-xr-xwebtoolbar.py43
5 files changed, 86 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index de2f856..4fd86f7 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+* Added the buttons for hide/show tray (erikos)
+
51
* #3339 Add some mime types web-activity can handle (marco)
diff --git a/icons/tray-hide.svg b/icons/tray-hide.svg
new file mode 100644
index 0000000..4f30fa8
--- /dev/null
+++ b/icons/tray-hide.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
+<svg enable-background="new 0 0 55.125 55" height="55px" version="1.1" viewBox="0 0 55.125 55" width="55.125px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+ <g display="block" id="tray-hide">
+ <rect fill="#FFFFFF" height="15" width="45" x="5" y="35"/>
+ <g>
+ <line fill="none" stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="27.724" x2="27.724" y1="30.952" y2="5"/>
+ <polyline fill="none" points=" 35.445,21.798 27.724,30.952 20,21.798 " stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+ </g>
+ <rect fill="#808284" height="9" width="9" x="8" y="38"/>
+ <rect fill="#808284" height="9" width="9" x="23" y="38"/>
+ <rect fill="#808284" height="9" width="9" x="38" y="38"/>
+ </g>
+</svg>
diff --git a/icons/tray-show.svg b/icons/tray-show.svg
new file mode 100644
index 0000000..0361b23
--- /dev/null
+++ b/icons/tray-show.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
+<svg enable-background="new 0 0 55.125 55" height="55px" version="1.1" viewBox="0 0 55.125 55" width="55.125px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
+ <g display="block" id="tray-show">
+ <rect fill="#FFFFFF" height="15" width="45" x="5" y="35"/>
+ <rect fill="#808284" height="9" width="9" x="8" y="38"/>
+ <rect fill="#808284" height="9" width="9" x="23" y="38"/>
+ <rect fill="#808284" height="9" width="9" x="38" y="38"/>
+ <g>
+ <line fill="none" stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5" x1="27.723" x2="27.722" y1="5" y2="30.952"/>
+ <polyline fill="none" points="20,14.154 27.723,5 35.445,14.154 " stroke="#FFFFFF" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.5"/>
+ </g>
+ </g>
+</svg>
diff --git a/webactivity.py b/webactivity.py
index b613c0c..99e0f4b 100755
--- a/webactivity.py
+++ b/webactivity.py
@@ -89,8 +89,10 @@ class WebActivity(activity.Activity):
self._tray = HTray()
self.session_history = sessionhistory.get_instance()
self.session_history.connect('session-link-changed', self._session_history_changed_cb)
- self.toolbar._add_link.connect('clicked', self._share_link_button_cb)
- self.tray_isvisible = False
+ self.toolbar.connect('add-link', self._link_add_button_cb)
+ self.toolbar.connect('show-tray', self._tray_show_cb)
+ self.toolbar.connect('hide-tray', self._tray_hide_cb)
+ self.tray_isvisible = True
self._browser.connect("notify::title", self._title_changed_cb)
@@ -302,10 +304,20 @@ class WebActivity(activity.Activity):
finally:
f.close()
- def _share_link_button_cb(self, button):
+ def _link_add_button_cb(self, button):
_logger.debug('button: Add link: %s.' % self.current)
self._add_link()
-
+
+ def _tray_show_cb(self, button):
+ if self.tray_isvisible == False:
+ self._tray.show()
+ self.tray_isvisible = True
+
+ def _tray_hide_cb(self, button):
+ if self.tray_isvisible == True:
+ self._tray.hide()
+ self.tray_isvisible = False
+
def key_press_cb(self, widget, event):
if event.state & gtk.gdk.CONTROL_MASK:
if gtk.gdk.keyval_name(event.keyval) == "l":
@@ -359,7 +371,9 @@ class WebActivity(activity.Activity):
item.connect('remove_link', self._link_removed_cb)
self._tray.add_item(item, index) # use index to add to the tray
item.show()
- self.tray_isvisible = True
+ if self.tray_isvisible == False:
+ self._tray.show()
+ self.tray_isvisible = True
def _link_removed_cb(self, button, hash):
''' remove a link from tray and delete it in the model '''
diff --git a/webtoolbar.py b/webtoolbar.py
index 3623808..6aab4bd 100755
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -32,6 +32,20 @@ import progresslistener
import filepicker
class WebToolbar(gtk.Toolbar):
+ __gtype_name__ = 'WebToolbar'
+
+ __gsignals__ = {
+ '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,
+ ([]))
+ }
+
def __init__(self, browser):
gtk.Toolbar.__init__(self)
@@ -67,10 +81,23 @@ class WebToolbar(gtk.Toolbar):
self.insert(entry_item, -1)
entry_item.show()
- self._add_link = ToolButton('add-link')
- self._add_link.set_tooltip(_('Add Link'))
- self.insert(self._add_link, -1)
- self._add_link.show()
+ self._link_add = ToolButton('add-link')
+ self._link_add.set_tooltip(_('Add Link'))
+ self._link_add.connect('clicked', self._link_add_clicked_cb)
+ 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()
progress_listener = progresslistener.get_instance()
progress_listener.connect('location-changed', self._location_changed_cb)
@@ -189,3 +216,11 @@ class WebToolbar(gtk.Toolbar):
def _history_item_activated_cb(self, menu_item, index):
self._browser.web_navigation.gotoIndex(index)
+ 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')