SF.net SVN: geany:[5591] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Tue Mar 15 16:52:13 UTC 2011


Revision: 5591
          http://geany.svn.sourceforge.net/geany/?rev=5591&view=rev
Author:   colombanw
Date:     2011-03-15 16:52:12 +0000 (Tue, 15 Mar 2011)

Log Message:
-----------
Restore sorting order of plugins configuration tabs (broke by me in r5586)

Now simply insert elements in sorted order rather than sorting the
list at a later point: it's simpler, cleaner and probably faster.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/plugins.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-03-15 16:51:47 UTC (rev 5590)
+++ trunk/ChangeLog	2011-03-15 16:52:12 UTC (rev 5591)
@@ -3,6 +3,8 @@
  * src/templates.c, src/templates.h:
    Use the same indentation for all templates (part of FR#3193527; from
    a patch by Matthew Brush, thanks).
+ * src/plugins.c:
+   Always keep the list of loaded plugin sorted by name.
 
 
 2011-03-12  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2011-03-15 16:51:47 UTC (rev 5590)
+++ trunk/src/plugins.c	2011-03-15 16:52:12 UTC (rev 5591)
@@ -554,6 +554,15 @@
 }
 
 
+static gint cmp_plugin_names(gconstpointer a, gconstpointer b)
+{
+	const Plugin *pa = a;
+	const Plugin *pb = b;
+
+	return strcmp(pa->info.name, pb->info.name);
+}
+
+
 static void
 plugin_init(Plugin *plugin)
 {
@@ -607,8 +616,10 @@
 	if (callbacks)
 		add_callbacks(plugin, callbacks);
 
-	/* remember which plugins are active */
-	active_plugin_list = g_list_prepend(active_plugin_list, plugin);
+	/* remember which plugins are active.
+	 * keep list sorted so tools menu items and plugin preference tabs are
+	 * sorted by plugin name */
+	active_plugin_list = g_list_insert_sorted(active_plugin_list, plugin, cmp_plugin_names);
 
 	geany_debug("Loaded:   %s (%s)", plugin->filename,
 		NVL(plugin->info.name, "<Unknown>"));
@@ -938,15 +949,6 @@
 }
 
 
-static gint cmp_plugin_names(gconstpointer a, gconstpointer b)
-{
-	const Plugin *pa = a;
-	const Plugin *pb = b;
-
-	return strcmp(pa->info.name, pb->info.name);
-}
-
-
 static void update_active_plugins_pref(void)
 {
 	gint i = 0;
@@ -961,10 +963,6 @@
 		return;
 	}
 
-	/* sort the list so next time tools menu items are sorted by plugin name
-	 * (not ideal to do here, but better than nothing) */
-	active_plugin_list = g_list_sort(active_plugin_list, cmp_plugin_names);
-
 	active_plugins_pref = g_new0(gchar*, count + 1);
 
 	for (list = g_list_first(active_plugin_list); list != NULL; list = list->next)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list