Re: [Sugar-devel] [PATCH 1/2] Backport "Add DescriptionEntry to the activity sub-toolbar" from sugar-toolkit-gtk3

2012-04-19 Thread Anish Mangal
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Fri 20 Apr 2012 12:51:56 AM IST, godi...@sugarlabs.org wrote:
> From: Gonzalo Odiard 
>
> This is the implementation of the 'Write to Journal anytime' feature [1].
>
> The patch itself adds a DescriptionItem to the activity
> sub-toolbar to make editing a Journal entry description
> from within the activity possible. The code has the same
> error handling as the TitleEntry.
>
> After talking with teachers and the learning team,
> I found they are very excited about this feature.
> Doing this change we will have a more consistent experience
> in the activities at the release of sugar 0.96 too.
>
> The original patch was done by Simon Schampijer 
> and Walter Bender 
>
> Signed-off-by: Gonzalo Odiard 
>
> [1] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime
> ---
>  src/sugar/activity/widgets.py |   71 
> +
>  1 files changed, 71 insertions(+), 0 deletions(-)
>
> diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
> index e5c4063..ab75cd6 100644
> --- a/src/sugar/activity/widgets.py
> +++ b/src/sugar/activity/widgets.py
> @@ -28,6 +28,7 @@ from sugar.graphics.toolbox import Toolbox
>  from sugar.graphics.xocolor import XoColor
>  from sugar.graphics.icon import Icon
>  from sugar.bundle.activitybundle import ActivityBundle
> +from sugar.graphics import style
>  
>  
>  _ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
> @@ -235,6 +236,71 @@ class TitleEntry(gtk.ToolItem):
>  shared_activity.props.name = title
>  
>  
> +class DescriptionItem(gtk.ToolItem):
> +
> +def __init__(self, activity, **kwargs):
> +gtk.ToolItem.__init__(self)
> +
> +description_button = ToolButton('edit-description')
> +description_button.show()
> +description_button.set_tooltip(_('Description'))
> +self._palette = description_button.get_palette()
> +
> +description_box = gtk.HBox()
> +sw = gtk.ScrolledWindow()
> +sw.set_size_request(int(gtk.gdk.screen_width() / 2),
> +2 * style.GRID_CELL_SIZE)
> +sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
> +self._text_view = gtk.TextView()
> +self._text_view.set_left_margin(style.DEFAULT_PADDING)
> +self._text_view.set_right_margin(style.DEFAULT_PADDING)
> +text_buffer = gtk.TextBuffer()
> +if 'description' in activity.metadata:
> +text_buffer.set_text(activity.metadata['description'])
> +self._text_view.set_buffer(text_buffer)
> +self._text_view.connect('focus-out-event',
> +   self.__description_changed_cb, activity)
> +sw.add(self._text_view)
> +description_box.pack_start(sw, False, True, 0)
> +self._palette.set_content(description_box)
> +description_box.show_all()
> +
> +self.add(description_button)
> +description_button.connect('clicked',
> +   self.__description_button_clicked_cb)
> +
> +activity.metadata.connect('updated', self.__jobject_updated_cb)
> +
> +def _get_text_from_buffer(self):
> +buf = self._text_view.get_buffer()
> +start_iter = buf.get_start_iter()
> +end_iter = buf.get_end_iter()
> +return buf.get_text(start_iter, end_iter, False)
> +
> +def __jobject_updated_cb(self, jobject):
> +if self._text_view.has_focus():
> +return
> +if 'description' not in jobject:
> +return
> +if self._get_text_from_buffer() == jobject['description']:
> +return
> +buf = self._text_view.get_buffer()
> +buf.set_text(jobject['description'])
> +
> +def __description_button_clicked_cb(self, button):
> +self._palette.popup(immediate=True, state=1)
> +
> +def __description_changed_cb(self, widget, event, activity):
> +description = self._get_text_from_buffer()
> +if 'description' in activity.metadata and \
> +description == activity.metadata['description']:
> +return
> +
> +activity.metadata['description'] = description
> +activity.save()
> +return False
> +
> +
>  class ActivityToolbar(gtk.Toolbar):
>  """The Activity toolbar with the Journal entry title, sharing
> and Stop buttons
> @@ -261,6 +327,11 @@ class ActivityToolbar(gtk.Toolbar):
>  self.insert(separator, -1)
>  separator.show()
>  
> +if activity.metadata:
> +description_item = DescriptionItem(activity)
> +description_item.show()
> +self.insert(description_item, -1)
> +
>  self.share = ShareButton(activity)
>  self.share.show()
>  self.insert(self.share, -1)

Dumb question. The patch title says 'Backport', so which version of 
sugar is this being backported to ;)

- -- 
Anish 
-BEGIN PGP SIGNATURE-
Ve

[Sugar-devel] [ASLO] Release Memorize-41

2012-04-19 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4063

Sugar Platform:
0.86 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27981/memorize-41.xo

Release notes:
Restore buttons to add images and sounds to the cards
Translations updated


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH 2/2] Backport of "Remove the Naming Alert" in sugar-toolkit-gtk3

2012-04-19 Thread godiard
From: Gonzalo Odiard 

With the new 'Write to Journal anytime' feature it is possible
to write a description within an activity. Hopefully this leads
to more usage of the Journal for reflection by the learner. The
hinting nature ('you have not named your session yet') of the
Naming Alert has not been replaced, though.

This feature is requested by teachers and will provide a more consistent
experience in sugar 0.96 between gtk2 and gtk3 activities.

The original patch is from Simon Schampijer 

Signed-off-by: Gonzalo Odiard 
---
 po/POTFILES.in|1 -
 src/sugar/activity/Makefile.am|1 -
 src/sugar/activity/activity.py|   18 +--
 src/sugar/activity/namingalert.py |  306 -
 4 files changed, 5 insertions(+), 321 deletions(-)
 delete mode 100644 src/sugar/activity/namingalert.py

diff --git a/po/POTFILES.in b/po/POTFILES.in
index c9a8443..f3c984e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,5 +1,4 @@
 src/sugar/activity/activity.py
-src/sugar/activity/namingalert.py
 src/sugar/activity/widgets.py
 src/sugar/graphics/alert.py
 src/sugar/graphics/colorbutton.py
diff --git a/src/sugar/activity/Makefile.am b/src/sugar/activity/Makefile.am
index f3a663a..ca94b4d 100644
--- a/src/sugar/activity/Makefile.am
+++ b/src/sugar/activity/Makefile.am
@@ -7,5 +7,4 @@ sugar_PYTHON =  \
activityservice.py  \
bundlebuilder.py\
i18n.py \
-   namingalert.py  \
widgets.py
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py
index 5844506..fdf9827 100644
--- a/src/sugar/activity/activity.py
+++ b/src/sugar/activity/activity.py
@@ -75,7 +75,6 @@ from sugar import util
 from sugar.presence import presenceservice
 from sugar.activity import i18n
 from sugar.activity.activityservice import ActivityService
-from sugar.activity.namingalert import NamingAlert
 from sugar.graphics import style
 from sugar.graphics.window import Window
 from sugar.graphics.alert import Alert
@@ -900,19 +899,12 @@ class Activity(Window, gtk.Container):
 
 self.emit('_closing')
 
-if skip_save or self._jobject is None or \
-self.metadata.get('title_set_by_user', '0') == '1':
-if not self._closing:
-if not self._prepare_close(skip_save):
-return
+if not self._closing:
+if not self._prepare_close(skip_save):
+return
 
-if not self._updating_jobject:
-self._complete_close()
-else:
-title_alert = NamingAlert(self, get_bundle_path())
-title_alert.set_transient_for(self.get_toplevel())
-title_alert.show()
-self.reveal()
+if not self._updating_jobject:
+self._complete_close()
 
 def __realize_cb(self, window):
 wm.set_bundle_id(window.window, self.get_bundle_id())
diff --git a/src/sugar/activity/namingalert.py 
b/src/sugar/activity/namingalert.py
deleted file mode 100644
index 078c27a..000
--- a/src/sugar/activity/namingalert.py
+++ /dev/null
@@ -1,306 +0,0 @@
-# Copyright (C) 2009 One Laptop Per Child
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-import gettext
-import os
-
-import gio
-import gtk
-import gobject
-import gconf
-
-from sugar.graphics import style
-from sugar.graphics.icon import Icon
-from sugar.graphics.xocolor import XoColor
-from sugar.graphics.icon import get_icon_file_name
-from sugar.graphics.toolbutton import ToolButton
-
-from sugar.bundle.activitybundle import ActivityBundle
-
-
-_ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
-
-
-def _get_icon_name(metadata):
-file_name = None
-
-mime_type = metadata.get('mime_type', '')
-if not file_name and mime_type:
-icons = gio.content_type_get_icon(mime_type)
-for icon_name in icons.props.names:
-file_name = get_icon_file_name(icon_name)
-if file_name is not None:
-break
-
-if file_name is None or not os.path.exists(file_name):
-file_name = get_icon_file_name('application-octet-stream')
-
-return file_name
-
-
-class NamingToolbar(gtk.Toolbar):
-""" Toolbar of the naming alert
-"""
-
-__gtype_name__

[Sugar-devel] [PATCH 1/2] Backport "Add DescriptionEntry to the activity sub-toolbar" from sugar-toolkit-gtk3

2012-04-19 Thread godiard
From: Gonzalo Odiard 

This is the implementation of the 'Write to Journal anytime' feature [1].

The patch itself adds a DescriptionItem to the activity
sub-toolbar to make editing a Journal entry description
from within the activity possible. The code has the same
error handling as the TitleEntry.

After talking with teachers and the learning team,
I found they are very excited about this feature.
Doing this change we will have a more consistent experience
in the activities at the release of sugar 0.96 too.

The original patch was done by Simon Schampijer 
and Walter Bender 

Signed-off-by: Gonzalo Odiard 

[1] http://wiki.sugarlabs.org/go/Features/Write_to_journal_anytime
---
 src/sugar/activity/widgets.py |   71 +
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/src/sugar/activity/widgets.py b/src/sugar/activity/widgets.py
index e5c4063..ab75cd6 100644
--- a/src/sugar/activity/widgets.py
+++ b/src/sugar/activity/widgets.py
@@ -28,6 +28,7 @@ from sugar.graphics.toolbox import Toolbox
 from sugar.graphics.xocolor import XoColor
 from sugar.graphics.icon import Icon
 from sugar.bundle.activitybundle import ActivityBundle
+from sugar.graphics import style
 
 
 _ = lambda msg: gettext.dgettext('sugar-toolkit', msg)
@@ -235,6 +236,71 @@ class TitleEntry(gtk.ToolItem):
 shared_activity.props.name = title
 
 
+class DescriptionItem(gtk.ToolItem):
+
+def __init__(self, activity, **kwargs):
+gtk.ToolItem.__init__(self)
+
+description_button = ToolButton('edit-description')
+description_button.show()
+description_button.set_tooltip(_('Description'))
+self._palette = description_button.get_palette()
+
+description_box = gtk.HBox()
+sw = gtk.ScrolledWindow()
+sw.set_size_request(int(gtk.gdk.screen_width() / 2),
+2 * style.GRID_CELL_SIZE)
+sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+self._text_view = gtk.TextView()
+self._text_view.set_left_margin(style.DEFAULT_PADDING)
+self._text_view.set_right_margin(style.DEFAULT_PADDING)
+text_buffer = gtk.TextBuffer()
+if 'description' in activity.metadata:
+text_buffer.set_text(activity.metadata['description'])
+self._text_view.set_buffer(text_buffer)
+self._text_view.connect('focus-out-event',
+   self.__description_changed_cb, activity)
+sw.add(self._text_view)
+description_box.pack_start(sw, False, True, 0)
+self._palette.set_content(description_box)
+description_box.show_all()
+
+self.add(description_button)
+description_button.connect('clicked',
+   self.__description_button_clicked_cb)
+
+activity.metadata.connect('updated', self.__jobject_updated_cb)
+
+def _get_text_from_buffer(self):
+buf = self._text_view.get_buffer()
+start_iter = buf.get_start_iter()
+end_iter = buf.get_end_iter()
+return buf.get_text(start_iter, end_iter, False)
+
+def __jobject_updated_cb(self, jobject):
+if self._text_view.has_focus():
+return
+if 'description' not in jobject:
+return
+if self._get_text_from_buffer() == jobject['description']:
+return
+buf = self._text_view.get_buffer()
+buf.set_text(jobject['description'])
+
+def __description_button_clicked_cb(self, button):
+self._palette.popup(immediate=True, state=1)
+
+def __description_changed_cb(self, widget, event, activity):
+description = self._get_text_from_buffer()
+if 'description' in activity.metadata and \
+description == activity.metadata['description']:
+return
+
+activity.metadata['description'] = description
+activity.save()
+return False
+
+
 class ActivityToolbar(gtk.Toolbar):
 """The Activity toolbar with the Journal entry title, sharing
