comparison mcabber/mcabber/compl.c @ 1850:8d7810f529db

Sort items in completion lists
author alkino <nicolas.cornu@ensi-bourges.fr>
date Thu, 01 Apr 2010 19:33:23 +0200
parents 8f7d7c05f275
children 057b514b1f12
comparison
equal deleted inserted replaced
1849:1ae3a110d300 1850:8d7810f529db
118 gchar *compval; 118 gchar *compval;
119 if (suffix) 119 if (suffix)
120 compval = g_strdup_printf("%s%s", word+len, suffix); 120 compval = g_strdup_printf("%s%s", word+len, suffix);
121 else 121 else
122 compval = g_strdup(word+len); 122 compval = g_strdup(word+len);
123 c->list = g_slist_append(c->list, compval); // TODO sort 123 c->list = g_slist_insert_sorted(c->list, compval, g_ascii_strcasecmp);
124 } 124 }
125 } 125 }
126 } 126 }
127 c->next = c->list; 127 c->next = c->list;
128 InputCompl = c; 128 InputCompl = c;
208 nword = g_strdup_printf("%s ", word); 208 nword = g_strdup_printf("%s ", word);
209 } else { // word is fine 209 } else { // word is fine
210 nword = g_strdup(word); 210 nword = g_strdup(word);
211 } 211 }
212 212
213 // TODO Check word does not already exist 213 if (g_slist_find_custom(cat->words, nword, g_strcmp0) != NULL)
214 cat->words = g_slist_append(cat->words, nword); // TODO sort 214 return;
215
216 cat->words = g_slist_insert_sorted(cat->words, nword, g_ascii_strcasecmp);
215 } 217 }
216 218
217 // compl_del_category_word(categ, command) 219 // compl_del_category_word(categ, command)
218 // Removes a keyword from category categ in completion list. 220 // Removes a keyword from category categ in completion list.
219 void compl_del_category_word(guint categ, const gchar *word) 221 void compl_del_category_word(guint categ, const gchar *word)