[banshee] Get deterministic source sort w/ UniqueId fallback



commit 3c19f3fd60721d7742c80fc1391781f752ad8d0e
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Fri Jun 5 12:47:58 2009 -0500

    Get deterministic source sort w/ UniqueId fallback
---
 .../Banshee.Sources/SourceSortType.cs              |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/Core/Banshee.Services/Banshee.Sources/SourceSortType.cs b/src/Core/Banshee.Services/Banshee.Sources/SourceSortType.cs
index 3e5380b..0dc1a38 100644
--- a/src/Core/Banshee.Services/Banshee.Sources/SourceSortType.cs
+++ b/src/Core/Banshee.Services/Banshee.Sources/SourceSortType.cs
@@ -109,7 +109,12 @@ namespace Banshee.Sources
                 }
 
                 // If still equal, then order by name
-                return name_comparer.Compare (a.Name, b.Name);
+                comp = name_comparer.Compare (a.Name, b.Name);
+                if (comp != 0)
+                    return comp;
+
+                // And if still equal, order by UniqueId, to avoid the order arbitrarily swapping
+                return a.UniqueId.CompareTo (b.UniqueId);
             }
         }
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]