Skip to content

Commit

Permalink
[CORE] exit when we can't load the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
borisfaure committed Sep 21, 2009
1 parent e8e4639 commit 10ac7bd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions amsn2/core/amsn.py
Expand Up @@ -67,19 +67,17 @@ def __init__(self, options):
self._gui = None
self._loop = None
self._main = None
self._account = None
self.loadUI(self._options.front_end)

self._backend_manager = aMSNBackendManager(self)
self._account_manager = aMSNAccountManager(self, options)
self._account = None
self._theme_manager = aMSNThemeManager(self)
self._contactlist_manager = aMSNContactListManager(self)
self._oim_manager = aMSNOIMManager(self)
self._conversation_manager = aMSNConversationManager(self)
self._personalinfo_manager = aMSNPersonalInfoManager(self)



# TODO: redirect the logs somewhere, something like ctrl-s ctrl-d for amsn-0.9x
logging.basicConfig(level=logging.WARNING)

Expand All @@ -105,6 +103,9 @@ def loadUI(self, ui_name):

self._gui_name = ui_name
self._gui = gui.GUIManager(self, self._gui_name)
if not self._gui.gui:
print "Unable to load UI %s" %(self._gui_name,)
self.quit()
self._loop = self._gui.gui.aMSNMainLoop(self)
self._main = self._gui.gui.aMSNMainWindow(self)
self._skin_manager = self._gui.gui.SkinManager(self)
Expand Down Expand Up @@ -211,10 +212,12 @@ def timerAdd(self, delay, func):
self._loop.timerAdd(delay, func)

def quit(self):
if self._account is not None:
if self._account:
self._account.signOut()
self._loop.quit()
if self._loop:
self._loop.quit()
logging.shutdown()
exit(0)

# TODO: move to UImanager
def addContact(self):
Expand Down

0 comments on commit 10ac7bd

Please sign in to comment.