Avoid gdk_threads_enter/gdk_threads_leave where it's possible.
Add missing g_source_is_destroyed() test in idle callbacks.