Move GUI related code into main thread, remove gdk_threads_enter/leave.