[pitivi] Simplify drag'n'drop logic
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Simplify drag'n'drop logic
- Date: Sat, 21 Jul 2012 20:01:48 +0000 (UTC)
commit f7bd462f4419d3e05a0f4b796d59ac1f6ddf7840
Author: Paul Lange <palango gmx de>
Date: Sun Jul 15 20:35:56 2012 +0200
Simplify drag'n'drop logic
pitivi/timeline/layer.py | 6 ------
pitivi/timeline/timeline.py | 8 +++-----
2 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 37791c4..d65b80f 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -145,16 +145,10 @@ class BaseLayerControl(gtk.VBox, Loggable):
self.popup.show_all()
# Drag and drop
- self.connect("drag_data_get", self._dragDataGetCb)
self.drag_source_set(gtk.gdk.BUTTON1_MASK,
[LAYER_CONTROL_TUPLE],
gtk.gdk.ACTION_MOVE)
- def _dragDataGetCb(self, widget, context, selection, targetType, eventTime):
- if targetType == TYPE_PITIVI_LAYER_CONTROL:
- selection.set(selection.target, 8,
- str(self._app.gui.timeline_ui.controls.getControlIndex(self)))
-
def getSelected(self):
return self._selected
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 773feaf..9dee3ba 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -512,7 +512,7 @@ class TimelineControls(gtk.VBox, Loggable):
self.priority_block_time = time.time()
# drag'n' drop
- self.connect("drag_data_received", self._dragDataReceivedCb)
+ self.connect("drag_drop", self._dragDropCb)
self.connect("drag_motion", self._dragMotionCb)
self.connect("drag_leave", self._dragLeaveCb)
self.drag_dest_set(gtk.DEST_DEFAULT_MOTION |
@@ -743,13 +743,11 @@ class TimelineControls(gtk.VBox, Loggable):
else:
current_y += child.getHeight()
- def _dragDataReceivedCb(self, widget, context, x, y, selection,
- targetType, time):
+ def _dragDropCb(self, widget, context, x, y, time):
"""
Handles received drag data to reorder layers
"""
- # get the moved control widget
- widget = self.getControlFromId(int(selection.data))
+ widget = context.get_source_widget()
widget_type = type(widget)
self._unhighlightSeparators()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]