diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2012-01-26 21:06:23 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2012-04-20 12:46:57 (GMT) |
commit | 255ba0baa95e405cf0c85b4eccd798e364b2f957 (patch) | |
tree | 0d78d9ecf52c474cd08a9aeae6f37daab2c94207 | |
parent | 70c26fe47618d0e07d3e7925abdd1a053469be03 (diff) |
Only add a group of selections to the clipboard if there are anything available. -v2
This problem is affecting Text to Speech with Write activity,
because there are only a selection in the secondary clipboard
but a icon is displayed in the frame without anything selected.
v2: Addressed comments from Sasha, add a line and do patch with -U4 option
Signed-off-by: Gonzalo Odiard
Acked-by: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r-- | src/jarabe/frame/clipboardpanelwindow.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/jarabe/frame/clipboardpanelwindow.py b/src/jarabe/frame/clipboardpanelwindow.py index aefec7b..b73572e 100644 --- a/src/jarabe/frame/clipboardpanelwindow.py +++ b/src/jarabe/frame/clipboardpanelwindow.py @@ -56,10 +56,9 @@ class ClipboardPanelWindow(FrameWindow): return cb_service = clipboard.get_instance() - key = cb_service.add_object(name="") - cb_service.set_object_percent(key, percent=0) targets = x_clipboard.wait_for_targets() + cb_selections = [] for target in targets: if target not in ('TIMESTAMP', 'TARGETS', 'MULTIPLE', 'SAVE_TARGETS'): @@ -68,9 +67,14 @@ class ClipboardPanelWindow(FrameWindow): if not selection: logging.warning('no data for selection target %s.', target) continue - self._add_selection(key, selection) + cb_selections.append(selection) - cb_service.set_object_percent(key, percent=100) + if len(cb_selections) > 0: + key = cb_service.add_object(name="") + cb_service.set_object_percent(key, percent=0) + for selection in cb_selections: + self._add_selection(key, selection) + cb_service.set_object_percent(key, percent=100) def _add_selection(self, key, selection): if not selection.data: |