Avoid deprecated API with modern GLib

We want to keep the ability to build perl-Glib with ancient versions of
GLib, but we also want to avoid compiler warnings when compiling against
modern versions of GLib. This means avoiding deprecated API, and trying
to keep up with the development of the library as much as possible.

https://bugzilla.gnome.org/show_bug.cgi?id=711840