From 4edb6562ce163cb316aef97ec1deab9bc5566789 Mon Sep 17 00:00:00 2001 From: Morgan Collett Date: Tue, 04 Dec 2007 09:39:54 +0000 Subject: #5080: Remove activityfactory and clicking on the link, remove unnecessary clipboard targets --- diff --git a/chat.py b/chat.py index 9a1cbdc..57d560a 100644 --- a/chat.py +++ b/chat.py @@ -25,7 +25,6 @@ from datetime import datetime from sugar import profile from sugar.activity.activity import Activity, ActivityToolbox -from sugar.activity import activityfactory from sugar.graphics.alert import NotifyAlert from sugar.graphics.style import (Color, COLOR_BLACK, COLOR_WHITE, FONT_BOLD, FONT_NORMAL) @@ -207,10 +206,6 @@ class Chat(Activity): elif adj.get_value() == adj.upper-adj.page_size: self._scroll_auto = True - def _link_activated_cb(self, link): - activityfactory.create_with_uri( - 'org.laptop.WebActivity', link.props.text) - def add_text(self, buddy, text, status_message=False): """Display text on screen, with name and colors. @@ -276,7 +271,6 @@ class Chat(Activity): attrs = pango.AttrList() 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) @@ -462,10 +456,7 @@ class URLMenu(Palette): def _copy_to_clipboard_cb(self, menuitem): logger.debug('Copy %s to clipboard', self.url) clipboard = gtk.clipboard_get() - targets = [ ("text/uri-list", 0, 0), - ("text/x-moz-url", 0, 1), - ("COMPOUND_TEXT", 0, 2), - ("UTF8_STRING", 0, 3) ] + targets = [("text/uri-list", 0, 0)] if not clipboard.set_with_data(targets, self._clipboard_data_get_cb, @@ -476,11 +467,13 @@ class URLMenu(Palette): self.owns_clipboard = True def _clipboard_data_get_cb(self, clipboard, selection, info, data): - logger.debug('clipboard_data_get_cb data=%s target=%s', data, selection.target) - if selection.target in ['text/uri-list', 'text/x-moz-url']: + logger.debug('_clipboard_data_get_cb data=%s target=%s', data, + selection.target) + if selection.target in ['text/uri-list']: if not selection.set_uris([data]): logger.debug('failed to set_uris') else: + logger.debug('not uri') if not selection.set_text(data): logger.debug('failed to set_text') -- cgit v0.9.1