[gtk/wip/otte/listview: 32/161] sortlistmodel: Make sort stable



commit 60878039bfec63965ccaecceb907d8c3414d0e68
Author: Benjamin Otte <otte redhat com>
Date:   Wed Dec 11 01:22:20 2019 +0100

    sortlistmodel: Make sort stable
    
    The sort of the sortlistmodel is now stable with respect to the original
    list model.
    
    That means that if the sorter compares items as equal, the model
    will make sure those items keep the order they were in in the original
    model.
    
    Or in other words: The model guarantees a total order based on the
    item's position in the original model.

 gtk/gtksortlistmodel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gtk/gtksortlistmodel.c b/gtk/gtksortlistmodel.c
index 4b9571a425..cc284e267b 100644
--- a/gtk/gtksortlistmodel.c
+++ b/gtk/gtksortlistmodel.c
@@ -186,7 +186,7 @@ _sort_func (gconstpointer item1,
   {
     case GTK_ORDERING_EQUAL:
     case GTK_ORDERING_INVALID:
-      return 0;
+      return g_sequence_iter_compare (entry1->unsorted_iter, entry2->unsorted_iter);
     case GTK_ORDERING_SMALLER:
       return -1;
     case GTK_ORDERING_LARGER:


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