Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEben Eliason <eben@sugar.(none)>2008-10-18 21:36:46 (GMT)
committer Eben Eliason <eben@sugar.(none)>2008-10-18 21:36:46 (GMT)
commit2b2b89807eb69ab1a04a620d0cbdb89231ee4e6a (patch)
tree89ab59984a6ff6df745464ea6a5f9b9bde0e555e /src
parentf9cab470200731f826dfe849c3715991bf6ef879 (diff)
Prevent duplicate clippings on drag within clipboard (#8606)
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/frame/clipboardtray.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/jarabe/frame/clipboardtray.py b/src/jarabe/frame/clipboardtray.py
index 9367441..40f0a32 100644
--- a/src/jarabe/frame/clipboardtray.py
+++ b/src/jarabe/frame/clipboardtray.py
@@ -125,8 +125,13 @@ class ClipboardTray(tray.VTray):
def drag_motion_cb(self, widget, context, x, y, time):
logging.debug('ClipboardTray._drag_motion_cb')
- context.drag_status(gtk.gdk.ACTION_COPY, time)
- self.props.drag_active = True
+
+ if self._internal_drag(context):
+ context.drag_status(gtk.gdk.ACTION_MOVE, time)
+ else:
+ context.drag_status(gtk.gdk.ACTION_COPY, time)
+ self.props.drag_active = True
+
return True
def drag_leave_cb(self, widget, context, time):
@@ -134,6 +139,13 @@ class ClipboardTray(tray.VTray):
def drag_drop_cb(self, widget, context, x, y, time):
logging.debug('ClipboardTray._drag_drop_cb')
+
+ if self._internal_drag(context):
+ # TODO: We should move the object within the clipboard here
+ if not self._context_map.has_context(context):
+ context.drop_finish(False, gtk.get_current_event_time())
+ return False
+
cb_service = clipboard.get_instance()
object_id = cb_service.add_object(name="")
@@ -195,3 +207,10 @@ class ClipboardTray(tray.VTray):
if not self._context_map.has_context(context):
context.drop_finish(True, gtk.get_current_event_time())
+ def _internal_drag(self, context):
+ view_ancestor = context.get_source_widget().get_ancestor(gtk.Viewport)
+ if view_ancestor is self._viewport:
+ return True
+ else:
+ return False
+