[Sugar-devel] [PATCH sugar] Fix drag and drop to the clipboard - SL #3811

Manuel Quiñones manuq at laptop.org
Tue Aug 21 01:01:53 EDT 2012


gtk.gdk.DragContext.get_source_widget returns None if the drag is not
made within the same application.  This is enough test to say that
it's not an internal drag.  The gtk.Viewport comparison is left as
fallback.

Signed-off-by: Manuel Quiñones <manuq at laptop.org>
---
 src/jarabe/frame/clipboardtray.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index 37d5e1a..779ffed 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -216,7 +216,10 @@ class ClipboardTray(tray.VTray):
                 context.drop_finish(True, gtk.get_current_event_time())
 
     def _internal_drag(self, context):
-        view_ancestor = context.get_source_widget().get_ancestor(gtk.Viewport)
+        source_widget = context.get_source_widget()
+        if source_widget is None:
+            return False
+        view_ancestor = source_widget.get_ancestor(gtk.Viewport)
         if view_ancestor is self._viewport:
             return True
         else:
-- 
1.7.11.2



More information about the Sugar-devel mailing list