From 883bff804cc4c5cc507bcde016fb597eadfda36a Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Thu, 30 Mar 2006 17:23:06 +0000 Subject: [PATCH] we now can't remove / rename accounts with unread events --- src/config.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/config.py b/src/config.py index 3e31e5472..a34fb3d01 100644 --- a/src/config.py +++ b/src/config.py @@ -1111,11 +1111,19 @@ class AccountModificationWindow: config = {} name = self.xml.get_widget('name_entry').get_text().decode('utf-8') if gajim.connections.has_key(self.account): - if name != self.account and \ - gajim.connections[self.account].connected != 0: - dialogs.ErrorDialog(_('You are currently connected to the server'), - _('To change the account name, you must be disconnected.')).get_response() - return + if name != self.account: + if gajim.connections[self.account].connected != 0: + dialogs.ErrorDialog( + _('You are currently connected to the server'), + _('To change the account name, you must be disconnected.')).\ + get_response() + return + if len(gajim.awaiting_events[self.account]): + dialogs.ErrorDialog(_('Unread events'), + _('To change the account name, you must read all pending ' + 'events.')).\ + get_response() + return if (name == ''): dialogs.ErrorDialog(_('Invalid account name'), _('Account name cannot be empty.')).get_response() @@ -1643,6 +1651,11 @@ class AccountsWindow: if not iter: return account = model.get_value(iter, 0).decode('utf-8') + if len(gajim.awaiting_events[account]): + dialogs.ErrorDialog(_('Unread events'), + _('Read all pending events before removing this account.')).\ + get_response() + return if gajim.interface.instances[account].has_key('remove_account'): gajim.interface.instances[account]['remove_account'].window.present() else: