[pitivi] medialibrary: Make sure the comparator for the media library model is strict



commit f286d4b62b76fed24de50f07d2a9e934516df303
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sat Mar 1 16:43:13 2014 +0100

    medialibrary: Make sure the comparator for the media library model is strict

 pitivi/medialibrary.py |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 46f3be9..2aa3086 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -312,11 +312,15 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
         """
         Compare the model elements identified by the L{Gtk.TreeIter} elements.
         """
-        a_basename = GLib.path_get_basename(model[iter1][COL_URI]).lower()
-        b_basename = GLib.path_get_basename(model[iter2][COL_URI]).lower()
-        if a_basename < b_basename:
+        uri1 = model[iter1][COL_URI]
+        uri2 = model[iter2][COL_URI]
+        basename1 = GLib.path_get_basename(uri1).lower()
+        basename2 = GLib.path_get_basename(uri2).lower()
+        if basename1 < basename2:
             return -1
-        # Each element is unique, there is a strict order.
+        if basename1 == basename2:
+            if uri1 < uri2:
+                return -1
         return 1
 
     def getAssetForUri(self, uri):


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