[gimp] Bug 725734 - Themes not alphabetized



commit 2303ce910d206e9e6f95f1a35eb86fe7a16772f4
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 6 11:56:18 2014 +0100

    Bug 725734 - Themes not alphabetized
    
    qsort() the array returned by themes_list_themes().

 app/gui/themes.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/app/gui/themes.c b/app/gui/themes.c
index 4c6f56a..dba1036 100644
--- a/app/gui/themes.c
+++ b/app/gui/themes.c
@@ -19,6 +19,7 @@
 
 #include <errno.h>
 #include <stdarg.h>
+#include <stdlib.h>
 
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
@@ -46,6 +47,8 @@ static void   themes_directories_foreach (const GimpDatafileData *file_data,
 static void   themes_list_themes_foreach (gpointer                key,
                                           gpointer                value,
                                           gpointer                data);
+static gint   themes_name_compare        (const void             *p1,
+                                          const void             *p2);
 static void   themes_theme_change_notify (GimpGuiConfig          *config,
                                           GParamSpec             *pspec,
                                           Gimp                   *gimp);
@@ -135,6 +138,8 @@ themes_list_themes (Gimp *gimp,
 
       g_hash_table_foreach (themes_hash, themes_list_themes_foreach, &index);
 
+      qsort (themes, *n_themes, sizeof (gchar *), themes_name_compare);
+
       return themes;
     }
 
@@ -304,6 +309,13 @@ themes_list_themes_foreach (gpointer key,
   (*index)++;
 }
 
+static gint
+themes_name_compare (const void *p1,
+                     const void *p2)
+{
+  return strcmp (* (char **) p1, * (char **) p2);
+}
+
 static void
 themes_theme_change_notify (GimpGuiConfig *config,
                             GParamSpec    *pspec,


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