From 7ef62a99f299dbe6e1b60dcbf63dd819fc7c1fc3 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 17 Oct 2007 14:58:54 +0000 Subject: [PATCH] improve speed when quitting Gajim, and prevent to send twice STATUS event when we quit --- src/common/connection.py | 2 +- src/roster_window.py | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index a2f31fcbf..fc9597965 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -203,8 +203,8 @@ class Connection(ConnectionHandlers): # after we auth to server self.old_show = STATUS_LIST[self.connected] self.connected = 0 - self.dispatch('STATUS', 'offline') if not self.on_purpose: + self.dispatch('STATUS', 'offline') self.disconnect() if gajim.config.get_per('accounts', self.name, 'autoreconnect'): self.connected = -1 diff --git a/src/roster_window.py b/src/roster_window.py index 6dfaeea04..72243dbec 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -3762,17 +3762,19 @@ class RosterWindow: self.quit_on_next_offline -= 1 if self.quit_on_next_offline < 1: self.quit_gtkgui_interface() - if accountIter: - model[accountIter][C_SECPIXBUF] = None - if gajim.con_types.has_key(account): - gajim.con_types[account] = None - for jid in gajim.contacts.get_jid_list(account): - lcontact = gajim.contacts.get_contacts(account, jid) - lcontact_copy = [] - for contact in lcontact: - lcontact_copy.append(contact) - for contact in lcontact_copy: - self.chg_contact_status(contact, 'offline', '', account) + else: + # No need to redraw contacts if we're quitting + if accountIter: + model[accountIter][C_SECPIXBUF] = None + if gajim.con_types.has_key(account): + gajim.con_types[account] = None + for jid in gajim.contacts.get_jid_list(account): + lcontact = gajim.contacts.get_contacts(account, jid) + lcontact_copy = [] + for contact in lcontact: + lcontact_copy.append(contact) + for contact in lcontact_copy: + self.chg_contact_status(contact, 'offline', '', account) self.actions_menu_needs_rebuild = True self.update_status_combobox()