Di not ask "are you sure you want to leave room X" when we remove an account. We already replied to "you have opend chat windows". Fixes #2462

This commit is contained in:
Yann Leboulanger 2006-10-03 08:54:14 +00:00
parent 59374a1e39
commit f34c41c93b
4 changed files with 12 additions and 7 deletions

View File

@ -213,6 +213,8 @@ def get_number_of_connected_accounts(accounts_list = None):
return connected_accounts
def account_is_connected(account):
if account not in connections:
return False
if connections[account].connected > 1: # 0 is offline, 1 is connecting
return True
else:

View File

@ -2358,7 +2358,7 @@ class RemoveAccountWindow:
if not res:
return
# Close all opened windows
gajim.interface.roster.close_all(self.account)
gajim.interface.roster.close_all(self.account, force = True)
gajim.connections[self.account].disconnect(on_purpose = True)
del gajim.connections[self.account]
gajim.config.del_per('accounts', self.account)

View File

@ -279,10 +279,11 @@ class MessageWindow:
ctrl_page = self.notebook.page_num(ctrl.widget)
self.notebook.set_current_page(ctrl_page)
def remove_tab(self, ctrl, reason = None):
'''reason is only for gc (offline status message)'''
def remove_tab(self, ctrl, reason = None, force = False):
'''reason is only for gc (offline status message)
if force is True, do not ask any confirmation'''
# Shutdown the MessageControl
if not ctrl.allow_shutdown():
if not force and not ctrl.allow_shutdown():
return
if reason is not None: # We are leaving gc with a status message
ctrl.shutdown(reason)

View File

@ -2717,11 +2717,13 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
else:
w.window.destroy()
def close_all(self, account):
'''close all the windows from an account'''
def close_all(self, account, force = False):
'''close all the windows from an account
if force is True, do not ask confirmation before closing chat/gc windows
'''
self.close_all_from_dict(gajim.interface.instances[account])
for ctrl in gajim.interface.msg_win_mgr.get_controls(acct = account):
ctrl.parent_win.remove_tab(ctrl)
ctrl.parent_win.remove_tab(ctrl, force = force)
def on_roster_window_delete_event(self, widget, event):
'''When we want to close the window'''