[longomatch/redesign3: 10/156] Make use of the new API in the playlists
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch/redesign3: 10/156] Make use of the new API in the playlists
- Date: Wed, 17 Aug 2011 22:17:01 +0000 (UTC)
commit d1d8a2cd9936600397184e418dde131e4f195958
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sun Nov 21 16:23:19 2010 +0100
Make use of the new API in the playlists
LongoMatch/Playlist/IPlayList.cs | 21 ++++++++++++++++-----
LongoMatch/Playlist/PlayList.cs | 30 +++++++++++++++---------------
2 files changed, 31 insertions(+), 20 deletions(-)
---
diff --git a/LongoMatch/Playlist/IPlayList.cs b/LongoMatch/Playlist/IPlayList.cs
index 8996983..095c695 100644
--- a/LongoMatch/Playlist/IPlayList.cs
+++ b/LongoMatch/Playlist/IPlayList.cs
@@ -31,16 +31,27 @@ namespace LongoMatch.Playlist {
get;
}
void Load(string path);
+
void Save(string path);
- void Add(PlayListTimeNode plNode);
- void Remove(PlayListTimeNode plNode);
- PlayListTimeNode Next();
- PlayListTimeNode Prev();
- PlayListTimeNode Select(int index);
+
+ void Add(PlayListPlay play);
+
+ void Remove(PlayListPlay play);
+
+ PlayListPlay Next();
+
+ PlayListPlay Prev();
+
+ PlayListPlay Select(int index);
+
int GetCurrentIndex();
+
bool HasNext();
+
bool HasPrev();
+
ListStore GetModel();
+
IPlayList Copy();
}
}
diff --git a/LongoMatch/Playlist/PlayList.cs b/LongoMatch/Playlist/PlayList.cs
index 517dc2f..b3415bd 100644
--- a/LongoMatch/Playlist/PlayList.cs
+++ b/LongoMatch/Playlist/PlayList.cs
@@ -34,7 +34,7 @@ namespace LongoMatch.Playlist
public class PlayList: IPlayList
{
- private List<PlayListTimeNode> list;
+ private List<PlayListPlay> list;
private static XmlSerializer ser;
private string filename = null;
private int indexSelection = 0;
@@ -42,18 +42,18 @@ namespace LongoMatch.Playlist
#region Constructors
public PlayList() {
- ser = new XmlSerializer(typeof(List<PlayListTimeNode>),new Type[] {typeof(PlayListTimeNode)});
- list = new List<PlayListTimeNode>();
+ ser = new XmlSerializer(typeof(List<PlayListPlay>),new Type[] {typeof(PlayListPlay)});
+ list = new List<PlayListPlay>();
version = new Version(1,0);
}
public PlayList(string file)
{
- ser = new XmlSerializer(typeof(List<PlayListTimeNode>),new Type[] {typeof(PlayListTimeNode)});
+ ser = new XmlSerializer(typeof(List<PlayListPlay>),new Type[] {typeof(PlayListPlay)});
//For new Play List
if (!System.IO.File.Exists(file)) {
- list = new List<PlayListTimeNode>();
+ list = new List<PlayListPlay>();
filename = file;
}
else
@@ -90,13 +90,13 @@ namespace LongoMatch.Playlist
using(FileStream strm = new FileStream(file, FileMode.Open, FileAccess.Read))
{
try {
- list = ser.Deserialize(strm) as List<PlayListTimeNode>;
+ list = ser.Deserialize(strm) as List<PlayListPlay>;
}
catch {
throw new Exception(Catalog.GetString("The file you are trying to load is not a valid playlist"));
}
}
- foreach (PlayListTimeNode plNode in list) {
+ foreach (PlayListPlay plNode in list) {
plNode.Valid = System.IO.File.Exists(plNode.MediaFile.FilePath);
}
filename = file;
@@ -122,30 +122,30 @@ namespace LongoMatch.Playlist
return indexSelection;
}
- public PlayListTimeNode Next() {
+ public PlayListPlay Next() {
if (HasNext())
indexSelection++;
return list[indexSelection];
}
- public PlayListTimeNode Prev() {
+ public PlayListPlay Prev() {
if (HasPrev())
indexSelection--;
return list[indexSelection];
}
- public void Add(PlayListTimeNode plNode) {
+ public void Add(PlayListPlay plNode) {
list.Add(plNode);
}
- public void Remove(PlayListTimeNode plNode) {
+ public void Remove(PlayListPlay plNode) {
list.Remove(plNode);
if (GetCurrentIndex() >= list.Count)
indexSelection --;
}
- public PlayListTimeNode Select(int index) {
+ public PlayListPlay Select(int index) {
indexSelection = index;
return list[index];
}
@@ -159,8 +159,8 @@ namespace LongoMatch.Playlist
}
public ListStore GetModel() {
- Gtk.ListStore listStore = new ListStore(typeof(PlayListTimeNode));
- foreach (PlayListTimeNode plNode in list) {
+ Gtk.ListStore listStore = new ListStore(typeof(PlayListPlay));
+ foreach (PlayListPlay plNode in list) {
listStore.AppendValues(plNode);
}
return listStore;
@@ -172,7 +172,7 @@ namespace LongoMatch.Playlist
listStore.GetIterFirst(out iter);
list.Clear();
while (listStore.IterIsValid(iter)) {
- list.Add(listStore.GetValue(iter, 0) as PlayListTimeNode);
+ list.Add(listStore.GetValue(iter, 0) as PlayListPlay);
listStore.IterNext(ref iter);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]