Work with old and new glib

Avoids "deprecated" warnings.