and Stop buttons
@@ -261,6 +327,11 @@ class ActivityToolbar(gtk.Toolbar):
 self.insert(separator, -1)
 separator.show()
 
+if activity.metadata:
+description_item = DescriptionItem(activity)
+description_item.show()
+self.insert(description_item, -1)
+
 self.share = ShareButton(activity)
 self.share.show()
 self.insert(self.share, -1)
-- 
1.7.7.6

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ASLO] Release Nutrition-3

2012-04-19 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4555

Sugar Platform:
0.86 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27962/nutrition-3.xo

Release notes:
A series of four nutrition games: Name That Food; How Many Calories?; How Much 
to Eat?; and Is This a Balanced Meal?


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [ASLO] Release Puzzleton-2

2012-04-19 Thread Sugar Labs Activities
Activity Homepage:
http://activities.sugarlabs.org/addon/4556

Sugar Platform:
0.82 - 0.96

Download Now:
http://activities.sugarlabs.org/downloads/file/27978/puzzleton-2.xo

Release notes:
Only support for rectangular pieces.

Sugarized icon and support for the new toolbar style.


Sugar Labs Activities
http://activities.sugarlabs.org

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] Python name mangling in callbacks

2012-04-19 Thread Manuel Quiñones
El día 19 de abril de 2012 15:30, Gonzalo Odiard  escribió:
>
>
> 2012/4/19 Manuel Quiñones 
>>
>> Hi,
>>
>> out of curiosity:  is there a reason to use name mangling [1] in the
>> callback functions?  I'm sure it must be one.  This lead to
>> particularly tricky solution in this Terminal bug [2].
>>
>
> I am confused about this bug, the code of terminal [1]
> already change the accelerator

