Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-07-06 16:24:23 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-07-06 16:24:23 (GMT)
commitb4c8ac13f3dfb90957412ff95cf31e5aa20c1eed (patch)
tree95906af96b221c1557903640f4c4d7978d5db536 /shell
parent0b59c682da57ce9b9034e5469cdacff7dc67a755 (diff)
Some clipboard fixes.
Diffstat (limited to 'shell')
-rw-r--r--shell/view/clipboardmenu.py2
-rw-r--r--shell/view/frame/clipboardbox.py19
2 files changed, 14 insertions, 7 deletions
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):