From ea4cb79fed67e41f695420d8a41dfdacc7bd3212 Mon Sep 17 00:00:00 2001 From: Manuel QuiƱones Date: Tue, 18 Dec 2012 21:09:48 +0000 Subject: ClipboardIcon: API fixes for the Gtk.Clipboard set_with_data get_func callback - SL #4307 - Gtk.SelectionData, selection.get_target() instead of selection.target - Gtk.TargetEntry, target.target instead of target[0] - Gtk.TargetEntry.target is a string representation of the target type, so to compare them with the selection target, which is a Gdk.Atom [1], we need to convert the latter to str like: str(selection.get_target()) [1] http://developer.gnome.org/gtk3/stable/gtk3-Selections.html#GtkSelectionData-struct Signed-off-by: Manuel QuiƱones Acked-by: Simon Schampijer --- diff --git a/src/jarabe/frame/clipboardicon.py b/src/jarabe/frame/clipboardicon.py index b3fdccc..26af595 100644 --- a/src/jarabe/frame/clipboardicon.py +++ b/src/jarabe/frame/clipboardicon.py @@ -99,12 +99,15 @@ class ClipboardIcon(RadioToolButton): self.owns_clipboard = True def _clipboard_data_get_cb(self, x_clipboard, selection, info, targets): - if not selection.target in [target[0] for target in targets]: + selection_target = selection.get_target() + entries_targets = [entry.target for entry in targets] + if not str(selection_target) in entries_targets: logging.warning('ClipboardIcon._clipboard_data_get_cb: asked %s' \ - ' but only have %r.', selection.target, targets) + ' but only have %r.', selection_target, + entries_targets) return - data = self._cb_object.get_formats()[selection.target].get_data() - selection.set(selection.target, 8, data) + data = self._cb_object.get_formats()[str(selection_target)].get_data() + selection.set(selection_target, 8, data) def _clipboard_clear_cb(self, x_clipboard, targets): logging.debug('ClipboardIcon._clipboard_clear_cb') -- cgit v0.9.1