diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2007-04-26 22:56:33 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2007-04-26 22:56:33 (GMT) |
commit | 3ede4103a308e2f4b771c4848529268831c6d215 (patch) | |
tree | d5092d1e30a6c37b587f245e96d698cd2ffb1265 /linksview.py | |
parent | 87ba9a09202590b53198d87d4fd49831a453736d (diff) |
Remove the not working links stuff.
More API fixes.
Diffstat (limited to 'linksview.py')
-rwxr-xr-x | linksview.py | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/linksview.py b/linksview.py deleted file mode 100755 index 1ad5584..0000000 --- a/linksview.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2006, Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -import os - -import hippo - -from sugar.activity import activity -from sugar.graphics.toolbar import Toolbar -from sugar.graphics.menu import Menu -from sugar.graphics.canvasicon import CanvasIcon -from sugar.graphics.popupcontext import PopupContext -from sugar.graphics.xocolor import XoColor - -class LinkIcon(CanvasIcon): - def __init__(self, link): - color = XoColor(link.buddy.get_color()) - - path = os.path.join(activity.get_bundle_path(), 'activity') - icon_name = os.path.join(path, 'activity-web.svg') - CanvasIcon.__init__(self, xo_color=color, icon_name=icon_name) - - self._link = link - - def get_popup(self): - menu = Menu(self._link.title) - return menu - -class LinksView(Toolbar): - def __init__(self, model, browser, **kwargs): - Toolbar.__init__(self, orientation=hippo.ORIENTATION_VERTICAL) - - self._icons = {} - self._browser = browser - - for link in model: - self._add_link(link) - - model.connect('link_added', self._link_added_cb) - model.connect('link_removed', self._link_removed_cb) - - def _add_link(self, link): - icon = LinkIcon(link) - icon.connect('activated', self._link_activated_cb, link) - self.append(icon) - - self._icons[link] = icon - - def _remove_link(self, link): - icon = self._icons[link] - self.remove(icon) - - del self._icons[link] - - def _link_added_cb(self, model, link): - self._add_link(link) - - def _link_removed_cb(self, model, link): - self._remove_link(link) - - def _link_activated_cb(self, link_item, link): - self._browser.load_url(link.url) - - def get_link_count(self): - return len(self._icons) |