Replace deprecated g_tree_traverse with g_tree_foreach.

g_tree_foreach traverses the tree in sorted order, which is what
irssi was already doing.