diff options
author | Manuel QuiƱones <manuq@laptop.org> | 2012-12-18 21:09:48 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-12-20 12:57:51 (GMT) |
commit | ea4cb79fed67e41f695420d8a41dfdacc7bd3212 (patch) | |
tree | 9c8e2c9208f65ee0e2ffe85da63c48f8c177ce38 | |
parent | ac8195dc5d54a502f1926013b3a58bd6c9f1000b (diff) |
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 <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | src/jarabe/frame/clipboardicon.py | 11 |
1 files changed, 7 insertions, 4 deletions
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') |