From 2e88ef3053cf2a12115f78fcd4292266b4c98943 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 27 Feb 2009 08:37:46 +0100 Subject: Add priority field to plugin description --- src/plugin.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugin.c') diff --git a/src/plugin.c b/src/plugin.c index 59d3572c..216fce15 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -36,6 +36,14 @@ struct connman_plugin { struct connman_plugin_desc *desc; }; +static gint compare_priority(gconstpointer a, gconstpointer b) +{ + const struct connman_plugin *plugin1 = a; + const struct connman_plugin *plugin2 = b; + + return plugin2->desc->priority - plugin1->desc->priority; +} + static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc) { struct connman_plugin *plugin; @@ -60,7 +68,7 @@ static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc) return FALSE; } - plugins = g_slist_append(plugins, plugin); + plugins = g_slist_insert_sorted(plugins, plugin, compare_priority); return TRUE; } -- cgit v1.2.3