sugarlabs/sugar — pull request #14 by manuq (2013-04-04 14:57:53+00:00)
Title: Bring back dragging of elements from the activities to the frame clipboa...

...rd - SL #3819

TestCase:

- open an activity like Browse, Read, Log (not Write, is a special case)
- bring up the frame
- drag things to the left side panel of the frame (images, links, or selected text)

The elements should be added to the clipboard which is inside the
panel. They should have the proper icon and they should popup a
palette to act on them.

Note: if the dragged object is a link from Browse, Sugar tries to copy
the html to the disk. But the current implementation looks wrong. I
have opened #4477 to track it: http://bugs.sugarlabs.org/ticket/4477

Note: this doesn't solve the inverse operation: drag from the
clipboard to the activity. This will be done in another patch.

API fixes:

- gtk.SelectionData.type -> Gtk.SelectionData.get_data_type() [1]
- gtk.SelectionData.data -> Gtk.SelectionData.get_data() [2]
- gtk.SelectionData.target -> Gtk.SelectionData.get_target() [3]
- context.targets -> context.list_targets() [4]
- context.drop_finish(...) -> Gdk.drop_finish(context, ...) [5]
- context.drag_status(...) -> Gdk.drag_status(context, ...) [6]
- context.get_source_widget() -> Gdk.drag_get_source_widget(context) [7]

[1] https://developer.gnome.org/gtk3/3.5/gtk3-Selections.html#gtk-selection-data-get-data-type
[2] https://developer.gnome.org/gtk3/3.5/gtk3-Selections.html#gtk-selection-data-get-data
[3] https://developer.gnome.org/gtk3/3.5/gtk3-Selections.html#gtk-selection-data-get-target
[4] https://developer.gnome.org/gdk/stable/gdk-Drag-and-Drop.html#gdk-drag-context-list-targets
[5] https://developer.gnome.org/gdk/stable/gdk-Drag-and-Drop.html#gdk-drop-finish
[6] https://developer.gnome.org/gdk/stable/gdk-Drag-and-Drop.html#gdk-drag-status
[7] https://developer.gnome.org/gtk3/stable/gtk3-Drag-and-Drop.html#gtk-drag-get-source-widget

Cast the type of the Gtk.SelectionData from Gdk.Atom to str. Our code
treats it as str in sugar3.mime and asks methods like startswith which
fails if it is not a str-like object.

The data for the type 'text/uri-list' comes with a character '\x00' at
the end now. Remove it so our functions like
sugar3.mime.split_uri_list don't break.

Signed-off-by: Manuel Quiñones