From b4c8ac13f3dfb90957412ff95cf31e5aa20c1eed Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Fri, 06 Jul 2007 16:24:23 +0000 Subject: Some clipboard fixes. --- (limited to 'shell') diff --git a/shell/view/clipboardmenu.py b/shell/view/clipboardmenu.py index 648442a..17df779 100644 --- a/shell/view/clipboardmenu.py +++ b/shell/view/clipboardmenu.py @@ -122,10 +122,12 @@ class ClipboardMenu(Palette): obj = cb_service.get_object(self._object_id) formats = obj['FORMATS'] if len(formats) == 0: + logging.warning('ClipboardMenu._open_item_activate_cb: Object without data.') return if not self._activity and \ not formats[0] == 'application/vnd.olpc-x-sugar': + logging.warning('ClipboardMenu._open_item_activate_cb: Object without activity.') return uri = cb_service.get_object_data(self._object_id, formats[0])['DATA'] diff --git a/shell/view/frame/clipboardbox.py b/shell/view/frame/clipboardbox.py index e2d0fdf..7cb3698 100644 --- a/shell/view/frame/clipboardbox.py +++ b/shell/view/frame/clipboardbox.py @@ -125,7 +125,7 @@ class ClipboardBox(hippo.CanvasBox): def _object_added_cb(self, cb_service, object_id, name): icon = ClipboardIcon(object_id, name) - icon.connect('activated', self._icon_activated_cb) + icon.connect('button-release-event', self._icon_button_release_event_cb) self._set_icon_selected(icon) self.prepend(icon) @@ -147,24 +147,29 @@ class ClipboardBox(hippo.CanvasBox): clipboard = gtk.Clipboard() if not clipboard.set_with_data(targets, self._clipboard_data_get_cb, - self._clipboard_clear_cb): + self._clipboard_clear_cb, + targets): logging.error('GtkClipboard.set_with_data failed!') else: self._owns_clipboard = True - def _clipboard_data_get_cb(self, clipboard, selection, info, data): + def _clipboard_data_get_cb(self, clipboard, selection, info, targets): + if not selection.target in [target[0] for target in targets]: + logging.warning('ClipboardBox._clipboard_data_get_cb: asked %s but' \ + ' only have %r.' % (selection.target, targets)) + return object_id = self._selected_icon.get_object_id() cb_service = clipboardservice.get_instance() data = cb_service.get_object_data(object_id, selection.target)['DATA'] selection.set(selection.target, 8, data) - def _clipboard_clear_cb(self, clipboard, data): + def _clipboard_clear_cb(self, clipboard, targets): logging.debug('ClipboardBox._clipboard_clear_cb') self._owns_clipboard = False - def _icon_activated_cb(self, icon): - logging.debug('ClipboardBox._icon_activated_cb') + def _icon_button_release_event_cb(self, icon, event): + logging.debug('ClipboardBox._icon_button_release_event_cb: %r' % icon.props.selected) if not icon.props.selected: self._set_icon_selected(icon) @@ -238,7 +243,7 @@ class ClipboardBox(hippo.CanvasBox): self._press_start_x = event.x self._press_start_y = event.y - return True; + return False def motion_notify_event_cb(self, widget, event): -- cgit v0.9.1