add option to enable / disable the remember opened chats option. Fixes #7193

This commit is contained in:
Yann Leboulanger 2012-08-05 13:34:35 +02:00
parent aa3a8c7f46
commit 57c8fdad39
3 changed files with 14 additions and 8 deletions

View File

@ -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 = {

View File

@ -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] = []

View File

@ -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):