[gaim-migrate @ 1053]

Wed, 01 Nov 2000 09:32:34 +0000

author
Eric Warmenhoven <warmenhoven@yahoo.com>
date
Wed, 01 Nov 2000 09:32:34 +0000
changeset 1043
45ec860a254c
parent 1042
db1e7e936587
child 1044
bcb3af3bfae1

[gaim-migrate @ 1053]
insert protocols in sorted order. this may seem odd but it helps things in the account editor

src/prpl.c file | annotate | diff | comparison | revisions
--- 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()

mercurial