[Sugar-devel] [PATCH browse] Append the current Sugar (Sucrose) version to the user agent

Gonzalo Odiard gonzalo at laptop.org
Mon Jan 16 08:48:21 EST 2012


Why not add the the sugar version in the toolkit?
Probably would be useful for other activities too,
and is a good time to add it.
May be you can add it to the gtk3 toolkit
then the ported activities can use it.

Gonzalo

On Mon, Jan 16, 2012 at 8:52 AM, Simon Schampijer <simon at schampijer.de>wrote:

> This identifier is used in ASLO to determine which activities
> can be downloaded (ASLO is parsing the user agent of the Browser
> to provide an appropriate activity version, if it fails to get
> the Sugar version from the agent string, it uses the last stable version,
> which is 0.94 at the moment).
>
> One thing that is not perfectly handled by this patch is that we
> need to modify the user agent for every WebView (see [1]).
>
> Furthermore we need to modify the Sugar version in Browse accordingly
> with each Sugar release as the Sugar version is only availble in the
> shell and not in the toolkit.
>
> [1] https://lists.webkit.org/pipermail/webkit-gtk/2012-January/000893.html
>
> Signed-off-by: Simon Schampijer <simon at laptop.org>
> ---
>  browser.py |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/browser.py b/browser.py
> index 83cc7ea..c5165db 100644
> --- a/browser.py
> +++ b/browser.py
> @@ -383,9 +383,16 @@ class Browser(WebKit.WebView):
>                     ([str])),
>     }
>
> +    CURRENT_SUGAR_VERSION = '0.96'
> +
>     def __init__(self):
>         WebKit.WebView.__init__(self)
>
> +        web_settings = self.get_settings()
> +        identifier = ' Sugar Labs/' + self.CURRENT_SUGAR_VERSION
> +        web_settings.props.user_agent += identifier
> +        self.set_settings(web_settings)
> +
>         # Reference to the global history and callbacks to handle it:
>         self._global_history = globalhistory.get_global_history()
>         self.connect('notify::load-status', self.__load_status_changed_cb)
> --
> 1.7.7.5
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20120116/8b27c387/attachment.html>


More information about the Sugar-devel mailing list