[latexila] CleanBuildFiles: sort list in alphabetical order



commit 6ccb3bbca6f43c22a9c2ea9e8c1f7df6713e3a5d
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Wed Jun 22 20:23:23 2011 +0200

    CleanBuildFiles: sort list in alphabetical order

 src/clean_build_files.vala |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/clean_build_files.vala b/src/clean_build_files.vala
index f4ae481..adadf76 100644
--- a/src/clean_build_files.vala
+++ b/src/clean_build_files.vala
@@ -177,6 +177,9 @@ public class CleanBuildFiles : GLib.Object
         ListStore store = new ListStore (CleanFileColumn.N_COLUMNS,
             typeof (bool), typeof (string), typeof (File));
 
+        store.set_sort_func (0, on_sort_list_files);
+        store.set_sort_column_id (0, SortType.ASCENDING);
+
         // fill the list
         foreach (File file_to_delete in files_to_delete)
         {
@@ -304,4 +307,15 @@ public class CleanBuildFiles : GLib.Object
         dialog.destroy ();
         return ret;
     }
+
+    private int on_sort_list_files (TreeModel model, TreeIter a, TreeIter b)
+    {
+        string name_a;
+        string name_b;
+
+        model.get (a, CleanFileColumn.NAME, out name_a, -1);
+        model.get (b, CleanFileColumn.NAME, out name_b, -1);
+
+        return name_a.collate (name_b);
+    }
 }



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