From 57c8fdad39282d57fe5aed894b34c6789785a839 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 5 Aug 2012 13:34:35 +0200 Subject: [PATCH] add option to enable / disable the remember opened chats option. Fixes #7193 --- src/common/config.py | 1 + src/message_window.py | 2 ++ src/roster_window.py | 19 +++++++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/common/config.py b/src/common/config.py index 066740915..e76e261bc 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -311,6 +311,7 @@ class Config: 'show_affiliation_in_groupchat': [opt_bool, True, _('If True, Gajim will show affiliation of groupchat occupants by adding a colored square to the status icon')], 'global_proxy': [opt_str, '', _('Proxy used for all outgoing connections if the account does not have a specific proxy configured')], 'ignore_incoming_attention': [opt_bool, False, _('If True, Gajim will ignore incoming attention requestd ("wizz").')], + 'remember_opened_chat_controls': [ opt_bool, True, _('If enabled, Gajim will reopen chat windows that were opened last time Gajim was closed.')], }, {}) __options_per_key = { diff --git a/src/message_window.py b/src/message_window.py index 8abbd4bf6..0ab0b5dfc 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -1246,6 +1246,8 @@ class MessageWindowMgr(gobject.GObject): mw.new_tab(ctrl) def save_opened_controls(self): + if not gajim.config.get('remember_opened_chat_controls'): + return chat_controls = {} for acct in gajim.connections: chat_controls[acct] = [] diff --git a/src/roster_window.py b/src/roster_window.py index 81bb60a5c..f6d1e7125 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -2609,14 +2609,17 @@ class RosterWindow: self.add_account_contacts(obj.conn.name) self.fire_up_unread_messages_events(obj.conn.name) else: - account = obj.conn.name - controls = gajim.config.get_per('accounts', account, - 'opened_chat_controls') - if controls: - for jid in controls.split(','): - contact = gajim.contacts.get_contact_with_highest_priority( - account, jid) - gajim.interface.on_open_chat_window(None, contact, account) + if gajim.config.get('remember_opened_chat_controls'): + account = obj.conn.name + controls = gajim.config.get_per('accounts', account, + 'opened_chat_controls') + if controls: + for jid in controls.split(','): + contact = \ + gajim.contacts.get_contact_with_highest_priority( + account, jid) + gajim.interface.on_open_chat_window(None, contact, + account) gobject.idle_add(self.refilter_shown_roster_items) def _nec_anonymous_auth(self, obj):