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

Simon Schampijer simon at schampijer.de
Fri Apr 20 09:31:46 EDT 2012


On 04/19/2012 04:27 PM, godiard at sugarlabs.org wrote:
> From: Gonzalo Odiard<godiard at gmail.com>
>
> Signed-off-by: Gonzalo Odiard<gonzalo at laptop.org>
> ---
>   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):

Great this works as described in the patch title. Reading [1] I would 
clarify in this patch description the behavior, because if you remove 
all of the clippings currently you can still paste an older entry:

"When an object is removed from the clipboard we will select the last
clipping which is available, this will be used when you paste a 
clipping. This does empty the cache, if you have removed all the 
clippings you can currently still paste an older one."

And then either fix this in here if easy or create a follow up ticket.

Regards,
    Simon

[1] http://bugs.sugarlabs.org/ticket/1266#comment:3


More information about the Sugar-devel mailing list