[Xfce4-commits] [apps/xfce4-notifyd] 01/01: Settings Dialog: Sort the themes alphabetically

noreply at xfce.org noreply at xfce.org
Fri Sep 9 23:28:00 CEST 2016


This is an automated email from the git hooks/post-receive script.

ochosi pushed a commit to branch master
in repository apps/xfce4-notifyd.

commit 7152f48b200ccb515948bf5f3936334916bc2526
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Fri Sep 9 23:27:10 2016 +0200

    Settings Dialog: Sort the themes alphabetically
---
 xfce4-notifyd-config/main.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/xfce4-notifyd-config/main.c b/xfce4-notifyd-config/main.c
index 61b8c85..38ad7e0 100644
--- a/xfce4-notifyd-config/main.c
+++ b/xfce4-notifyd-config/main.c
@@ -150,6 +150,7 @@ list_store_add_themes_in_dir(GtkListStore *ls,
     GDir *dir;
     const gchar *file;
     gchar *filename;
+    gchar *old_filename = NULL;
 
     dir = g_dir_open(path, 0, NULL);
     if(!dir)
@@ -162,10 +163,18 @@ list_store_add_themes_in_dir(GtkListStore *ls,
         filename =
             g_build_filename(path, file, "xfce-notify-4.0", "gtk.css", NULL);
 
-        if(g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
+        if (g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
             GtkTreeIter iter;
+            if (old_filename != NULL) {
+                if (g_ascii_strcasecmp (old_filename, filename) < 0)
+                    gtk_list_store_append(ls, &iter);
+                else
+                    gtk_list_store_prepend(ls, &iter);
+                g_free (old_filename);
+            }
+            else
+                gtk_list_store_append(ls, &iter);
 
-            gtk_list_store_append(ls, &iter);
             gtk_list_store_set(ls, &iter, 0, file, -1);
             g_hash_table_insert(themes_seen, g_strdup(file),
                                 GUINT_TO_POINTER(1));
@@ -174,8 +183,10 @@ list_store_add_themes_in_dir(GtkListStore *ls,
                 memcpy(current_theme_iter, &iter, sizeof(iter));
         }
 
+        old_filename = g_strdup (filename);
         g_free(filename);
     }
+    g_free (old_filename);
 
     g_dir_close(dir);
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list