2005-10-27 [wwp] 1.9.15cvs123
authorTristan Chabredier <wwp@claws-mail.org>
Thu, 27 Oct 2005 14:04:39 +0000 (14:04 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Thu, 27 Oct 2005 14:04:39 +0000 (14:04 +0000)
* src/prefs_themes.c
sort list of themes names in themes prefs

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/prefs_themes.c

index 554c0a2..c4dd653 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-27 [wwp]       1.9.15cvs123
+
+       * src/prefs_themes.c
+               sort list of themes names in themes prefs
+
 2005-10-27 [paul]      1.9.15cvs122
 
        * src/folder.c
index d4f4664..1e11e3d 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.77 -r 1.274.2.78 src/mainwindow.c;  cvs diff -u -r 1.395.2.142 -r 1.395.2.143 src/summaryview.c;  ) > 1.9.15cvs120.patchset
 ( cvs diff -u -r 1.395.2.143 -r 1.395.2.144 src/summaryview.c;  cvs diff -u -r 1.1.4.11 -r 1.1.4.12 src/gtk/gtksctree.c;  ) > 1.9.15cvs121.patchset
 ( cvs diff -u -r 1.213.2.67 -r 1.213.2.68 src/folder.c;  cvs diff -u -r 1.105.2.40 -r 1.105.2.41 src/prefs_account.c;  ) > 1.9.15cvs122.patchset
+( cvs diff -u -r 1.3.2.31 -r 1.3.2.32 src/prefs_themes.c;  ) > 1.9.15cvs123.patchset
index fbe7383..17f930a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=15
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=122
+EXTRA_VERSION=123
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index d54b33e..3ae9935 100644 (file)
@@ -139,6 +139,7 @@ static void prefs_themes_display_global_stats       (const ThemesData *tdata);
 static void prefs_themes_get_theme_info         (ThemesData *tdata);
 static void prefs_themes_display_theme_info     (ThemesData *tdata, const ThemeInfo *info);
 static void prefs_themes_get_themes_and_names  (ThemesData *tdata);
+static int prefs_themes_cmp_name(gconstpointer a, gconstpointer b);
 static void prefs_themes_free_names            (ThemesData *tdata);
 
 static void prefs_themes_set_themes_menu       (GtkOptionMenu *opmenu, const ThemesData *tdata);
@@ -265,16 +266,29 @@ static void prefs_themes_set_themes_menu(GtkOptionMenu *opmenu, const ThemesData
        GtkWidget *menu;
        GtkWidget *item;
        gint       i = 0, active = 0;
+       GList     *sorted_list = NULL;
 
        g_return_if_fail(opmenu != NULL);
-       
+
        gtk_option_menu_remove_menu(opmenu);
-       
+
+       /* sort theme data list by data name */
        menu = gtk_menu_new ();
+       while (themes != NULL) {
+               ThemeName *tname = (ThemeName *)(themes->data);
+
+               sorted_list = g_list_insert_sorted(sorted_list, (gpointer)(tname),
+                                                                               (GCompareFunc)prefs_themes_cmp_name);
+
+               themes = g_list_next(themes);
+       }
+
+       /* feed gtk_menu w/ sorted themes names */
+       themes = sorted_list;
        while (themes != NULL) {
                ThemeName *tname = (ThemeName *)(themes->data);
                gchar     *tpath = (gchar *)(tname->item->data);
-               
+
                item = gtk_menu_item_new_with_label(tname->name);
                gtk_widget_show(item);
                g_signal_connect(G_OBJECT(item), "activate",
@@ -284,15 +298,24 @@ static void prefs_themes_set_themes_menu(GtkOptionMenu *opmenu, const ThemesData
 
                if (tdata->displayed != NULL && tdata->displayed == tpath)
                        active = i;
+               ++i;
 
                themes = g_list_next(themes);
-               ++i;
        }
-       
+
+       g_list_free(sorted_list);
+
        gtk_menu_set_active(GTK_MENU(menu), active);
        gtk_option_menu_set_menu (opmenu, menu);
 }
 
+static int prefs_themes_cmp_name(gconstpointer a_p, gconstpointer b_p)
+{
+       /* compare two ThemeData structures by their name attribute */
+       return strcmp2((gchar *)(((ThemeName*)a_p)->name),
+                                       (gchar *)(((ThemeName*)b_p)->name));
+}
+
 static void prefs_themes_get_themes_and_names(ThemesData *tdata)
 {
        GList *tpaths;