[genius] Fri Sep 05 13:01:51 2014 Jiri (George) Lebl <jirka 5z com>



commit abc8353f313662bd1ed98b90ad1aa0264e0736e3
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Fri Sep 5 13:01:54 2014 -0500

    Fri Sep 05 13:01:51 2014  Jiri (George) Lebl <jirka 5z com>
    
        * src/tutors.c: sort the tutors by category and then name.

 ChangeLog    |    4 ++++
 src/tutors.c |   12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b53953d..5cc66b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Sep 05 13:01:51 2014  Jiri (George) Lebl <jirka 5z com>
+
+       * src/tutors.c: sort the tutors by category and then name.
+
 Fri Sep 05 12:56:05 2014  Jiri (George) Lebl <jirka 5z com>
 
        * tutors/*.gel: Add a few more tutorials (lorenz, finite difference
diff --git a/src/tutors.c b/src/tutors.c
index 4075723..81b233d 100644
--- a/src/tutors.c
+++ b/src/tutors.c
@@ -155,6 +155,15 @@ read_tutors_from_dir (const char *dir_name)
        closedir (dir);
 }
 
+static int
+compare_tutors (GelTutorial *a, GelTutorial *b)
+{
+       int s = strcmp (a->category, b->category);
+       if (s != 0)
+               return s;
+       return strcmp (a->name, b->name);
+}
+
 void
 gel_read_tutor_list (void)
 {
@@ -178,5 +187,6 @@ gel_read_tutor_list (void)
        g_free (dir_name);
 
        /* FIXME: should do more */
-       gel_tutor_list = g_slist_reverse (gel_tutor_list);
+       gel_tutor_list = g_slist_sort (gel_tutor_list,
+                                      compare_tutors);
 }


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