Kaydet (Commit) 7a2a413f authored tarafından Colomban Wendling's avatar Colomban Wendling

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.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5591 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 6236c506
......@@ -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>
......
......@@ -554,6 +554,15 @@ static void read_key_group(Plugin *plugin)
}
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 @@ plugin_init(Plugin *plugin)
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 @@ void plugins_load_active(void)
}
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 @@ static void update_active_plugins_pref(void)
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment