tests: add env-var details to api docs
test: use glib api for mainloop flush

Non functional change. The api is a bit more flexible.
tools: add a new convenience function for saver idle handlers

Add a function to add an idle handler that receives an instance to an object in
a way that the handler is detached when the object is disposed. This prevents
crashes from user-after-free acces to dead objects.
handler to