Author: asterix Date: 2009-04-23 09:26:08 +0200 (Thu, 23 Apr 2009) New Revision: 11236
Modified: trunk/src/chat_control.py trunk/src/groupchat_control.py trunk/src/message_control.py trunk/src/message_window.py Log: minimize groupchats when closing several windows at the same time. Fixes #4987
Modified: trunk/src/chat_control.py =================================================================== --- trunk/src/chat_control.py 2009-04-23 06:58:55 UTC (rev 11235) +++ trunk/src/chat_control.py 2009-04-23 07:26:08 UTC (rev 11236) @@ -2327,6 +2327,9 @@ self.conv_textview.del_handlers() self.msg_textview.destroy()
+ def minimizable(self): + return False + def safe_shutdown(self): return False
Modified: trunk/src/groupchat_control.py =================================================================== --- trunk/src/groupchat_control.py 2009-04-23 06:58:55 UTC (rev 11235) +++ trunk/src/groupchat_control.py 2009-04-23 07:26:08 UTC (rev 11236) @@ -1742,6 +1742,12 @@ 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 @@ 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 @@ 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:
Modified: trunk/src/message_control.py =================================================================== --- trunk/src/message_control.py 2009-04-23 06:58:55 UTC (rev 11235) +++ trunk/src/message_control.py 2009-04-23 07:26:08 UTC (rev 11236) @@ -71,6 +71,11 @@ 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'''
Modified: trunk/src/message_window.py =================================================================== --- trunk/src/message_window.py 2009-04-23 06:58:55 UTC (rev 11235) +++ trunk/src/message_window.py 2009-04-23 07:26:08 UTC (rev 11236) @@ -206,6 +206,9 @@ 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'):