changeset 1043:1528d05b3e6b

[gaim-migrate @ 1053] insert protocols in sorted order. this may seem odd but it helps things in the account editor committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 01 Nov 2000 09:32:34 +0000
parents 8a4290984d1e
children 77b6bc7288d3
files src/prpl.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/prpl.c	Wed Nov 01 09:14:07 2000 +0000
+++ b/src/prpl.c	Wed Nov 01 09:32:34 2000 +0000
@@ -41,10 +41,16 @@
 	return NULL;
 }
 
+static gint proto_compare(struct prpl *a, struct prpl *b) {
+	/* neg if a before b, 0 if equal, pos if a after b */
+	return a->protocol - b->protocol;
+}
+
 void load_protocol(proto_init pi)
 {
 	struct prpl *p = g_new0(struct prpl, 1);
 	struct prpl *old;
+	GSList *n = protocols;
 	pi(p);
 	if (old = find_prpl(p->protocol)) {
 		GSList *c = connections;
@@ -65,7 +71,7 @@
 		protocols = g_slist_remove(protocols, old);
 		g_free(old);
 	}
-	protocols = g_slist_append(protocols, p);
+	protocols = g_slist_insert_sorted(protocols, p, (GCompareFunc)proto_compare);
 }
 
 void static_proto_init()