libgdm: use g_autoptr to manage objects lifecycle
Using auto pointers allows to manage things in a cleaner way without having to manually unref things before returning.
One thing we could probably discuss is if it's better (from a conceptual point of view) to use g_steal_pointer
or g_object_ref
to pass objects to other functions.
Maybe the 2nd is more implicit, while it's better not to use steal a part from when returning something, but since it involves an useless ref/unref dance, I avoided it. But I'm happy to revisit this.
Edited by Marco Trevisan