Yes, this was fixed by humitos in commit
d50827658f9550d95edcbf0a601d638224ce0ac6 (don't know why is signed by
Rafael).

I just want to know if is there a reason to use name mangling in the
callbacks, that bug was there for a lot of time because no one noticed
the mangling.


.. manuq ..
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] Python name mangling in callbacks

2012-04-19 Thread Manuel Quiñones
Hi,

out of curiosity:  is there a reason to use name mangling [1] in the
callback functions?  I'm sure it must be one.  This lead to
particularly tricky solution in this Terminal bug [2].

[1] http://docs.python.org/release/1.5/tut/node67.html
[2] http://bugs.sugarlabs.org/ticket/440

Cheers,

-- 
.. manuq ..
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v3 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Daniel Drake
On Thu, Apr 19, 2012 at 10:51 AM, Manuel Quiñones  wrote:
>> +    soup_uri = Soup.URI.new(uri_string=backup_url)
>
> Daniel, above is the only new() constructor pending, I cannot find a
> replacement for it,  Soup.URI(uri_string=backup_url) gives error,
> there's no method in Soup.URI to setup with a uri string.  I can do
> uri.set_host() and uri.set_scheme(), but I have to split backup_url
> for that, and I don't know what kind of url is it.

Checked the libsoup source code. soup_uri_new() calls
soup_uri_new_with_base(), and this function has a whole heap of code
which lives outside of a class method.
So yes, using .new() is the only option here. Maybe add a comment
before commit explaining that the GObject constructor can't be used in
this case because the code we need is locked up behind .new().

Thanks
Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v3 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Manuel Quiñones
El día 19 de abril de 2012 13:50, Daniel Drake  escribió:
> On Thu, Apr 19, 2012 at 10:45 AM, Manuel Quiñones  wrote:
>> There was code in Browse to create a SQlite database under data
>> directory in the activity profile.  This was for creating a cookie to
>> authenticate the laptop with a schoolserver.
>>
>> Now we use the same database via the Soup library to store all cookies
>> so they are persistent between sessions.  A Soup cookie jar is being
>> attached to the WebKit session, cookies are stored in a Mozilla
>> compatible SQLite format.
>>
>> The schoolserver function has been changed to use the Soup API.
>>
>> The code is based in Epiphany, embed/ephy-embed-single.c .
>
> Looks good to me.
> Thanks a lot!

OK, thanks for reviewing!


