Replace newer GLib functions with portable ones

Replace instances of `g_clear_pointer`, and macros pertaining to
defining gobjects with a private field with the equivalent functions and
macros that are compatable with GLib 2.32.