<div>In my opinion, this can become a source of problems:</div><div><br></div><div><font color="#990000">if target_name == 'text / uri-list'</font></div><div><font color="#990000"><br></font></div><div>I find it best to use just <font color="#990000">get.uris ()</font></div>
<div><br></div><br><div class="gmail_quote">2013/4/10 Manuel Quiñones <span dir="ltr"><<a href="mailto:manuq@laptop.org" target="_blank">manuq@laptop.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
TestCase:<br>
<br>
- open Paint activity, draw something<br>
- go to the Journal<br>
- drag the Paint entry to the Documents drive<br>
- insert a USB stick<br>
- drag the Paint entry to the USB drive<br>
<br>
The paint should be in Documents and in the stick<br>
<br>
Note: this needs the upstream fix<br>
<a href="https://bugzilla.gnome.org/show_bug.cgi?id=692844" target="_blank">https://bugzilla.gnome.org/show_bug.cgi?id=692844</a> which is not in GTK+<br>
3.6 but is added in current olpc builds as gtk3-3.6.4.1.fc18.olpc2.<br>
So it can be tested on an XO.<br>
<br>
Note: this does not fix the unwanted palette popup as described in the<br>
ticket. That will be a separate patch.<br>
<br>
Signed-off-by: Manuel Quiñones <<a href="mailto:manuq@laptop.org">manuq@laptop.org</a>><br>
---<br>
src/jarabe/journal/listmodel.py | 11 +++++++----<br>
src/jarabe/journal/volumestoolbar.py | 2 +-<br>
2 files changed, 8 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/jarabe/journal/listmodel.py b/src/jarabe/journal/listmodel.py<br>
index b98d01c..980db70 100644<br>
--- a/src/jarabe/journal/listmodel.py<br>
+++ b/src/jarabe/journal/listmodel.py<br>
@@ -237,14 +237,17 @@ class ListModel(GObject.GObject, Gtk.TreeModel, Gtk.TreeDragSource):<br>
<br>
def do_drag_data_get(self, path, selection):<br>
uid = self[path][ListModel.COLUMN_UID]<br>
- if selection.target == 'text/uri-list':<br>
+ target_atom = selection.get_target()<br>
+ target_name = <a href="http://target_atom.name" target="_blank">target_atom.name</a>()<br>
+ if target_name == 'text/uri-list':<br>
# Get hold of a reference so the temp file doesn't get deleted<br>
self._temp_drag_file_path = model.get_file(uid)<br>
logging.debug('putting %r in selection', self._temp_drag_file_path)<br>
- selection.set(selection.target, 8, self._temp_drag_file_path)<br>
+ selection.set(target_atom, 8, self._temp_drag_file_path)<br>
return True<br>
- elif selection.target == 'journal-object-id':<br>
- selection.set(selection.target, 8, uid)<br>
+ elif target_name == 'journal-object-id':<br>
+ # uid is unicode but Gtk.SelectionData.set() needs str<br>
+ selection.set(target_atom, 8, str(uid))<br>
return True<br>
<br>
return False<br>
diff --git a/src/jarabe/journal/volumestoolbar.py b/src/jarabe/journal/volumestoolbar.py<br>
index e1e6331..750aea5 100644<br>
--- a/src/jarabe/journal/volumestoolbar.py<br>
+++ b/src/jarabe/journal/volumestoolbar.py<br>
@@ -291,7 +291,7 @@ class BaseButton(RadioToolButton):<br>
<br>
def _drag_data_received_cb(self, widget, drag_context, x, y,<br>
selection_data, info, timestamp):<br>
- object_id = selection_data.data<br>
+ object_id = selection_data.get_data()<br>
metadata = model.get(object_id)<br>
file_path = model.get_file(metadata['uid'])<br>
if not file_path or not os.path.exists(file_path):<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br>
<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></span></blockquote></div><br>