-- 
.. manuq ..
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v3 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Manuel Quiñones
El día 19 de abril de 2012 13:45, Manuel Quiñones  escribió:
> There was code in Browse to create a SQlite database under data
> directory in the activity profile.  This was for creating a cookie to
> authenticate the laptop with a schoolserver.
>
> Now we use the same database via the Soup library to store all cookies
> so they are persistent between sessions.  A Soup cookie jar is being
> attached to the WebKit session, cookies are stored in a Mozilla
> compatible SQLite format.
>
> The schoolserver function has been changed to use the Soup API.
>
> The code is based in Epiphany, embed/ephy-embed-single.c .
>
> --
>
> v1->v2: let Soup take care of database creation, use Soup API in
> schoolserver cookie seed function
>
> v2->v3: use proper constructors for PyGI instead of new()
>
> Signed-off-by: Manuel Quiñones 
> ---
>  webactivity.py |   79 ---
>  1 files changed, 35 insertions(+), 44 deletions(-)
>
> diff --git a/webactivity.py b/webactivity.py
> index aadc29a..611e3b2 100644
> --- a/webactivity.py
> +++ b/webactivity.py
> @@ -28,6 +28,8 @@ from gi.repository import Gtk
>  from gi.repository import Gdk
>  from gi.repository import GdkPixbuf
>  from gi.repository import WebKit
> +from gi.repository import Soup
> +from gi.repository import SoupGNOME
>
>  import base64
>  import time
> @@ -58,6 +60,7 @@ PROFILE_VERSION = 2
>  _profile_version = 0
>  _profile_path = os.path.join(activity.get_activity_root(), 'data/gecko')
>  _version_file = os.path.join(_profile_path, 'version')
> +_cookies_db_path = os.path.join(_profile_path, 'cookies.sqlite')
>
>  if os.path.exists(_version_file):
>     f = open(_version_file)
> @@ -76,15 +79,25 @@ if _profile_version < PROFILE_VERSION:
>     f.close()
>
>
> -def _seed_xs_cookie():
> -    ''' Create a HTTP Cookie to authenticate with the Schoolserver
> -    '''
> +def _seed_xs_cookie(cookie_jar):
> +    """Create a HTTP Cookie to authenticate with the Schoolserver.
> +
> +    Do nothing if the laptop is not registered with Schoolserver, or
> +    if the cookie already exists.
> +
> +    """
>     client = GConf.Client.get_default()
>     backup_url = client.get_string('/desktop/sugar/backup_url')
> -    if not backup_url:
> +    if backup_url == '':
>         _logger.debug('seed_xs_cookie: Not registered with Schoolserver')
>         return
>
> +    soup_uri = Soup.URI.new(uri_string=backup_url)
> +    xs_cookie = cookie_jar.get_cookies(soup_uri, for_http=False)
> +    if xs_cookie is not None:
> +        _logger.debug('seed_xs_cookie: Cookie exists already')
> +        return

Daniel, above is the only new() constructor pending, I cannot find a
replacement for it,  Soup.URI(uri_string=backup_url) gives error,
there's no method in Soup.URI to setup with a uri string.  I can do
uri.set_host() and uri.set_scheme(), but I have to split backup_url
for that, and I don't know what kind of url is it.

Someone should try this in a School Server before commiting

-- 
.. manuq ..
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v3 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Daniel Drake
On Thu, Apr 19, 2012 at 10:45 AM, Manuel Quiñones  wrote:
> There was code in Browse to create a SQlite database under data
> directory in the activity profile.  This was for creating a cookie to
> authenticate the laptop with a schoolserver.
>
> Now we use the same database via the Soup library to store all cookies
> so they are persistent between sessions.  A Soup cookie jar is being
> attached to the WebKit session, cookies are stored in a Mozilla
> compatible SQLite format.
>
> The schoolserver function has been changed to use the Soup API.
>
> The code is based in Epiphany, embed/ephy-embed-single.c .

Looks good to me.
Thanks a lot!
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RELEASE] sugar-0.95.7

2012-04-19 Thread Simon Schampijer
== Source ==

http://download.sugarlabs.org/sources/sucrose/glucose/sugar/sugar-0.95.7.tar.bz2

== News ==

* Release 0.95.7 (Simon Schampijer)
* Update Sucrose version for upcoming 0.95.7 (Simon Schampijer)
* Prevent handling network devices twice (OLPC#11782) (Daniel Drake)
* Touchpad icon: update for upstream kernel API (Daniel Drake)
* Commit from Sugar Labs: Translation System by user HoboPrimate.: 390 of 390 
messages translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user dram.: 390 of 390 messages 
translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user mschlager.: 390 of 390 
messages translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user aputsiaq.: 390 of 390 
messages translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 390 of 390 messages 
translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 390 of 390 messages 
translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 390 of 390 messages 
translated (0 fuzzy). (Pootle daemon)
* Don't treat SSID as UTF-8 character sequence (fixes SL#2023) (Sascha Silbe)
* Fix Traceback when connecting to a network for the first time (Sascha Silbe)
* Commit from Sugar Labs: Translation System by user cjl.: 300 of 389 messages 
translated (87 fuzzy). (Pootle daemon)
* keyhandler: Use textual key names, OLPC #11721 (Daniel Drake)
* Commit from Sugar Labs: Translation System by user malaku.: 389 of 389 
messages translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 384 of 389 messages 
translated (5 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 389 of 389 messages 
translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 191 of 389 messages 
translated (11 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user malaku.: 389 of 389 
messages translated (0 fuzzy). (Pootle daemon)
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v3 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Manuel Quiñones
There was code in Browse to create a SQlite database under data
directory in the activity profile.  This was for creating a cookie to
authenticate the laptop with a schoolserver.

Now we use the same database via the Soup library to store all cookies
so they are persistent between sessions.  A Soup cookie jar is being
attached to the WebKit session, cookies are stored in a Mozilla
compatible SQLite format.

The schoolserver function has been changed to use the Soup API.

The code is based in Epiphany, embed/ephy-embed-single.c .

--

v1->v2: let Soup take care of database creation, use Soup API in
schoolserver cookie seed function

v2->v3: use proper constructors for PyGI instead of new()

Signed-off-by: Manuel Quiñones 
---
 webactivity.py |   79 ---
 1 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/webactivity.py b/webactivity.py
index aadc29a..611e3b2 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -28,6 +28,8 @@ from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import GdkPixbuf
 from gi.repository import WebKit
+from gi.repository import Soup
+from gi.repository import SoupGNOME
 
 import base64
 import time
@@ -58,6 +60,7 @@ PROFILE_VERSION = 2
 _profile_version = 0
 _profile_path = os.path.join(activity.get_activity_root(), 'data/gecko')
 _version_file = os.path.join(_profile_path, 'version')
+_cookies_db_path = os.path.join(_profile_path, 'cookies.sqlite')
 
 if os.path.exists(_version_file):
 f = open(_version_file)
@@ -76,15 +79,25 @@ if _profile_version < PROFILE_VERSION:
 f.close()
 
 
-def _seed_xs_cookie():
-''' Create a HTTP Cookie to authenticate with the Schoolserver
-'''
+def _seed_xs_cookie(cookie_jar):
+"""Create a HTTP Cookie to authenticate with the Schoolserver.
+
+Do nothing if the laptop is not registered with Schoolserver, or
+if the cookie already exists.
+
+"""
 client = GConf.Client.get_default()
 backup_url = client.get_string('/desktop/sugar/backup_url')
-if not backup_url:
+if backup_url == '':
 _logger.debug('seed_xs_cookie: Not registered with Schoolserver')
 return
 
+soup_uri = Soup.URI.new(uri_string=backup_url)
+xs_cookie = cookie_jar.get_cookies(soup_uri, for_http=False)
+if xs_cookie is not None:
+_logger.debug('seed_xs_cookie: Cookie exists already')
+return
+
 jabber_server = client.get_string(
 '/desktop/sugar/collaboration/jabber_server')
 
@@ -92,45 +105,16 @@ def _seed_xs_cookie():
 cookie_data = {'color': profile.get_color().to_string(),
'pkey_hash': sha1(pubkey).hexdigest()}
 
-db_path = os.path.join(_profile_path, 'cookies.sqlite')
-try:
-cookies_db = sqlite3.connect(db_path)
-c = cookies_db.cursor()
-
-c.execute('''CREATE TABLE IF NOT EXISTS
- moz_cookies
- (id INTEGER PRIMARY KEY,
-  name TEXT,
-  value TEXT,
-  host TEXT,
-  path TEXT,
-  expiry INTEGER,
-  lastAccessed INTEGER,
-  isSecure INTEGER,
-  isHttpOnly INTEGER)''')
-
-c.execute('''SELECT id
- FROM moz_cookies
- WHERE name=? AND host=? AND path=?''',
-  ('xoid', jabber_server, '/'))
-
-if c.fetchone():
-_logger.debug('seed_xs_cookie: Cookie exists already')
-return
+expire = int(time.time()) + 10 * 365 * 24 * 60 * 60
 
-expire = int(time.time()) + 10 * 365 * 24 * 60 * 60
-c.execute('''INSERT INTO moz_cookies (name, value, host,
-  path, expiry, lastAccessed,
-  isSecure, isHttpOnly)
- VALUES(?,?,?,?,?,?,?,?)''',
-  ('xoid', json.loads(cookie_data), jabber_server,
-   '/', expire, 0, 0, 0))
-cookies_db.commit()
-cookies_db.close()
-except sqlite3.Error:
-_logger.exception('seed_xs_cookie: could not write cookie')
-else:
-_logger.debug('seed_xs_cookie: Updated cookie successfully')
+xs_cookie = Soup.Cookie()
+xs_cookie.set_name('xoid')
+xs_cookie.set_value(json.loads(cookie_data))
+xs_cookie.set_domain(jabber_server)
+xs_cookie.set_path('/')
+xs_cookie.set_max_age(expire)
+cookie_jar.add_cookie(xs_cookie)
+_logger.debug('seed_xs_cookie: Updated cookie successfully')
 
 
 def _set_char_preference(name, value):
@@ -170,6 +154,15 @@ class WebActivity(activity.Activity):
 session = WebKit.get_default_session()
 session.set_property('accept-language-auto', True)
 
+# By default, cookies are not stored persistently, we have to
+# add a cookie jar so that they get saved to disk.  We use one
+  

[Sugar-devel] [RELEASE] sugar-artwork-0.95.5

2012-04-19 Thread Simon Schampijer
== Source ==

http://download.sugarlabs.org/sources/sucrose/glucose/sugar-artwork/sugar-artwork-0.95.5.tar.bz2

== News ==

* Release 0.95.5 (Simon Schampijer)
* Bring back the icon edir-description, SL #3384 (Simon Schampijer) 
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [RELEASE] sugar-toolkit-gtk3-0.95.6

2012-04-19 Thread Simon Schampijer
== Source ==

http://download.sugarlabs.org/sources/sucrose/glucose/sugar-toolkit-gtk3/sugar-toolkit-gtk3-0.95.6.tar.bz2

== News ==

* Release 0.95.6 (Simon Schampijer)
* Draw accelerator in Palette SL #3459 (Simon Schampijer)
* Draw border for palette all the time SL #3383 (Simon Schampijer)
* Commit from Sugar Labs: Translation System by user cjl.: 34 of 35 messages 
translated (1 fuzzy). (Pootle daemon)
* Update ALL_LINGUAS (Simon Schampijer)
* Commit from Sugar Labs: Translation System by user HoboPrimate.: 35 of 35 
messages translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 35 of 35 messages 
translated (0 fuzzy). (Pootle daemon)
* Commit from Sugar Labs: Translation System by user cjl.: 34 of 35 messages 
translated (1 fuzzy). (Pootle daemon)
* push deletes (Pootle daemon)
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v2 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Manuel Quiñones
El día 19 de abril de 2012 12:25, Daniel Drake  escribió:
> On Thu, Apr 19, 2012 at 9:20 AM, Manuel Quiñones  wrote:
>> There was code in Browse to create a SQlite database under data
>> directory in the activity profile.  This was for creating a cookie to
>> authenticate the laptop with a schoolserver.
>>
>> Now we use the same database via the Soup library to store all cookies
>> so they are persistent between sessions.  A Soup cookie jar is being
>> attached to the WebKit session, cookies are stored in a Mozilla
>> compatible SQLite format.
>>
>> The schoolserver function has been changed to use the Soup API.
>>
>> The code is based in Epiphany, embed/ephy-embed-single.c .
>
> Great! Looks a lot better, and now even results in a code reduction. Thanks.
>
> Just one more small detail (sorry, forgot to mention in last mail)
>
> Instead of using .new() to construct objects it is preferred to use
> the gobject constructor. You have 2 cases of using .new().
> http://wiki.sugarlabs.org/go/Features/GTK3/Porting#Constructor_considerations
>
> In some cases (when the library is buggy), this changes behaviour, so
> be sure to test it.

OK! Will do so.

-- 
.. manuq ..
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [IAEP] eduJAM! and 1-to-1 week: information and scholarships

2012-04-19 Thread Jonas Smedegaard
On 12-04-19 at 11:43am, Pablo Flores wrote:
> We're very close to eduJAM! 2012, which will take place in May in 
> Montevideo, Uruguay. This time the summit doesn’t stand on its own but 
> is accompanied by a number of events which promise to provide 
> enriching meeting opportunities.

Wauw! That's a LOT going on there.

I am wondering: Would Debian packaging of Sugar be of any relevancy 
there?


Regards,

 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private


signature.asc
Description: Digital signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH v2 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Daniel Drake
On Thu, Apr 19, 2012 at 9:20 AM, Manuel Quiñones  wrote:
> There was code in Browse to create a SQlite database under data
> directory in the activity profile.  This was for creating a cookie to
> authenticate the laptop with a schoolserver.
>
> Now we use the same database via the Soup library to store all cookies
> so they are persistent between sessions.  A Soup cookie jar is being
> attached to the WebKit session, cookies are stored in a Mozilla
> compatible SQLite format.
>
> The schoolserver function has been changed to use the Soup API.
>
> The code is based in Epiphany, embed/ephy-embed-single.c .

Great! Looks a lot better, and now even results in a code reduction. Thanks.

Just one more small detail (sorry, forgot to mention in last mail)

Instead of using .new() to construct objects it is preferred to use
the gobject constructor. You have 2 cases of using .new().
http://wiki.sugarlabs.org/go/Features/GTK3/Porting#Constructor_considerations

In some cases (when the library is buggy), this changes behaviour, so
be sure to test it.

Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH v2 Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Manuel Quiñones
There was code in Browse to create a SQlite database under data
directory in the activity profile.  This was for creating a cookie to
authenticate the laptop with a schoolserver.

Now we use the same database via the Soup library to store all cookies
so they are persistent between sessions.  A Soup cookie jar is being
attached to the WebKit session, cookies are stored in a Mozilla
compatible SQLite format.

The schoolserver function has been changed to use the Soup API.

The code is based in Epiphany, embed/ephy-embed-single.c .

--

v1->v2: let Soup take care of database creation, use Soup API in
schoolserver cookie seed function

Signed-off-by: Manuel Quiñones 
---
 webactivity.py |   75 +++
 1 files changed, 31 insertions(+), 44 deletions(-)

diff --git a/webactivity.py b/webactivity.py
index aadc29a..3b9bbc0 100644
--- a/webactivity.py
+++ b/webactivity.py
@@ -28,6 +28,8 @@ from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import GdkPixbuf
 from gi.repository import WebKit
+from gi.repository import Soup
+from gi.repository import SoupGNOME
 
 import base64
 import time
@@ -58,6 +60,7 @@ PROFILE_VERSION = 2
 _profile_version = 0
 _profile_path = os.path.join(activity.get_activity_root(), 'data/gecko')
 _version_file = os.path.join(_profile_path, 'version')
+_cookies_db_path = os.path.join(_profile_path, 'cookies.sqlite')
 
 if os.path.exists(_version_file):
 f = open(_version_file)
@@ -76,15 +79,25 @@ if _profile_version < PROFILE_VERSION:
 f.close()
 
 
-def _seed_xs_cookie():
-''' Create a HTTP Cookie to authenticate with the Schoolserver
-'''
+def _seed_xs_cookie(cookie_jar):
+"""Create a HTTP Cookie to authenticate with the Schoolserver.
+
+Do nothing if the laptop is not registered with Schoolserver, or
+if the cookie already exists.
+
+"""
 client = GConf.Client.get_default()
 backup_url = client.get_string('/desktop/sugar/backup_url')
-if not backup_url:
+if backup_url == '':
 _logger.debug('seed_xs_cookie: Not registered with Schoolserver')
 return
 
+soup_uri = Soup.URI.new(backup_url)
+xs_cookie = cookie_jar.get_cookies(soup_uri, for_http=False)
+if xs_cookie is not None:
+_logger.debug('seed_xs_cookie: Cookie exists already')
+return
+
 jabber_server = client.get_string(
 '/desktop/sugar/collaboration/jabber_server')
 
@@ -92,45 +105,12 @@ def _seed_xs_cookie():
 cookie_data = {'color': profile.get_color().to_string(),
'pkey_hash': sha1(pubkey).hexdigest()}
 
-db_path = os.path.join(_profile_path, 'cookies.sqlite')
-try:
-cookies_db = sqlite3.connect(db_path)
-c = cookies_db.cursor()
-
-c.execute('''CREATE TABLE IF NOT EXISTS
- moz_cookies
- (id INTEGER PRIMARY KEY,
-  name TEXT,
-  value TEXT,
-  host TEXT,
-  path TEXT,
-  expiry INTEGER,
-  lastAccessed INTEGER,
-  isSecure INTEGER,
-  isHttpOnly INTEGER)''')
-
-c.execute('''SELECT id
- FROM moz_cookies
- WHERE name=? AND host=? AND path=?''',
-  ('xoid', jabber_server, '/'))
-
-if c.fetchone():
-_logger.debug('seed_xs_cookie: Cookie exists already')
-return
+expire = int(time.time()) + 10 * 365 * 24 * 60 * 60
 
-expire = int(time.time()) + 10 * 365 * 24 * 60 * 60
-c.execute('''INSERT INTO moz_cookies (name, value, host,
-  path, expiry, lastAccessed,
-  isSecure, isHttpOnly)
- VALUES(?,?,?,?,?,?,?,?)''',
-  ('xoid', json.loads(cookie_data), jabber_server,
-   '/', expire, 0, 0, 0))
-cookies_db.commit()
-cookies_db.close()
-except sqlite3.Error:
-_logger.exception('seed_xs_cookie: could not write cookie')
-else:
-_logger.debug('seed_xs_cookie: Updated cookie successfully')
+xs_cookie = Soup.Cookie.new(name='xoid', value=json.loads(cookie_data),
+domain=jabber_server, path='/', max_age=expire)
+cookie_jar.add_cookie(xs_cookie)
+_logger.debug('seed_xs_cookie: Updated cookie successfully')
 
 
 def _set_char_preference(name, value):
@@ -170,6 +150,15 @@ class WebActivity(activity.Activity):
 session = WebKit.get_default_session()
 session.set_property('accept-language-auto', True)
 
+# By default, cookies are not stored persistently, we have to
+# add a cookie jar so that they get saved to disk.  We use one
+# with a SQlite database:
+cookie_jar = SoupGNOME.CookieJarSqlite.new(_cookies_db_path,
+   

Re: [Sugar-devel] [PATCH] Draw accelerator in Palette SL #3459

2012-04-19 Thread Daniel Drake
On Wed, Apr 18, 2012 at 2:35 PM, Simon Schampijer  wrote:
> The accelerator in the primary information in the Palette
> has not been drawn because there was not enough space
> reserved for it. The preferred size we get back for the
> Palette window does not include the accelerator of the
> Gtk.AccelLabel. We need to include that in our calculation for
> the Palette size.
>
> In order to make that information available which is part
> of the Palette class we need to pass the instance to the
> PaletteWindowWidget instance.

Looks good. Having the do_get_preferred_width implementation in the
Palette class was a definite oddity because Palette is not a GTK
widget and so this was never called.

Thanks
Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] When a object is removed from the clipboard try, select the last available - SL #1266

2012-04-19 Thread godiard
From: Gonzalo Odiard 

Signed-off-by: Gonzalo Odiard 
---
 src/jarabe/frame/clipboardtray.py |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/frame/clipboardtray.py 
b/src/jarabe/frame/clipboardtray.py
index e78ef4a..b1426c4 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -124,6 +124,11 @@ class ClipboardTray(tray.VTray):
 icon = self._icons[object_id]
 self.remove_item(icon)
 del self._icons[object_id]
+# select the last available icon
+if len(self._icons) > 0:
+n_icons = len(self.get_children())
+last_icon = self.get_children()[n_icons - 1]
+last_icon.props.active = True
 logging.debug('ClipboardTray: %r was deleted', object_id)
 
 def _object_selected_cb(self, cb_service, object_id):
-- 
1.7.7.6

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH] Draw border for palette all the time SL #3383

2012-04-19 Thread Daniel Drake
On Wed, Apr 18, 2012 at 2:46 PM, Simon Schampijer  wrote:
> gtk_render_frame_gap [1] does expect an initial and an end
> coordinate for the gap. paint_box_gap [2] which we used
> before expected a starting position of the gap and the width
> of the gap as parameter.
>
> The patch does calculate the end coordinate parameter for
> the gap from the initial coordinate and the width of the
> gap.

Looks good.
Please also check the render_frame_gap call in toolbarbox.py. (I think
it is already OK)

Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Manuel Quiñones
El día 19 de abril de 2012 11:12, Daniel Drake  escribió:
> Hi Manuel,
>
> On Wed, Apr 18, 2012 at 4:01 PM, Manuel Quiñones  wrote:
>> There was code in Browse to create a SQlite database under data
>> directory in the activity profile.  This was for creating a cookie to
>> authenticate the laptop in a schoolserver.
>>
>> I have moved the database creation to a new function, that is called
>> before the one that adds the cookie for the schoolserver.
>>
>> The database is being attached to the WebKit session so the cookies
>> are stored there, in a Mozilla compatible SQLite format.
>
> I think a better way to do this is to let SoupCookieJarSqlite create
> the sqlite DB if it doesn't already exist (I just checked - this is
> how it behaves).
>
> Then use soup_cookie_jar_get_cookies() or
> soup_cookie_jar_all_cookies() to check if the XS cookie is set, and if
> it isn't, add it with soup_cookie_jar_set_cookie() or
> soup_cookie_jar_add_cookie().
>
> Where you add the cookiejar to the session, it would also be worth
> adding a comment explaining that by default, cookies are not stored
> persistently - we have to add a cookiejar at that point so that they
> get saved to disk.
>
> Daniel

Great Daniel, I'll do and send a new patch.


-- 
.. manuq ..
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


[Sugar-devel] [PATCH] Only add one time every object in the clipboard v2 - SL #3371

2012-04-19 Thread godiard
From: Gonzalo Odiard 

This patch change the behaviour of the clipboard tray,
every object is added only one time, if already exist,
the already added object is selected.
Is needed because a bad interaction between the clipboard in write and
the text to speech feature. See the ticket for more information.

v2: Select the already added object if needed, as sugested by Sasha.

Signed-off-by: Gonzalo Odiard 
---
 src/jarabe/frame/clipboard.py|   17 +
 src/jarabe/frame/clipboardpanelwindow.py |5 -
 src/jarabe/frame/clipboardtray.py|6 ++
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/jarabe/frame/clipboard.py b/src/jarabe/frame/clipboard.py
index be2b902..ae1ceb9 100644
--- a/src/jarabe/frame/clipboard.py
+++ b/src/jarabe/frame/clipboard.py
@@ -36,7 +36,9 @@ class Clipboard(gobject.GObject):
 'object-added': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
 ([object])),
 'object-deleted': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
-([int])),
+([long])),
+'object-selected': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+([long])),
 'object-state-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
 ([object])),
 }
@@ -51,9 +53,16 @@ class Clipboard(gobject.GObject):
 self._next_id += 1
 return self._next_id
 
-def add_object(self, name):
-logging.debug('Clipboard.add_object')
-object_id = self._get_next_object_id()
+def add_object(self, name, data_hash=None):
+logging.debug('Clipboard.add_object hash %s', data_hash)
+if data_hash is None:
+object_id = self._get_next_object_id()
+else:
+object_id = data_hash
+if object_id in self._objects:
+logging.debug('Object rejected, already exist')
+self.emit('object-selected', object_id)
+return None
 self._objects[object_id] = ClipboardObject(object_id, name)
 self.emit('object-added', self._objects[object_id])
 return object_id
diff --git a/src/jarabe/frame/clipboardpanelwindow.py 
b/src/jarabe/frame/clipboardpanelwindow.py
index b73572e..28c5726 100644
--- a/src/jarabe/frame/clipboardpanelwindow.py
+++ b/src/jarabe/frame/clipboardpanelwindow.py
@@ -70,7 +70,10 @@ class ClipboardPanelWindow(FrameWindow):
 cb_selections.append(selection)
 
 if len(cb_selections) > 0:
-key = cb_service.add_object(name="")
+key = cb_service.add_object(name="",
+data_hash=hash(selection.data))
+if key is None:
+return
 cb_service.set_object_percent(key, percent=0)
 for selection in cb_selections:
 self._add_selection(key, selection)
diff --git a/src/jarabe/frame/clipboardtray.py 
b/src/jarabe/frame/clipboardtray.py
index f49b799..e78ef4a 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -70,6 +70,7 @@ class ClipboardTray(tray.VTray):
 cb_service = clipboard.get_instance()
 cb_service.connect('object-added', self._object_added_cb)
 cb_service.connect('object-deleted', self._object_deleted_cb)
+cb_service.connect('object-selected', self._object_selected_cb)
 
 def owns_clipboard(self):
 for icon in self._icons.values():
@@ -125,6 +126,11 @@ class ClipboardTray(tray.VTray):
 del self._icons[object_id]
 logging.debug('ClipboardTray: %r was deleted', object_id)
 
+def _object_selected_cb(self, cb_service, object_id):
+icon = self._icons[object_id]
+icon.props.active = True
+logging.debug('ClipboardTray: %r was activated', object_id)
+
 def drag_motion_cb(self, widget, context, x, y, time):
 logging.debug('ClipboardTray._drag_motion_cb')
 
-- 
1.7.7.6

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [PATCH sugar] Fix shortcut for view source

2012-04-19 Thread Daniel Drake
On Mon, Apr 16, 2012 at 8:02 AM, Sascha Silbe  wrote:
> Excerpts from Simon Schampijer's message of 2012-04-16 10:42:39 +0200:
>
> [extensions/globalkey/viewsource.py]
>> -BOUND_KEYS = ['0xEC', 'v']
>> +BOUND_KEYS = ['XF86KbdLightOnOff', 'v']
>
> Is "Keyboard light on/off" really a key that we want to trigger View
> Source? Maybe it's what current OLPC images call the key, but that's
> fixable.

0xEC and XF86KbdLightOnOff are just different ways of saying the same
thing, both mean "Keyboard light on/off" just expressed using
different notations. So there is no functional or binding change
involved in this patch, we just work around a bug in libegg for which
we have a better solution available when we move to GTK3.

So while the key assignment is definitely strange, it is exactly the
same assignment we've had for longer than I've been involved in the
project.

I agree that the key binding is a bit odd and that we should look at
getting a new key added. I filed a ticket
http://dev.laptop.org/ticket/11788 and I will start to work on it.

In the mean time I think this patch is good to go in.

Thanks,
Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] [Browse] Store web session cookies in SQlite database, for SL #3456

2012-04-19 Thread Daniel Drake
Hi Manuel,

On Wed, Apr 18, 2012 at 4:01 PM, Manuel Quiñones  wrote:
> There was code in Browse to create a SQlite database under data
> directory in the activity profile.  This was for creating a cookie to
> authenticate the laptop in a schoolserver.
>
> I have moved the database creation to a new function, that is called
> before the one that adds the cookie for the schoolserver.
>
> The database is being attached to the WebKit session so the cookies
> are stored there, in a Mozilla compatible SQLite format.

I think a better way to do this is to let SoupCookieJarSqlite create
the sqlite DB if it doesn't already exist (I just checked - this is
how it behaves).

Then use soup_cookie_jar_get_cookies() or
soup_cookie_jar_all_cookies() to check if the XS cookie is set, and if
it isn't, add it with soup_cookie_jar_set_cookie() or
soup_cookie_jar_add_cookie().

Where you add the cookiejar to the session, it would also be worth
adding a comment explaining that by default, cookies are not stored
persistently - we have to add a cookiejar at that point so that they
get saved to disk.

Daniel
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel