[gtk+] placesview: sort by path



commit 0dff2485165b13a7dd7264aff64a7dcce6e6bb5d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Aug 10 15:33:34 2015 -0300

    placesview: sort by path
    
    As pointed out by Cosimo, we should sort the
    items according to their path.

 gtk/gtkplacesview.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c
index 04082d2..ca02fe0 100644
--- a/gtk/gtkplacesview.c
+++ b/gtk/gtkplacesview.c
@@ -1717,11 +1717,27 @@ listbox_sort_func (GtkListBoxRow *row1,
 {
   gboolean row1_is_network;
   gboolean row2_is_network;
+  gchar *location1;
+  gchar *location2;
+  gint retval;
 
   row1_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row1), "is-network"));
   row2_is_network = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row2), "is-network"));
 
-  return row1_is_network - row2_is_network;
+  retval = row1_is_network - row2_is_network;
+
+  if (retval != 0)
+    return retval;
+
+  g_object_get (row1, "path", &location1, NULL);
+  g_object_get (row2, "path", &location2, NULL);
+
+  retval = g_strcmp0 (location1, location2);
+
+  g_free (location1);
+  g_free (location2);
+
+  return retval;
 }
 
 static void


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