[longomatch] Fix moving playlists element
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix moving playlists element
- Date: Fri, 14 Dec 2012 20:18:06 +0000 (UTC)
commit 2da57ced84e4f52549e37dcdc6873cdd0ca2bf72
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Dec 14 21:11:55 2012 +0100
Fix moving playlists element
Closes #690012
LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs b/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs
index bdedd50..53a23c8 100644
--- a/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs
+++ b/LongoMatch.GUI/Gui/TreeView/PlayListTreeView.cs
@@ -41,8 +41,8 @@ namespace LongoMatch.Gui.Component
IPlayList playlist;
PlayListPlay loadedPlay = null; //The play currently loaded in the player
PlayListPlay selectedPlay = null; //The play selected in the tree
+ int preDragPos = 0;
TreeIter selectedIter;
- TreePath pathIn, pathOut;
public event ApplyCurrentRateHandler ApplyCurrentRate;
@@ -158,15 +158,28 @@ namespace LongoMatch.Gui.Component
protected override void OnDragBegin (DragContext context)
{
- pathIn = Selection.GetSelectedRows()[0];
+ Model.GetIter(out selectedIter, Selection.GetSelectedRows()[0]);
+ selectedPlay = (PlayListPlay) Model.GetValue(selectedIter, 0);
+ preDragPos = Model.GetPath(selectedIter).Indices[0];
+ Console.WriteLine (Model.GetPath(selectedIter));
base.OnDragBegin (context);
}
protected override void OnDragEnd (DragContext context)
{
+ TreeIter iter;
+ int postDragPos = -1;
+
+ Model.GetIterFirst (out iter);
+ do {
+ if (Model.GetValue (iter, 0) == selectedPlay) {
+ postDragPos = Model.GetPath (iter).Indices[0];
+ break;
+ }
+ } while (Model.IterNext(ref iter));
+
+ playlist.Reorder(preDragPos, postDragPos);
base.OnDragEnd (context);
- pathOut = Selection.GetSelectedRows()[0];
- playlist.Reorder(pathIn.Indices[0], pathOut.Indices[0]);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]