[sugar/f21] Fix display of Help

Peter Robinson pbrobinson at fedoraproject.org
Tue Nov 25 12:39:25 UTC 2014


commit 96249fa10d9db7122542efc2fe502fc93967a70e
Author: Peter Robinson <pbrobinson at gmail.com>
Date:   Tue Nov 25 12:23:16 2014 +0000

    Fix display of Help

 410.patch  |   65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sugar.spec |    7 +++++-
 2 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/410.patch b/410.patch
new file mode 100644
index 0000000..b8911ed
--- /dev/null
+++ b/410.patch
@@ -0,0 +1,65 @@
+From 7622d799be7d82ff630a0353d72788cd870f9517 Mon Sep 17 00:00:00 2001
+From: Gonzalo Odiard <godiard at gmail.com>
+Date: Sat, 22 Nov 2014 02:33:08 -0300
+Subject: [PATCH] View Help: don't use symlinks for images directory
+
+We can't create syminks if the Help activity is installed
+in /usr. Instead rewrite the url at the client side.
+The symlink was used to not duplicate the images for every language.
+---
+ src/jarabe/view/viewhelp.py | 28 ++++++++++++++--------------
+ 1 file changed, 14 insertions(+), 14 deletions(-)
+
+diff --git a/src/jarabe/view/viewhelp.py b/src/jarabe/view/viewhelp.py
+index 057ae0c..fb3ab92 100644
+--- a/src/jarabe/view/viewhelp.py
++++ b/src/jarabe/view/viewhelp.py
+@@ -146,6 +146,8 @@ def __init__(self, title, help_file, window_xid):
+ 
+         webview = WebKit.WebView()
+         webview.set_full_content_zoom(True)
++        webview.connect("resource-request-starting",
++                        self._resource_request_starting_cb)
+ 
+         scrolled_window = Gtk.ScrolledWindow()
+         scrolled_window.add(webview)
+@@ -159,6 +161,18 @@ def __init__(self, title, help_file, window_xid):
+         view_file = self._get_help_file(language, help_file)
+         webview.load_uri('file://' + view_file)
+ 
++    def _resource_request_starting_cb(self, webview, web_frame, web_resource,
++                                      request, response):
++        uri = web_resource.get_uri()
++        if uri.find('_images') > -1:
++            if uri.find('/%s/_images/' % self._get_current_language()) > -1:
++                new_uri = uri.replace('/html/%s/_images/' %
++                                      self._get_current_language,
++                                      '/images/')
++            else:
++                new_uri = uri.replace('/html/_images/', '/images/')
++            request.set_uri(new_uri)
++
+     def __stop_clicked_cb(self, widget):
+         self.destroy()
+         shell.get_model().pop_modal()
+@@ -185,20 +199,6 @@ def _get_help_file(self, language, help_file):
+         if not os.path.isfile(path):
+             path = os.path.join(activity_path, 'html', help_file)
+ 
+-        # verify if the images and _static dir exists
+-        # Help have only one directory for images and static content,
+-        # and need links in other languages directories
+-        # the links are created by the Help activity or the viewer
+-        # in the first run.
+-        html_path = path[:path.rfind('/')]
+-        images_path = os.path.join(html_path, '_images')
+-        if not os.path.exists(images_path):
+-            os.symlink(os.path.join(activity_path, 'images'),
+-                       images_path)
+-        static_path = os.path.join(html_path, '_static')
+-        if not os.path.exists(static_path):
+-            os.symlink(os.path.join(activity_path, 'html', '_static'),
+-                       static_path)
+         return path
+ 
+ 
diff --git a/sugar.spec b/sugar.spec
index 8ad722a..1bad3f0 100644
--- a/sugar.spec
+++ b/sugar.spec
@@ -3,12 +3,13 @@
 Summary: Constructionist learning platform
 Name:    sugar
 Version: 0.102.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 URL:     http://sugarlabs.org/
 License: GPLv2+
 Group:   User Interface/Desktops
 Source0: http://download.sugarlabs.org/sources/sucrose/glucose/%{name}/%{name}-%{version}.tar.xz
 Patch0:  sugar-gnomekeyring.patch
+Patch1:  410.patch
 
 BuildRequires: dconf-devel
 BuildRequires: gettext
@@ -160,6 +161,7 @@ This is the Sugar Web Account control panel
 %prep
 %setup -q
 %patch0 -p1 -b .keyring
+%patch1 -p1 -b .help
 
 %build
 %configure
@@ -265,6 +267,9 @@ fi
 %{_datadir}/sugar/extensions/cpsection/webaccount
 
 %changelog
+* Tue Nov 25 2014 Peter Robinson <pbrobinson at fedoraproject.org> 0.102.0-5
+- Fix display of Help
+
 * Sat Sep 27 2014 Rex Dieter <rdieter at fedoraproject.org> 0.102.0-4
 - update/optimize mime scriptlet
 


More information about the scm-commits mailing list