Replace GList for loops with g_list_for macro

Although the name suggests that the macro comes from the official GLib sources,
it is not the case but defined in compat.h. g_list_ is used as a prefix because
the macro is working only with GList type lists.