Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPootle User <translate@rt.laptop.org>2007-11-26 19:38:50 (GMT)
committer Pootle User <translate@rt.laptop.org>2007-11-26 19:38:50 (GMT)
commit2067ddc6e6e98bb457373620385d3198afa2ecb9 (patch)
treec159bd64899905138f689246b25743ce8d4d0776
parent44f8412ce09c1e89233dc411355b170dc109b168 (diff)
parent0b320be7b017936ee48ce57917822dcbf6516e91 (diff)
Merge branch 'master' of git+ssh://dev.laptop.org/git/chat-activity
-rw-r--r--NEWS5
-rw-r--r--activity/activity.info2
-rw-r--r--chat.py22
3 files changed, 27 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 85a7a4d..607880c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,7 @@
-* Updated translations: fr, es, el, de, ar (pootle)
+29
+
+* #5080: add a "copy to clipboard" palette for URL's (cassidy)
+* Updated translations: fr, es, el, de, ar, zh_TW, it, nl, pt_BR (pootle)
28
diff --git a/activity/activity.info b/activity/activity.info
index 5655fce..963eda5 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,6 +1,6 @@
[Activity]
name = Chat
-activity_version = 28
+activity_version = 29
host_version = 1
icon = activity-chat
service_name = org.laptop.Chat
diff --git a/chat.py b/chat.py
index b9a3783..c560171 100644
--- a/chat.py
+++ b/chat.py
@@ -31,6 +31,8 @@ from sugar.graphics.style import (Color, COLOR_BLACK, COLOR_WHITE,
FONT_BOLD, FONT_NORMAL)
from sugar.graphics.roundbox import CanvasRoundBox
from sugar.graphics.xocolor import XoColor
+from sugar.graphics.palette import Palette, CanvasInvoker
+from sugar.graphics.menuitem import MenuItem
from sugar.presence import presenceservice
from telepathy.client import Connection, Channel
@@ -258,6 +260,10 @@ class Chat(Activity):
attrs.insert(pango.AttrUnderline(pango.UNDERLINE_SINGLE, 0, 32767))
message.set_property("attributes", attrs)
message.connect('activated', self._link_activated_cb)
+
+ palette = URLMenu(url)
+ palette.props.invoker = CanvasInvoker(message)
+
rb.append(message)
text = text[match.end():]
match = regexp.search(text)
@@ -417,3 +423,19 @@ class TextChannelWrapper(object):
return self._activity._pservice.get_buddy_by_telepathy_handle(
tp_name, tp_path, handle)
+
+class URLMenu(Palette):
+ def __init__(self, url):
+ Palette.__init__(self, url)
+
+ self.url = url
+
+ menu_item = MenuItem(_('Copy to Clipboard'), 'edit-copy')
+ menu_item.connect('activate', self._copy_to_clipboard_cb)
+ self.menu.append(menu_item)
+ menu_item.show()
+
+ def _copy_to_clipboard_cb(self, menuitem):
+ logger.debug('Copy %s to clipboard', self.url)
+ clipboard = gtk.clipboard_get()
+ clipboard.set_text(self.url)