[Sugar-devel] Proposed solution to OLPC #10930

Gonzalo Odiard gonzalo at laptop.org
Thu Jun 23 09:53:23 EDT 2011

I was working in the solution of OLPC #10930 "copy/paste does not work in if
one has not revealed the edit toolbar once"
The problem can be reproduced in activities with the new toolbars, like
Terminal or Browse.
For example, in Terminal, if you open the activity, select a text and press
"Shift-Ctrl-C", nothing is copied,
if you show the Edit toolbar and try pressing "Sift-Ctrl-C" again, the text
is copied.
The same happen in Browse with "Ctrl-C"

I have worked in two different solutions:
1) 0001-Update-accelerators-when-the-toolbar-is-set-in-the-a.patch<http://dev.laptop.org/attachment/ticket/10930/0001-Update-accelerators-when-the-toolbar-is-set-in-the-a.patch>
The patch walk the objects in the toolbar_box when is set in the activity
and update the accelerators.
This patch resolve the problem in activities Terminal and Browse without
changing the activities.
If in one activity the programmer set the toolbar_box in the activity before
adding all the buttons,
must call the update_accelerators methods after add the controls.
Additionally, we can remove the 'hierarchy-changed' signal handlers in
This code is called many times at the start of the activity, and later every
time we show or hide a toolbar.

2) Another solution is
I don't like it, but is a fix using the same technique used in
Uses the 'hierarchy-changed' signal to pack the toolbar to the
udating the hierachy of the children and enabling them to setup the
The problem with this approach is the code is executed many times, because
the toolbars
change the parents every time are visible/invisible.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110623/e0fc8e13/attachment.html>

More information about the Sugar-devel mailing list