diff -ur gworldclock-1.4.4/debian/changelog gworldclock-1.4.4/debian/changelog --- gworldclock-1.4.4/debian/changelog 2007-12-17 13:53:06.000000000 +0700 +++ gworldclock-1.4.4/debian/changelog 2007-12-17 13:53:44.000000000 +0700 @@ -1,3 +1,9 @@ +gworldclock (1.4.4-6ubuntu1) hardy; urgency=low + + * Sort countries by name. + + -- Oliver Sauder Fri, 17 Dec 2007 13:15:31 +0700 + gworldclock (1.4.4-6) unstable; urgency=low * Use gworldclock.png as icon in the Debian menu. Funny, the menu diff -ur gworldclock-1.4.4/zones.c gworldclock-1.4.4/zones.c --- gworldclock-1.4.4/zones.c 2007-12-17 13:53:06.000000000 +0700 +++ gworldclock-1.4.4/zones.c 2007-12-17 13:57:09.000000000 +0700 @@ -118,6 +118,15 @@ return FALSE; } +/* GList GCompareFunc to sort list after name */ +gint alphabetical_GCompareFunc(gconstpointer a, gconstpointer b) +{ + NameCodeType *aentry = ((NameCodeType *) a); + NameCodeType *bentry = ((NameCodeType *) b); + + return strcmp(aentry->name, bentry->name); +} + GSList* AddNameCodeEntry(gchar *code, gchar *name, GSList *List) { NameCodeType *entry; @@ -127,7 +136,7 @@ g_print(_("Could not create list: %s"),g_strerror(errno)); entry->name = g_strdup(name); entry->code = g_strdup(code); - List = g_slist_append(List, (gpointer)entry); + List = g_slist_insert_sorted(List, (gpointer)entry, alphabetical_GCompareFunc); /* we don't free entry here do we? It's on record and is only to be freed when the item is released from the list */