[Sugar-devel] [PATCH] When a object is removed from the clipboard try, select the last available v2 - SL #1266
godiard at sugarlabs.org
godiard at sugarlabs.org
Fri Apr 20 15:56:39 EDT 2012
From: Gonzalo Odiard <godiard at gmail.com>
v2: If there no more objects in the try, clean the clipboard
Signed-off-by: Gonzalo Odiard <gonzalo at laptop.org>
---
src/jarabe/frame/clipboardtray.py | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index f736295..f6e7f94 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -124,6 +124,14 @@ 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
+ else:
+ gtk_clipboard = gtk.Clipboard()
+ gtk_clipboard.clear()
logging.debug('ClipboardTray: %r was deleted', object_id)
def _object_selected_cb(self, cb_service, object_id):
--
1.7.7.6
More information about the Sugar-devel
mailing list