minimize groupchats when closing several windows at the same time. Fixes #4987

This commit is contained in:
Yann Leboulanger 2009-04-23 07:26:08 +00:00
parent 0e76e17bcb
commit fdcf75ae59
4 changed files with 19 additions and 4 deletions

View File

@ -2327,6 +2327,9 @@ class ChatControl(ChatControlBase):
self.conv_textview.del_handlers()
self.msg_textview.destroy()
def minimizable(self):
return False
def safe_shutdown(self):
return False

View File

@ -1742,6 +1742,12 @@ class GroupchatControl(ChatControlBase):
proposed_nick, is_modal=False, ok_handler=on_ok,
cancel_handler=on_cancel)
def minimizable(self):
if self.contact.jid in gajim.config.get_per('accounts', self.account,
'minimized_gc').split(' '):
return True
return False
def minimize(self, status='offline'):
# Minimize it
win = gajim.interface.msg_win_mgr.get_window(self.contact.jid,
@ -1799,8 +1805,7 @@ class GroupchatControl(ChatControlBase):
gajim.events.remove_events(self.account, self.room_jid)
def safe_shutdown(self):
if self.contact.jid in gajim.config.get_per('accounts', self.account,
'minimized_gc').split(' '):
if self.minimizable():
return True
includes = gajim.config.get('confirm_close_muc_rooms').split(' ')
excludes = gajim.config.get('noconfirm_close_muc_rooms').split(' ')
@ -1812,8 +1817,7 @@ class GroupchatControl(ChatControlBase):
return True
def allow_shutdown(self, method, on_yes, on_no, on_minimize):
if self.contact.jid in gajim.config.get_per('accounts', self.account,
'minimized_gc').split(' '):
if self.minimizable():
on_minimize(self)
return
if method == self.parent_win.CLOSE_ESC:

View File

@ -71,6 +71,11 @@ class MessageControl:
or inactive (state is False)'''
pass # Derived classes MUST implement this method
def minimizable(self):
'''Called to check if control can be minimized'''
# NOTE: Derived classes MAY implement this
return False
def safe_shutdown(self):
'''Called to check if control can be closed without loosing data.
returns True if control can be closed safely else False'''

View File

@ -206,6 +206,9 @@ class MessageWindow(object):
if checked:
gajim.config.set('confirm_close_multiple_tabs', False)
self.dont_warn_on_delete = True
for ctrl in self.controls():
if ctrl.minimizable():
ctrl.minimize()
win.destroy()
if not gajim.config.get('confirm_close_multiple_tabs'):