def _shutdown(self, result): """Stop the main loop and cause the program to exit. This should ONLY be called after all Applications are shut down cleanly.""" Basic.validate_result(result, "MainLoop::_shutdown") #close the server that listens for new versions of the app to start up: StartupServer.stop() #remove scheduled events: if self.updateEvent and self.updateEvent.active(): self.updateEvent.cancel() ProgramState.DO_UPDATES = False self.updateEvent = None GlobalEvents.throw_event("shutdown") log_msg("Done with shutdown deferreds", 4) #close the main loop if ProgramState.USE_GTK: try: gtk.main_quit() except Exception, error: log_ex(error, "Couldn't kill the gtk main loop")