diff src/editors.c @ 1276:4177057ca11b

editor_list_get() now returns a sorted list, this way items appear in the same order in all menus.
author zas_
date Tue, 03 Feb 2009 08:41:21 +0000
parents 8fcdfacce91d
children c5852c543775
line wrap: on
line diff
--- a/src/editors.c	Mon Feb 02 20:32:59 2009 +0000
+++ b/src/editors.c	Tue Feb 03 08:41:21 2009 +0000
@@ -372,10 +372,24 @@
 	*listp = g_list_prepend(*listp, editor);
 }
 
+static gint editor_sort(gconstpointer a, gconstpointer b)
+{
+	const EditorDescription *ea = a;
+	const EditorDescription *eb = b;
+	int ret;
+	
+	ret = strcmp(ea->menu_path, eb->menu_path);
+	if (ret != 0) return ret;
+	
+	return g_utf8_collate(ea->name, eb->name);
+}
+
 GList *editor_list_get(void)
 {
 	GList *editors_list = NULL;
 	g_hash_table_foreach(editors, editor_list_add_cb, &editors_list);
+	editors_list = g_list_sort(editors_list, editor_sort);
+
 	return editors_list;
 }