diff options
author | Manuel QuiƱones <manuq@laptop.org> | 2012-12-18 21:09:48 (GMT) |
---|---|---|
committer | Ajay Garg <ajay@activitycentral.com> | 2012-12-21 16:32:03 (GMT) |
commit | ee374133330bd5b0a9aa6153300381fde3a2da7f (patch) | |
tree | 1f5773d38a70348362298c0d7d94dd9cfd56dcb4 | |
parent | 9abf32d6a0081d34115d1ca91605e473980dc4e8 (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>
Signed-off-by: Ajay Garg <ajay@activitycentral.com>
-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') |