Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/frame/clipboardmenu.py
diff options
context:
space:
mode:
authorManuel QuiƱones <manuq@laptop.org>2013-04-03 01:56:05 (GMT)
committer Ajay Garg <ajay@activitycentral.com>2013-04-13 04:03:30 (GMT)
commit53dbc344b80f08035aa8e22843c9ba5e2c889358 (patch)
treefdb8f4faada0edafb098c62504843437e415b5eb /src/jarabe/frame/clipboardmenu.py
parent68c4b7b65e26894390e7f4498b16f52cabeb2cbe (diff)
Bring back dragging of elements from the activities to the frame clipboard - 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().name() [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 The type of Gtk.SelectionData now comes as a Gdk.Atom instead of string. We use the name of the type to keep our code working. The data for the type 'text/uri-list' comes with a character '\x00' at the end now. But using SelectionData.get_uris() returns a proper list (thanks to Flavio Danesse for the recommendation). So we can use that list instead of doing selection.get_data().split('\n') or sugar3.mime.split_uri_list (which could be obsolete now). In fact, this change was made a while ago in clipboardpanelwindow.py, but not in clipboardtray.py. See commit f0d194f3 . Signed-off-by: Manuel QuiƱones <manuq@laptop.org> Signed-off-by: Ajay Garg <ajay@activitycentral.com>
Diffstat (limited to 'src/jarabe/frame/clipboardmenu.py')
-rw-r--r--src/jarabe/frame/clipboardmenu.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/jarabe/frame/clipboardmenu.py b/src/jarabe/frame/clipboardmenu.py
index e6766fb..eef3861 100644
--- a/src/jarabe/frame/clipboardmenu.py
+++ b/src/jarabe/frame/clipboardmenu.py
@@ -195,7 +195,7 @@ class ClipboardMenu(Palette):
transfer_ownership = False
if most_significant_mime_type == 'text/uri-list':
- uris = mime.split_uri_list(format_.get_data())
+ uris = format_.get_uris()
if len(uris) == 1 and uris[0].startswith('file://'):
parsed_url = urlparse.urlparse(uris[0])
file_path = parsed_url.path # pylint: disable=E1101
@@ -207,7 +207,7 @@ class ClipboardMenu(Palette):
mime_type = 'text/uri-list'
else:
if format_.is_on_disk():
- parsed_url = urlparse.urlparse(format_.get_data())
+ parsed_url = urlparse.urlparse(format_.get_uris()[0])
file_path = parsed_url.path # pylint: disable=E1101
transfer_ownership = False
mime_type = mime.get_for_file(file_path)