[Sugar-devel] [PATCH 2/2] Bring back dragging of elements from the clipboard to the activities - SL #4485
Manuel Quiñones
manuq at laptop.org
Wed Apr 10 07:58:49 EDT 2013
This is another API fix for code not yet ported to GTK+3, similar
to #3819:
- gtk.SelectionData.type -> Gtk.SelectionData.get_data_type()
- context.set_icon_pixbuf() -> Gtk.drag_set_icon_pixbuf(context, ...) [2]
[1] https://developer.gnome.org/gtk3/3.5/gtk3-Selections.html#gtk-selection-data-get-data-type
[2] https://developer.gnome.org/gtk3/stable/gtk3-Drag-and-Drop.html#gtk-drag-set-icon-pixbuf
Signed-off-by: Manuel Quiñones <manuq at laptop.org>
---
src/jarabe/frame/clipboardicon.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/jarabe/frame/clipboardicon.py b/src/jarabe/frame/clipboardicon.py
index 26af595..63ed2e3 100644
--- a/src/jarabe/frame/clipboardicon.py
+++ b/src/jarabe/frame/clipboardicon.py
@@ -75,10 +75,11 @@ class ClipboardIcon(RadioToolButton):
def _drag_data_get_cb(self, widget, context, selection, target_type,
event_time):
- logging.debug('_drag_data_get_cb: requested target %s',
- selection.target)
- data = self._cb_object.get_formats()[selection.target].get_data()
- selection.set(selection.target, 8, data)
+ target_atom = selection.get_target()
+ target_name = target_atom.name()
+ logging.debug('_drag_data_get_cb: requested target %s', target_name)
+ data = self._cb_object.get_formats()[target_name].get_data()
+ selection.set(target_atom, 8, data)
def _put_in_clipboard(self):
logging.debug('ClipboardIcon._put_in_clipboard')
@@ -161,8 +162,8 @@ class ClipboardIcon(RadioToolButton):
icon_theme = Gtk.IconTheme.get_default()
pixbuf = icon_theme.load_icon(self._icon.props.icon_name,
style.STANDARD_ICON_SIZE, 0)
- context.set_icon_pixbuf(pixbuf, hot_x=pixbuf.props.width / 2,
- hot_y=pixbuf.props.height / 2)
+ Gtk.drag_set_icon_pixbuf(context, pixbuf, hot_x=pixbuf.props.width / 2,
+ hot_y=pixbuf.props.height / 2)
def _notify_active_cb(self, widget, pspec):
if self.props.active:
--
1.8.1.4
More information about the Sugar-devel
mailing list