Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerich koslovsky <erikos@localhost.localdomain>2007-08-19 19:04:45 (GMT)
committer erich koslovsky <erikos@localhost.localdomain>2007-08-19 19:04:45 (GMT)
commit5c57c205af2e2bc88269e1cb2f3b8b1a3f2f75f4 (patch)
treea7afbbe06c03f082b077eb17f7463c529b358ab0
parent5e718541ab535ff845977e4c594175bc27fd597e (diff)
Added button for adding a link.
Added the star icon as a button to add a link. Otherwise you can use ctrl-l to add a link and ctrl-r to remove the currently selected link.
-rw-r--r--icons/add-link.svg13
-rw-r--r--icons/buddy-link.svg (renamed from stock-buddy-link.svg)0
-rw-r--r--linkbutton.py2
-rwxr-xr-xwebactivity.py38
-rwxr-xr-xwebtoolbar.py5
5 files changed, 41 insertions, 17 deletions
diff --git a/icons/add-link.svg b/icons/add-link.svg
new file mode 100644
index 0000000..b84d3ef
--- /dev/null
+++ b/icons/add-link.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+ <!ENTITY stroke_color "#020202">
+ <!ENTITY fill_color "#B2B2B2">
+]>
+<svg version="1.1" id="Icon" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="28.479" height="27.086"
+ viewBox="0 0 28.479 27.086" overflow="visible" enable-background="new 0 0 28.479 27.086" xml:space="preserve">
+<polygon fill="&fill_color;" stroke="&stroke_color;" stroke-width="2.25" stroke-linecap="round" points="14.24,2.542 17.893,9.946
+ 26.062,11.132 20.151,16.894 21.546,25.03 14.24,21.188 6.933,25.03 8.329,16.894 2.417,11.132 10.586,9.946 "/>
+</svg>
diff --git a/stock-buddy-link.svg b/icons/buddy-link.svg
index 7e79838..7e79838 100644
--- a/stock-buddy-link.svg
+++ b/icons/buddy-link.svg
diff --git a/linkbutton.py b/linkbutton.py
index 84c0adb..1f5ac99 100644
--- a/linkbutton.py
+++ b/linkbutton.py
@@ -40,7 +40,7 @@ class LinkButton(gtk.RadioToolButton):
pixbuf = loader.get_pixbuf()
del loader
- xo_buddy = os.path.join(os.path.dirname(__file__), "stock-buddy-link.svg")
+ xo_buddy = os.path.join(os.path.dirname(__file__), "icons/buddy-link.svg")
pixbuf_xo = self._read_xo_icon(xo_buddy, fill, stroke)
width = pixbuf_xo.get_width()
diff --git a/webactivity.py b/webactivity.py
index c7a1457..5db55f3 100755
--- a/webactivity.py
+++ b/webactivity.py
@@ -75,9 +75,9 @@ class WebActivity(activity.Activity):
toolbox = activity.ActivityToolbox(self)
activity_toolbar = toolbox.get_activity_toolbar()
- toolbar = WebToolbar(self._browser)
- toolbox.add_toolbar(_('Browse'), toolbar)
- toolbar.show()
+ self.toolbar = WebToolbar(self._browser)
+ toolbox.add_toolbar(_('Browse'), self.toolbar)
+ self.toolbar.show()
self.set_toolbox(toolbox)
toolbox.show()
@@ -87,6 +87,7 @@ class WebActivity(activity.Activity):
self.linkbar.connect('link-rm', self._link_rm_cb)
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._add_link_button_cb)
self._browser.connect("notify::title", self._title_changed_cb)
self.model = Model(os.path.dirname(__file__))
@@ -303,21 +304,14 @@ class WebActivity(activity.Activity):
def _link_rm_cb(self, linkbar, index):
self.model.links[index]['deleted'] = 1
self.model.links[index]['thumb'] = ''
-
+
+ def _add_link_button_cb(self, button):
+ self._add_link()
+
def key_press_cb(self, widget, event):
if event.state & gtk.gdk.CONTROL_MASK:
if gtk.gdk.keyval_name(event.keyval) == "l":
- buffer = self._get_screenshot()
- _logger.debug('keyboard: Add link: %s.' % self.current)
- self.model.links.append( {'hash':sha.new(self.current).hexdigest(), 'url':self.current, 'title':self.webtitle,
- 'thumb':buffer, 'owner':self.owner.props.nick, 'color':self.owner.props.color, 'deleted':0} )
-
- self.linkbar._add_link(self.current, buffer, self.owner.props.color, self.webtitle, self.owner.props.nick,
- len(self.model.links)-1)
- if self.messenger is not None:
- import base64
- self.messenger._add_link(self.current, self.webtitle, self.owner.props.color,
- self.owner.props.nick, base64.b64encode(buffer))
+ self._add_link()
return True
elif gtk.gdk.keyval_name(event.keyval) == "r":
_logger.debug('keyboard: Remove link: %s.' % self.current)
@@ -327,7 +321,19 @@ class WebActivity(activity.Activity):
return True
return False
-
+ def _add_link(self):
+ buffer = self._get_screenshot()
+ _logger.debug('keyboard: Add link: %s.' % self.current)
+ self.model.links.append( {'hash':sha.new(self.current).hexdigest(), 'url':self.current, 'title':self.webtitle,
+ 'thumb':buffer, 'owner':self.owner.props.nick, 'color':self.owner.props.color, 'deleted':0} )
+
+ self.linkbar._add_link(self.current, buffer, self.owner.props.color, self.webtitle, self.owner.props.nick,
+ len(self.model.links)-1)
+ if self.messenger is not None:
+ import base64
+ self.messenger._add_link(self.current, self.webtitle, self.owner.props.color,
+ self.owner.props.nick, base64.b64encode(buffer))
+
def _pixbuf_save_cb(self, buf, data):
data[0] += buf
return True
diff --git a/webtoolbar.py b/webtoolbar.py
index a330d70..6735a9c 100755
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -67,6 +67,11 @@ 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()
+
progress_listener = progresslistener.get_instance()
progress_listener.connect('location-changed', self._location_changed_cb)
progress_listener.connect('loading-start', self._loading_start_cb)