diff options
author | Ajay Garg <ajay@activitycentral.com> | 2013-02-28 03:53:32 (GMT) |
---|---|---|
committer | Ajay Garg <ajay@activitycentral.com> | 2013-02-28 03:53:32 (GMT) |
commit | 052d297dab1ead08e4a8900eeef85faef09ec738 (patch) | |
tree | 22223f6048bef9f94580814edd5c67e70f1e0634 |
4 files changed, 367 insertions, 0 deletions
diff --git a/do_it_all.sh b/do_it_all.sh new file mode 100644 index 0000000..fc28279 --- /dev/null +++ b/do_it_all.sh @@ -0,0 +1,23 @@ +set -e + +git_url="git://git.sugarlabs.org/browse/mainline.git" + + +# Remove the upstream cloned-directory, if any. +if [ -d "activity" ]; then + sudo rm -r activity +fi + +# Clone a fresh copy of the upstream. +git clone "$git_url" activity + +# Build the activity (to generate "generated" files such as locale files). +cd activity +python setup.py build + +# Now, apply the AC patches. +git am ../patches/*.patch + +# Finally, build the bundle (to be retrieved from "activity/dist"). +python setup.py dist_xo + diff --git a/patches/0001-sdxo-2572-Add-Load_URI-signal-handler-in-Browse-acti.patch b/patches/0001-sdxo-2572-Add-Load_URI-signal-handler-in-Browse-acti.patch new file mode 100644 index 0000000..e6071be --- /dev/null +++ b/patches/0001-sdxo-2572-Add-Load_URI-signal-handler-in-Browse-acti.patch @@ -0,0 +1,56 @@ +From d2396eb700bc1714b26dbd0d6370688c9ceddbe9 Mon Sep 17 00:00:00 2001 +From: Ajay Garg <ajay@activitycentral.com> +Date: Wed, 27 Feb 2013 22:10:28 +0530 +Subject: [PATCH 1/2] sdxo#2572: Add "Load_URI" signal-handler in "Browse" + activity. When this signal is received (with the "uri" + as the argument), this "uri" is reloaded in the + "Browse" instance. +Organization: Sugar Labs Foundation + + +Signed-off-by: Ajay Garg <ajay@activitycentral.com> +--- + activity/activity.info | 2 +- + webactivity.py | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/activity/activity.info b/activity/activity.info +index 1216320..bc6b12c 100644 +--- a/activity/activity.info ++++ b/activity/activity.info +@@ -1,6 +1,6 @@ + [Activity] + name = Browse +-activity_version = 150 ++activity_version = 150.1 + bundle_id = org.laptop.WebActivity + icon = activity-web + exec = sugar-activity webactivity.WebActivity -s +diff --git a/webactivity.py b/webactivity.py +index ecf84b6..b9dc2f8 100644 +--- a/webactivity.py ++++ b/webactivity.py +@@ -20,6 +20,7 @@ import logging + from gettext import gettext as _ + from gettext import ngettext + import os ++import dbus + + from gi.repository import GObject + GObject.threads_init() +@@ -247,6 +248,12 @@ class WebActivity(activity.Activity): + # http://bugs.sugarlabs.org/ticket/3973 + self._cleanup_temp_files() + ++ dbus.SessionBus().add_signal_receiver(self._load_uri, 'Load_URI', ++ IFACE) ++ ++ def _load_uri(self, uri): ++ self._link_clicked_cb(None, uri) ++ + def _cleanup_temp_files(self): + """Removes temporary files generated by Download Manager that + were cancelled by the user or failed for any reason. +-- +1.7.11.7 + diff --git a/patches/0002-sdxo-2769-Add-capability-to-set-custom-homepage.patch b/patches/0002-sdxo-2769-Add-capability-to-set-custom-homepage.patch new file mode 100644 index 0000000..6e47c53 --- /dev/null +++ b/patches/0002-sdxo-2769-Add-capability-to-set-custom-homepage.patch @@ -0,0 +1,257 @@ +From 89fedf362eb1afe39bfed8c2857938a8629aadb3 Mon Sep 17 00:00:00 2001 +From: Ajay Garg <ajay@activitycentral.com> +Date: Wed, 27 Feb 2013 22:27:44 +0530 +Subject: [PATCH 2/2] sdxo#2769 :Add capability to set custom homepage. +Organization: Sugar Labs Foundation + + +Signed-off-by: Ajay Garg <ajay@activitycentral.com> +--- + activity/activity.info | 2 +- + browser.py | 26 ++++++++++++++++++++++- + hometoolbar.py | 45 ++++++++++++++++++++++++++++++++++++++++ + icons/browse-change-homepage.svg | 11 ++++++++++ + icons/browse-go-homepage.svg | 11 ++++++++++ + webactivity.py | 12 +++++++++-- + webtoolbar.py | 13 ------------ + 7 files changed, 103 insertions(+), 17 deletions(-) + create mode 100644 hometoolbar.py + create mode 100644 icons/browse-change-homepage.svg + create mode 100644 icons/browse-go-homepage.svg + +diff --git a/activity/activity.info b/activity/activity.info +index bc6b12c..53f1bd7 100644 +--- a/activity/activity.info ++++ b/activity/activity.info +@@ -1,6 +1,6 @@ + [Activity] + name = Browse +-activity_version = 150.1 ++activity_version = 150.2 + bundle_id = org.laptop.WebActivity + icon = activity-web + exec = sugar-activity webactivity.WebActivity -s +diff --git a/browser.py b/browser.py +index 545bf3b..581b751 100644 +--- a/browser.py ++++ b/browser.py +@@ -345,14 +345,38 @@ class TabbedView(BrowserNotebook): + def load_homepage(self): + browser = self.current_browser + +- if os.path.isfile(_LIBRARY_PATH): ++ if os.path.isfile(activity.get_bundle_path() + "/data/homepage.conf"): ++ confFile = os.path.join(activity.get_bundle_path(),"data/homepage.conf") ++ f = open(confFile,"r") ++ contents = f.read().strip() ++ f.close() ++ ++ if contents != "": ++ default_page = contents ++ else: ++ default_page = os.path.join(activity.get_bundle_path(),"data/index.html") ++ ++ browser.load_uri(default_page) ++ elif os.path.isfile(_LIBRARY_PATH): + browser.load_uri('file://' + _LIBRARY_PATH) + else: + default_page = os.path.join(activity.get_bundle_path(), + "data/index.html") + browser.load_uri('file://' + default_page) ++ + browser.grab_focus() + ++ def change_homepage(self): ++ """ Change data/homepage.conf with current URL ++ """ ++ confFile = os.path.join(activity.get_bundle_path(),"data/homepage.conf") ++ index = self.get_current_page() ++ ui_uri = self.get_nth_page(index).browser.get_uri() ++ ++ f = open ( confFile,"w") ++ f.write(ui_uri) ++ f.close() ++ + def _get_current_browser(self): + if self.get_n_pages(): + return self.get_nth_page(self.get_current_page()).browser +diff --git a/hometoolbar.py b/hometoolbar.py +new file mode 100644 +index 0000000..3d5e6a6 +--- /dev/null ++++ b/hometoolbar.py +@@ -0,0 +1,45 @@ ++# Copyright (C) 2007, One Laptop Per Child ++# Copyright (C) 2012, Ariel Calzada ++# ++# 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 gi.repository import Gtk ++from sugar3.graphics.toolbutton import ToolButton ++ ++class HomeToolbar(Gtk.Toolbar): ++ def __init__(self, activity): ++ Gtk.Toolbar.__init__(self) ++ ++ self._activity = activity ++ ++ self.gohome = ToolButton('browse-go-homepage') ++ self.gohome.set_tooltip(_('Go to home page')) ++ self.gohome.connect('clicked', self.__gohome_clicked_cb) ++ self.insert(self.gohome, -1) ++ self.gohome.show() ++ ++ self.changehome = ToolButton('browse-change-homepage') ++ self.changehome.set_tooltip(_('Set current page as home page')) ++ self.changehome.connect('clicked', self.__changehome_clicked_cb) ++ self.insert(self.changehome, -1) ++ self.changehome.show() ++ ++ def __changehome_clicked_cb(self, button): ++ self._activity._change_home_button_cb(button) ++ ++ def __gohome_clicked_cb(self, button): ++ self._activity._go_home_button_cb(button) ++ +diff --git a/icons/browse-change-homepage.svg b/icons/browse-change-homepage.svg +new file mode 100644 +index 0000000..c79c6d9 +--- /dev/null ++++ b/icons/browse-change-homepage.svg +@@ -0,0 +1,11 @@ ++<?xml version="1.0" encoding="UTF-8"?> ++<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ ++ <!ENTITY fill_color "#FF0000"> ++ <!ENTITY stroke_color "#010101"> ++]> ++<svg xmlns="http://www.w3.org/2000/svg" width="55" height="55"> ++ <g id="go-home"> ++ <path d="M 27.5 15.96256 L 8.48131 32.4005 L 8.55256 48.0374 L 17 48.0052 L 17 30.9243 L 26 30.9243 L 26 48.0052 L 47.59 48.0052 L 47.4221 32.2792 Z M 31.5 30.9243 l 8 0 l 0 8 l -8 0 Z" stroke="none" fill="&fill_color;" stroke-linecap="round" stroke-width="3.5" /> ++ <path d="M 5.48131 27.4005 L 27.5 8.96256 L 38.8997 18.0775 L 38.8637 9.26122 L 42.8936 9.27163 L 42.8832 21.3246 L 50.4221 27.2792" stroke="&fill_color;" fill="none" stroke-linecap="round" stroke-width="4.5" /> ++ </g> ++</svg> +diff --git a/icons/browse-go-homepage.svg b/icons/browse-go-homepage.svg +new file mode 100644 +index 0000000..a4fd762 +--- /dev/null ++++ b/icons/browse-go-homepage.svg +@@ -0,0 +1,11 @@ ++<?xml version="1.0" encoding="UTF-8"?> ++<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ ++ <!ENTITY fill_color "#00cb00"> ++ <!ENTITY stroke_color "#010101"> ++]> ++<svg xmlns="http://www.w3.org/2000/svg" width="55" height="55"> ++ <g id="go-home"> ++ <path d="M 27.5 15.96256 L 8.48131 32.4005 L 8.55256 48.0374 L 17 48.0052 L 17 30.9243 L 26 30.9243 L 26 48.0052 L 47.59 48.0052 L 47.4221 32.2792 Z M 31.5 30.9243 l 8 0 l 0 8 l -8 0 Z" stroke="none" fill="&fill_color;" stroke-linecap="round" stroke-width="3.5" /> ++ <path d="M 5.48131 27.4005 L 27.5 8.96256 L 38.8997 18.0775 L 38.8637 9.26122 L 42.8936 9.27163 L 42.8832 21.3246 L 50.4221 27.2792" stroke="&fill_color;" fill="none" stroke-linecap="round" stroke-width="4.5" /> ++ </g> ++</svg> +diff --git a/webactivity.py b/webactivity.py +index b9dc2f8..598586b 100644 +--- a/webactivity.py ++++ b/webactivity.py +@@ -133,6 +133,7 @@ from browser import ZOOM_ORIGINAL + from webtoolbar import PrimaryToolbar + from edittoolbar import EditToolbar + from viewtoolbar import ViewToolbar ++from hometoolbar import HomeToolbar + import downloadmanager + + # TODO: make the registration clearer SL #3087 +@@ -183,11 +184,10 @@ class WebActivity(activity.Activity): + self._primary_toolbar = PrimaryToolbar(self._tabbed_view, self) + self._edit_toolbar = EditToolbar(self) + self._view_toolbar = ViewToolbar(self) ++ self._home_toolbar = HomeToolbar(self) + + self._primary_toolbar.connect('add-link', self._link_add_button_cb) + +- self._primary_toolbar.connect('go-home', self._go_home_button_cb) +- + self._edit_toolbar_button = ToolbarButton( + page=self._edit_toolbar, + icon_name='toolbar-edit') +@@ -200,6 +200,11 @@ class WebActivity(activity.Activity): + icon_name='toolbar-view') + self._primary_toolbar.toolbar.insert( + view_toolbar_button, 2) ++ home_toolbar_button = ToolbarButton( ++ page=self._home_toolbar, ++ icon_name='go-home') ++ self._primary_toolbar.toolbar.insert( ++ home_toolbar_button, 3) + + self._primary_toolbar.show_all() + self.set_toolbar_box(self._primary_toolbar) +@@ -482,6 +487,9 @@ class WebActivity(activity.Activity): + def _go_home_button_cb(self, button): + self._tabbed_view.load_homepage() + ++ def _change_home_button_cb(self, button): ++ self._tabbed_view.change_homepage() ++ + def _key_press_cb(self, widget, event): + key_name = Gdk.keyval_name(event.keyval) + browser = self._tabbed_view.props.current_browser +diff --git a/webtoolbar.py b/webtoolbar.py +index 6b95a8d..efea313 100644 +--- a/webtoolbar.py ++++ b/webtoolbar.py +@@ -252,9 +252,6 @@ class PrimaryToolbar(ToolbarBase): + 'add-link': (GObject.SignalFlags.RUN_FIRST, + None, + ([])), +- 'go-home': (GObject.SignalFlags.RUN_FIRST, +- None, +- ([])), + } + + def __init__(self, tabbed_view, act): +@@ -270,12 +267,6 @@ class PrimaryToolbar(ToolbarBase): + activity_button = ActivityToolbarButton(self._activity) + toolbar.insert(activity_button, 0) + +- self._go_home = ToolButton('go-home') +- self._go_home.set_tooltip(_('Home page')) +- self._go_home.connect('clicked', self._go_home_cb) +- toolbar.insert(self._go_home, -1) +- self._go_home.show() +- + self.entry = WebEntry() + self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY, + 'entry-stop') +@@ -472,7 +463,6 @@ class PrimaryToolbar(ToolbarBase): + + is_webkit_browser = isinstance(self._browser, Browser) + self._link_add.props.sensitive = is_webkit_browser +- self._go_home.props.sensitive = is_webkit_browser + if is_webkit_browser: + self._reload_session_history() + +@@ -484,9 +474,6 @@ class PrimaryToolbar(ToolbarBase): + self.entry.props.address = effective_url + self._browser.grab_focus() + +- def _go_home_cb(self, button): +- self.emit('go-home') +- + def _go_back_cb(self, button): + self._browser.go_back() + +-- +1.7.11.7 + diff --git a/patches/0003-sdxo-3008-Add-ability-to-play-swf-files-in-Browse.patch b/patches/0003-sdxo-3008-Add-ability-to-play-swf-files-in-Browse.patch new file mode 100644 index 0000000..f38e358 --- /dev/null +++ b/patches/0003-sdxo-3008-Add-ability-to-play-swf-files-in-Browse.patch @@ -0,0 +1,31 @@ +From 480a150db084354a6fd4a7a50da91618756ff679 Mon Sep 17 00:00:00 2001 +From: Ajay Garg <ajay@activitycentral.com> +Date: Thu, 28 Feb 2013 00:51:11 +0530 +Subject: [PATCH] sdxo#3008: Add ability to play "swf" files in "Browse". +Organization: Sugar Labs Foundation + + +Signed-off-by: Ajay Garg <ajay@activitycentral.com> +--- + activity/activity.info | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/activity/activity.info b/activity/activity.info +index 53f1bd7..a66312d 100644 +--- a/activity/activity.info ++++ b/activity/activity.info +@@ -1,9 +1,9 @@ + [Activity] + name = Browse +-activity_version = 150.2 ++activity_version = 150.3 + bundle_id = org.laptop.WebActivity + icon = activity-web + exec = sugar-activity webactivity.WebActivity -s +-mime_types = image/png;image/gif;image/jpeg;text/html;text/uri-list;application/xhtml+xml;application/rss+xml;application/xml;text/css;application/ogg;audio/x-wav;audio/ogg;video/ogg;audio/x-vorbis+ogg;audio/x-flac+ogg;audio/x-speex+ogg;video/x-theora+ogg;video/x-ogm+ogg;image/svg+xml ++mime_types = image/png;image/gif;image/jpeg;text/html;text/uri-list;application/xhtml+xml;application/rss+xml;application/xml;text/css;application/ogg;audio/x-wav;audio/ogg;video/ogg;audio/x-vorbis+ogg;audio/x-flac+ogg;audio/x-speex+ogg;video/x-theora+ogg;video/x-ogm+ogg;image/svg+xml;application/x-shockwave-flash + license = GPLv2+ + summary = Surf the world! Here you can do research, watch educational videos, take online courses, find books, connect with friends and more. +-- +1.7.11.7 + |