Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-11-30 14:21:42 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-11-30 14:21:42 (GMT)
commit594613aa6b1f5aa2af8b48903779a41e12068c33 (patch)
tree09e3f03062b61846ad25c72a986b8a200df051cc
parent86770c93fd603e50b0748b74cd376f87eb3c4ebf (diff)
Remove the internal activities. They are now splitted to their own module.
-rw-r--r--Makefile.am2
-rw-r--r--activities/Makefile.am1
-rw-r--r--activities/chat/Makefile.am6
-rw-r--r--activities/chat/__init__.py0
-rw-r--r--activities/chat/chat.activity6
-rw-r--r--activities/chat/chatactivity.py49
-rw-r--r--activities/terminal/Makefile.am6
-rw-r--r--activities/terminal/TerminalActivity.py82
-rw-r--r--activities/terminal/__init__.py0
-rw-r--r--activities/terminal/terminal.activity5
-rw-r--r--activities/web/Makefile.am12
-rw-r--r--activities/web/__init__.py0
-rw-r--r--activities/web/linkscontroller.py60
-rw-r--r--activities/web/linksmodel.py51
-rw-r--r--activities/web/linksview.py83
-rw-r--r--activities/web/stylesheet.py27
-rw-r--r--activities/web/toolbar.py148
-rw-r--r--activities/web/web.activity6
-rw-r--r--activities/web/webactivity.py138
-rw-r--r--activities/web/webbrowser.py97
-rw-r--r--configure.ac4
21 files changed, 1 insertions, 782 deletions
diff --git a/Makefile.am b/Makefile.am
index adb34ab..4ef729a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = activities lib po shell sugar services tools
+SUBDIRS = lib po shell sugar services tools
ACLOCAL_AMFLAGS = -I m4
diff --git a/activities/Makefile.am b/activities/Makefile.am
deleted file mode 100644
index 037da37..0000000
--- a/activities/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = chat terminal web
diff --git a/activities/chat/Makefile.am b/activities/chat/Makefile.am
deleted file mode 100644
index 9030e74..0000000
--- a/activities/chat/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-sugardir = $(pkgdatadir)/activities/chat
-sugar_PYTHON = \
- __init__.py \
- chatactivity.py
-
-EXTRA_DIST = chat.activity
diff --git a/activities/chat/__init__.py b/activities/chat/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/activities/chat/__init__.py
+++ /dev/null
diff --git a/activities/chat/chat.activity b/activities/chat/chat.activity
deleted file mode 100644
index 0cbda51..0000000
--- a/activities/chat/chat.activity
+++ /dev/null
@@ -1,6 +0,0 @@
-[Activity]
-name = GroupChat
-icon = activity-chat
-id = org.laptop.ChatActivity
-python_module = chat.chatactivity.ChatActivity
-show_launcher = yes
diff --git a/activities/chat/chatactivity.py b/activities/chat/chatactivity.py
deleted file mode 100644
index 374351f..0000000
--- a/activities/chat/chatactivity.py
+++ /dev/null
@@ -1,49 +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
-
-from gettext import gettext as _
-
-from sugar.activity.Activity import Activity
-from sugar.chat.Chat import Chat
-from sugar.p2p.Stream import Stream
-
-class ChatActivity(Activity):
- def __init__(self):
- Activity.__init__(self)
-
- self._group_stream = None
-
- self.set_title(_('Group chat'))
-
- self._chat = Chat()
- self.add(self._chat)
- self._chat.show()
-
- def join(self, activity_ps):
- Activity.join(self, activity_ps)
- self._setup_stream()
-
- def share(self):
- Activity.share(self)
- self._setup_stream()
-
- def _setup_stream(self):
- self._group_stream = Stream.new_from_service(self._service)
- self._group_stream.set_data_listener(self._group_recv_message)
- self._chat.set_stream_writer(self._group_stream.new_writer())
-
- def _group_recv_message(self, address, msg):
- self._chat.recv_message(msg)
diff --git a/activities/terminal/Makefile.am b/activities/terminal/Makefile.am
deleted file mode 100644
index 03f3f61..0000000
--- a/activities/terminal/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-sugardir = $(pkgdatadir)/activities/terminal
-sugar_PYTHON = \
- __init__.py \
- TerminalActivity.py
-
-EXTRA_DIST = terminal.activity
diff --git a/activities/terminal/TerminalActivity.py b/activities/terminal/TerminalActivity.py
deleted file mode 100644
index 5826b16..0000000
--- a/activities/terminal/TerminalActivity.py
+++ /dev/null
@@ -1,82 +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 gtk
-import vte
-import pango
-
-from sugar.activity.Activity import Activity
-
-_TERMINAL_ACTIVITY_TYPE = "_terminal._tcp"
-
-class Terminal(gtk.HBox):
- def __init__(self):
- gtk.HBox.__init__(self, False, 4)
-
- self._vte = vte.Terminal()
- self._configure_vte()
- self._vte.set_size(30, 5)
- self._vte.set_size_request(200, 50)
- self._vte.show()
- self.pack_start(self._vte)
-
- self._scrollbar = gtk.VScrollbar(self._vte.get_adjustment())
- self._scrollbar.show()
- self.pack_start(self._scrollbar, False, False, 0)
-
- self._vte.connect("child-exited", lambda term: term.fork_command())
-
- self._vte.fork_command()
-
- def _configure_vte(self):
- self._vte.set_font(pango.FontDescription('Monospace 10'))
- self._vte.set_colors(gtk.gdk.color_parse ('#AAAAAA'),
- gtk.gdk.color_parse ('#000000'),
- [])
- self._vte.set_cursor_blinks(False)
- self._vte.set_audible_bell(False)
- self._vte.set_scrollback_lines(100)
- self._vte.set_allow_bold(True)
- self._vte.set_scroll_on_keystroke(False)
- self._vte.set_scroll_on_output(False)
- self._vte.set_emulation('xterm')
- self._vte.set_visible_bell(False)
-
- def on_gconf_notification(self, client, cnxn_id, entry, what):
- self.reconfigure_vte()
-
- def on_vte_button_press(self, term, event):
- if event.button == 3:
- self.do_popup(event)
- return True
-
- def on_vte_popup_menu(self, term):
- pass
-
- def grab_focus(self):
- self._vte.grab_focus()
-
-class TerminalActivity(Activity):
- def __init__(self):
- Activity.__init__(self)
-
- self.set_title("Terminal")
-
- terminal = Terminal()
- self.add(terminal)
- terminal.show()
-
- terminal.grab_focus()
diff --git a/activities/terminal/__init__.py b/activities/terminal/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/activities/terminal/__init__.py
+++ /dev/null
diff --git a/activities/terminal/terminal.activity b/activities/terminal/terminal.activity
deleted file mode 100644
index f0e89d4..0000000
--- a/activities/terminal/terminal.activity
+++ /dev/null
@@ -1,5 +0,0 @@
-[Activity]
-name = Terminal
-icon = activity-terminal
-id = org.sugar.Terminal
-python_module = terminal.TerminalActivity.TerminalActivity
diff --git a/activities/web/Makefile.am b/activities/web/Makefile.am
deleted file mode 100644
index 7992d57..0000000
--- a/activities/web/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-sugardir = $(pkgdatadir)/activities/web
-sugar_PYTHON = \
- __init__.py \
- linkscontroller.py \
- linksmodel.py \
- linksview.py \
- stylesheet.py \
- toolbar.py \
- webactivity.py \
- webbrowser.py
-
-EXTRA_DIST = web.activity
diff --git a/activities/web/__init__.py b/activities/web/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/activities/web/__init__.py
+++ /dev/null
diff --git a/activities/web/linkscontroller.py b/activities/web/linkscontroller.py
deleted file mode 100644
index bdc1296..0000000
--- a/activities/web/linkscontroller.py
+++ /dev/null
@@ -1,60 +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
-
-from sugar.p2p.Stream import Stream
-from sugar.presence import PresenceService
-
-class _Marshaller(object):
- def __init__(self, title, address):
- pservice = PresenceService.get_instance()
- name = pservice.get_owner().get_name()
- self._message = name + '\n' + title + '\n' + address
-
- def get_message(self):
- return self._message
-
-class _Demarshaller(object):
- def __init__(self, message):
- self._pservice = PresenceService.get_instance()
- self._split_msg = message.split('\n')
-
- def get_buddy(self):
- return self._pservice.get_buddy_by_name(self._split_msg[0])
-
- def get_title(self):
- return self._split_msg[1]
-
- def get_address(self):
- return self._split_msg[2]
-
-class LinksController(object):
- def __init__(self, service, model):
- self._model = model
-
- self._stream = Stream.new_from_service(service)
- self._stream.set_data_listener(self._recv_message)
- self._stream_writer = self._stream.new_writer()
-
- def post_link(self, title, address):
- marshaller = _Marshaller(title, address)
- self._stream_writer.write(marshaller.get_message())
-
- def _recv_message(self, address, msg):
- demarshaller = _Demarshaller(msg)
- buddy = demarshaller.get_buddy()
- if buddy:
- self._model.add_link(buddy, demarshaller.get_title(),
- demarshaller.get_address())
diff --git a/activities/web/linksmodel.py b/activities/web/linksmodel.py
deleted file mode 100644
index 4318bfc..0000000
--- a/activities/web/linksmodel.py
+++ /dev/null
@@ -1,51 +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 gobject
-
-class Link(object):
- def __init__(self, buddy, title, url):
- self.buddy = buddy
- self.title = title
- self.url = url
-
-class LinksModel(gobject.GObject):
- __gsignals__ = {
- 'link-added': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])),
- 'link-removed': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE, ([gobject.TYPE_PYOBJECT])),
- }
-
- def __init__(self):
- gobject.GObject.__init__(self)
- self._links = {}
-
- def add_link(self, buddy, title, url):
- link = Link(buddy, title, url)
- self._links[(buddy.get_name(), url)] = link
-
- self.emit('link-added', link)
-
- def remove_link(self, buddy, url):
- key = (buddy.get_name(), url)
- if self._links.haskey(key):
- link = self._links[key]
- del self._links[key]
- self.emit('link-removed', link)
-
- def __iter__(self):
- return self._links.values().__iter__()
diff --git a/activities/web/linksview.py b/activities/web/linksview.py
deleted file mode 100644
index 70af786..0000000
--- a/activities/web/linksview.py
+++ /dev/null
@@ -1,83 +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 gtk
-import hippo
-
-from sugar.graphics.menu import Menu
-from sugar.graphics.menushell import MenuShell
-from sugar.graphics.menuicon import MenuIcon
-from sugar.graphics.iconcolor import IconColor
-from sugar.graphics import style
-
-class LinkIcon(MenuIcon):
- def __init__(self, menu_shell, link):
- color = IconColor(link.buddy.get_color())
- MenuIcon.__init__(self, menu_shell, color=color,
- icon_name='activity-web')
-
- self._link = link
-
- def create_menu(self):
- menu = Menu(self._link.title)
- return menu
-
-class LinksView(hippo.Canvas):
- def __init__(self, model, browser):
- hippo.Canvas.__init__(self)
-
- self._icons = {}
- self._browser = browser
- self._menu_shell = MenuShell(self)
-
- self._box = hippo.CanvasBox()
- style.apply_stylesheet(self._box, 'links.Box')
- self.set_root(self._box)
-
- 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):
- if len(self._icons) == 0:
- self.show()
-
- icon = LinkIcon(self._menu_shell, link)
- icon.connect('activated', self._link_activated_cb, link)
- style.apply_stylesheet(icon, 'links.Icon')
- self._box.append(icon)
-
- self._icons[link] = icon
-
- def _remove_link(self, link):
- icon = self._icons[link]
- self._box.remove(icon)
-
- del self._icons[link]
-
- if len(self._icons) == 0:
- self.hide()
-
- 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)
diff --git a/activities/web/stylesheet.py b/activities/web/stylesheet.py
deleted file mode 100644
index 3628818..0000000
--- a/activities/web/stylesheet.py
+++ /dev/null
@@ -1,27 +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 gtk
-
-from sugar.graphics import style
-
-links_Icon = {
- 'size' : style.standard_icon_size
-}
-
-links_Box = {
- 'background_color' : 0x414141ff,
-}
diff --git a/activities/web/toolbar.py b/activities/web/toolbar.py
deleted file mode 100644
index a516d9f..0000000
--- a/activities/web/toolbar.py
+++ /dev/null
@@ -1,148 +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 gtk
-
-from _sugar import AddressEntry
-
-class Toolbar(gtk.Toolbar):
- def __init__(self, embed):
- gtk.Toolbar.__init__(self)
-
- self.set_style(gtk.TOOLBAR_BOTH_HORIZ)
-
- self._insert_spring()
-
- self._back = gtk.ToolButton()
- self._back.props.sensitive = False
- self._back.set_icon_name('stock-back')
- self._back.connect("clicked", self._go_back_cb)
- self.insert(self._back, -1)
- self._back.show()
-
- self._forward = gtk.ToolButton()
- self._forward.props.sensitive = False
- self._forward.set_icon_name('stock-forward')
- self._forward.connect("clicked", self._go_forward_cb)
- self.insert(self._forward, -1)
- self._forward.show()
-
- self._stop_and_reload = gtk.ToolButton()
- self._forward.props.sensitive = False
- self._stop_and_reload.connect("clicked", self._stop_and_reload_cb)
- self.insert(self._stop_and_reload, -1)
- self._stop_and_reload.show()
-
- separator = gtk.SeparatorToolItem()
- separator.set_draw(False)
- self.insert(separator, -1)
- separator.show()
-
- address_item = gtk.ToolItem()
-
- self._entry = AddressEntry()
- self._entry.connect("activate", self._entry_activate_cb)
-
- width = int(gtk.gdk.screen_width() / 1.8)
- self._entry.set_size_request(width, -1)
-
- address_item.add(self._entry)
- self._entry.show()
-
- self.insert(address_item, -1)
- address_item.show()
-
- separator = gtk.SeparatorToolItem()
- separator.set_draw(False)
- self.insert(separator, -1)
- separator.show()
-
- self._post = gtk.ToolButton()
- self._post.props.sensitive = False
- self._post.set_icon_name('stock-add')
- self._post.connect("clicked", self._post_cb)
- self.insert(self._post, -1)
- self._post.show()
-
- self._insert_spring()
-
- self._embed = embed
- self._embed.connect("notify::progress", self._progress_changed_cb)
- self._embed.connect("notify::loading", self._loading_changed_cb)
- self._embed.connect("notify::address", self._address_changed_cb)
- self._embed.connect("notify::title", self._title_changed_cb)
- self._embed.connect("notify::can-go-back",
- self._can_go_back_changed_cb)
- self._embed.connect("notify::can-go-forward",
- self._can_go_forward_changed_cb)
-
- self._update_stop_and_reload_icon()
-
- def set_links_controller(self, links_controller):
- self._links_controller = links_controller
- self._post.props.sensitive = True
-
- def _update_stop_and_reload_icon(self):
- if self._embed.props.loading:
- self._stop_and_reload.set_icon_name('stock-close')
- else:
- self._stop_and_reload.set_icon_name('stock-continue')
-
- def _progress_changed_cb(self, embed, spec):
- self._entry.props.progress = embed.props.progress
-
- def _loading_changed_cb(self, embed, spec):
- self._update_stop_and_reload_icon()
-
- def _address_changed_cb(self, embed, spec):
- self._entry.props.address = embed.props.address
-
- def _title_changed_cb(self, embed, spec):
- self._entry.props.title = embed.props.title
-
- def _can_go_back_changed_cb(self, embed, spec):
- self._back.props.sensitive = embed.props.can_go_back
-
- def _can_go_forward_changed_cb(self, embed, spec):
- self._forward.props.sensitive = embed.props.can_go_forward
-
- def _entry_activate_cb(self, entry):
- self._embed.load_url(entry.get_text())
- self._embed.grab_focus()
-
- def _go_back_cb(self, button):
- self._embed.go_back()
-
- def _go_forward_cb(self, button):
- self._embed.go_forward()
-
- def _stop_and_reload_cb(self, button):
- if self._embed.props.loading:
- self._embed.stop_load()
- else:
- self._embed.reload(0)
-
- def _post_cb(self, button):
- title = self._embed.get_title()
- address = self._embed.get_location()
- self._links_controller.post_link(title, address)
-
- def _insert_spring(self):
- separator = gtk.SeparatorToolItem()
- separator.set_draw(False)
- separator.set_expand(True)
- self.insert(separator, -1)
- separator.show()
diff --git a/activities/web/web.activity b/activities/web/web.activity
deleted file mode 100644
index 09b3841..0000000
--- a/activities/web/web.activity
+++ /dev/null
@@ -1,6 +0,0 @@
-[Activity]
-name = Web
-id = org.laptop.WebActivity
-icon = activity-web
-python_module = web.webactivity.WebActivity
-show_launcher = yes
diff --git a/activities/web/webactivity.py b/activities/web/webactivity.py
deleted file mode 100644
index 14a763d..0000000
--- a/activities/web/webactivity.py
+++ /dev/null
@@ -1,138 +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
-
-from gettext import gettext as _
-import gtk
-import gtkmozembed
-import logging
-import dbus
-
-import _sugar
-from sugar.activity import ActivityFactory
-from sugar.activity.Activity import Activity
-from sugar.clipboard import ClipboardService
-from sugar import env
-from sugar.graphics import style
-import web.stylesheet
-from webbrowser import WebBrowser
-from toolbar import Toolbar
-from linksmodel import LinksModel
-from linksview import LinksView
-from linkscontroller import LinksController
-
-_HOMEPAGE = 'http://www.google.com'
-
-class WebActivity(Activity):
- def __init__(self, browser=None):
- Activity.__init__(self)
-
- logging.debug('Starting the web activity')
-
- self.set_title(_('Web Activity'))
-
- vbox = gtk.VBox()
-
- if browser:
- self._browser = browser
- else:
- self._browser = WebBrowser()
- self._browser.connect('notify::title', self._title_changed_cb)
-
- self._links_model = LinksModel()
- links_view = LinksView(self._links_model, self._browser)
-
- self._toolbar = Toolbar(self._browser)
- vbox.pack_start(self._toolbar, False)
- self._toolbar.show()
-
- hbox = gtk.HBox()
-
- hbox.pack_start(links_view, False)
- hbox.pack_start(self._browser)
- self._browser.show()
-
- vbox.pack_start(hbox)
- hbox.show()
-
- self.add(vbox)
- vbox.show()
-
- self._browser.load_url(_HOMEPAGE)
-
- def _setup_links_controller(self):
- links_controller = LinksController(self._service, self._links_model)
- self._toolbar.set_links_controller(links_controller)
-
- def join(self, activity_ps):
- Activity.join(self, activity_ps)
-
- self._setup_links_controller()
-
- url = self._service.get_published_value('URL')
- if url:
- self._browser.load_url(url)
-
- def share(self):
- Activity.share(self)
-
- self._setup_links_controller()
-
- url = self._browser.get_location()
- if url:
- self._service.set_published_value('URL', url)
-
- def _title_changed_cb(self, embed, pspec):
- self.set_title(embed.props.title)
-
-def start():
- gtkmozembed.set_profile_path(env.get_profile_path(), 'gecko')
-
- gtkmozembed.push_startup()
- if not _sugar.startup_browser():
- raise "Error when initializising the web activity."
-
- style.load_stylesheet(web.stylesheet)
-
- download_manager = _sugar.get_download_manager()
- download_manager.connect('download-started', download_started_cb)
- download_manager.connect('download-completed', download_completed_cb)
- download_manager.connect('download-cancelled', download_started_cb)
- download_manager.connect('download-progress', download_progress_cb)
-
-def stop():
- gtkmozembed.pop_startup()
-
-def download_started_cb(download_manager, download):
- name = download.get_url().rsplit('/', 1)[1]
-
- cbService = ClipboardService.get_instance()
- cbService.add_object(name,
- download.get_mime_type(),
- download.get_file_name())
-
-def download_completed_cb(download_manager, download):
- cbService = ClipboardService.get_instance()
- cbService.set_object_state(download.get_file_name(), 100)
-
-def download_cancelled_cb(download_manager, download):
- #FIXME: Needs to update the state of the object to 'download stopped'.
- #FIXME: Will do it when we complete progress on the definition of the
- #FIXME: clipboard API.
- raise "Cancelling downloads still not implemented."
-
-def download_progress_cb(download_manager, download):
- cbService = ClipboardService.get_instance()
- cbService.set_object_state(download.get_file_name(), download.get_percent())
diff --git a/activities/web/webbrowser.py b/activities/web/webbrowser.py
deleted file mode 100644
index 771bbda..0000000
--- a/activities/web/webbrowser.py
+++ /dev/null
@@ -1,97 +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 gobject
-import gtk
-import logging
-
-from _sugar import Browser
-from _sugar import PushScroller
-
-class _PopupCreator(gobject.GObject):
- __gsignals__ = {
- 'popup-created': (gobject.SIGNAL_RUN_FIRST,
- gobject.TYPE_NONE, ([])),
- }
-
- def __init__(self, parent_window):
- gobject.GObject.__init__(self)
-
- logging.debug('Creating the popup widget')
-
- self._sized_popup = False
- self._parent_window = parent_window
-
- self._dialog = gtk.Window()
- self._dialog.set_resizable(True)
-
- self._dialog.realize()
- self._dialog.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG)
-
- self._embed = Browser()
- self._size_to_sid = self._embed.connect('size_to', self._size_to_cb)
- self._vis_sid = self._embed.connect('visibility', self._visibility_cb)
-
- self._dialog.add(self._embed)
-
- def _size_to_cb(self, embed, width, height):
- logging.debug('Resize the popup to %d %d' % (width, height))
- self._sized_popup = True
- self._dialog.resize(width, height)
-
- def _visibility_cb(self, embed, visible):
- if visible:
- if self._sized_popup:
- logging.debug('Show the popup')
- self._embed.show()
- self._dialog.set_transient_for(self._parent_window)
- self._dialog.show()
- else:
- logging.debug('Open a new activity for the popup')
- self._dialog.remove(self._embed)
-
- # FIXME We need a better way to handle this.
- # It seem like a pretty special case though, I doubt
- # other activities will need something similar.
- from web.webactivity import WebActivity
- activity = WebActivity(self._embed)
- activity.set_type('org.laptop.WebActivity')
-
- self._embed.disconnect(self._size_to_sid)
- self._embed.disconnect(self._vis_sid)
-
- self.emit('popup-created')
-
- def get_embed(self):
- return self._embed
-
-class WebBrowser(Browser):
- __gtype_name__ = "SugarWebBrowser"
-
- def __init__(self):
- Browser.__init__(self)
- self._popup_creators = []
-
- def do_create_window(self):
- popup_creator = _PopupCreator(self.get_toplevel())
- popup_creator.connect('popup-created', self._popup_created_cb)
-
- self._popup_creators.append(popup_creator)
-
- return popup_creator.get_embed()
-
- def _popup_created_cb(self, creator):
- self._popup_creators.remove(creator)
diff --git a/configure.ac b/configure.ac
index 6175204..efca19c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,10 +51,6 @@ AM_GLIB_GNU_GETTEXT
AC_OUTPUT([
Makefile
dbus-installed.conf
-activities/Makefile
-activities/web/Makefile
-activities/chat/Makefile
-activities/terminal/Makefile
lib/Makefile
lib/data/Makefile
lib/src/Makefile