[gtk+/gtk-3-14] places sidebar: compare bookmarks by index



commit 3df5b52148a03e0692ef2c83c817bdc56670bd14
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Mar 4 17:12:40 2015 -0300

    places sidebar: compare bookmarks by index
    
    GtkPlacesSidebar applies a sorting function on
    the tree model that does not consider the case
    of bookmarks, which are sorted by their indexes.
    
    By adding the bookmarks corner case and comparing
    then by their indexes, GtkPlacesSidebar can sort
    the bookmarks properly in the order they're saved.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744589

 gtk/gtkplacessidebar.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 57bb59d..ad98c65 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -3828,6 +3828,20 @@ places_sidebar_sort_func (GtkTreeModel *model,
       g_free (name_a);
       g_free (name_b);
     }
+  else if ((place_type_a == place_type_b) &&
+           (place_type_a == PLACES_BOOKMARK))
+    {
+      gint pos_a, pos_b;
+
+      gtk_tree_model_get (model, iter_a,
+                          PLACES_SIDEBAR_COLUMN_INDEX, &pos_a,
+                          -1);
+      gtk_tree_model_get (model, iter_b,
+                          PLACES_SIDEBAR_COLUMN_INDEX, &pos_b,
+                          -1);
+
+      retval = pos_a - pos_b;
+    }
   else if (place_type_a == PLACES_CONNECT_TO_SERVER)
     {
       retval = 1;


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