commit 35a356d1e9c15e031e19077fe965a5e4bb7e5ae3
Author: Alan McGovern <[email protected]>
Date: Wed Jun 9 18:49:59 2010 +0100
Correctly compare items when trying to decide if they're in the list or not.
Signed-off-by: Nathaniel McCallum <[email protected]>
bindings/mono/libgpod-sharp/GPodBase.cs | 5 +++++
bindings/mono/libgpod-sharp/GPodList.cs | 7 ++-----
bindings/mono/libgpod-sharp/ITDB.cs | 6 ++++++
3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/bindings/mono/libgpod-sharp/GPodBase.cs
b/bindings/mono/libgpod-sharp/GPodBase.cs
index d1840d3..cae4e7e 100644
--- a/bindings/mono/libgpod-sharp/GPodBase.cs
+++ b/bindings/mono/libgpod-sharp/GPodBase.cs
@@ -47,6 +47,7 @@ namespace GPod {
}*/
interface IGPodBase {
+ IntPtr Native { get; }
void SetBorrowed(bool borrowed);
}
@@ -91,6 +92,10 @@ namespace GPod {
get { return HandleRef.ToIntPtr (Handle); }
}
+ IntPtr IGPodBase.Native {
+ get { return Native; }
+ }
+
public HandleRef Handle;
protected bool Borrowed;
diff --git a/bindings/mono/libgpod-sharp/GPodList.cs
b/bindings/mono/libgpod-sharp/GPodList.cs
index e18fd1f..df553c0 100644
--- a/bindings/mono/libgpod-sharp/GPodList.cs
+++ b/bindings/mono/libgpod-sharp/GPodList.cs
@@ -55,16 +55,13 @@ namespace GPod {
IEnumerator IEnumerable.GetEnumerator() { return
GetEnumerator(); }
public bool Contains(T item) {
- foreach (object o in list)
- if (o.Equals(item))
- return true;
- return false;
+ return IndexOf (item) != -1;
}
public int IndexOf(T item) {
int i = 0;
foreach (T t in this) {
- if (t.Equals(item))
+ if (object.ReferenceEquals (t, item) ||
t.Native == item.Native)
return i;
i++;
}
diff --git a/bindings/mono/libgpod-sharp/ITDB.cs
b/bindings/mono/libgpod-sharp/ITDB.cs
index 4b49dcb..8392a16 100644
--- a/bindings/mono/libgpod-sharp/ITDB.cs
+++ b/bindings/mono/libgpod-sharp/ITDB.cs
@@ -108,6 +108,12 @@ namespace GPod {
return res;
}
+ public static string GetLocalPath (string mountPoint, Track
track)
+ {
+ string ipodPath = track.IpodPath.Replace (":",
"/").Substring (1);
+ return System.IO.Path.Combine (mountPoint, ipodPath);
+ }
+
public static string GetDestFileName (string mountpoint, string
localFile)
{
// itdb_cp_get_dest_filename (HandleRef track, string
mountpoint, string filename, ref IntPtr error);
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2