[PATCH 2/3] Remove Gdk thread initialization, introduce new helper functions and make exception handler be called by Gtk only once