fix closing a tab
This commit is contained in:
parent
5fbea47130
commit
f5059b4e26
|
@ -439,19 +439,11 @@ class MessageWindow(object):
|
||||||
def remove_tab(self, ctrl, method, reason = None, force = False):
|
def remove_tab(self, ctrl, method, reason = None, force = False):
|
||||||
'''reason is only for gc (offline status message)
|
'''reason is only for gc (offline status message)
|
||||||
if force is True, do not ask any confirmation'''
|
if force is True, do not ask any confirmation'''
|
||||||
# Shutdown the MessageControl
|
def close(ctrl):
|
||||||
allow_shutdown = ctrl.allow_shutdown(method)
|
|
||||||
if not force and allow_shutdown == 'no':
|
|
||||||
return
|
|
||||||
if allow_shutdown == 'minimize' and method != self.CLOSE_COMMAND:
|
|
||||||
ctrl.minimize()
|
|
||||||
self.check_tabs()
|
|
||||||
return
|
|
||||||
if reason is not None: # We are leaving gc with a status message
|
if reason is not None: # We are leaving gc with a status message
|
||||||
ctrl.shutdown(reason)
|
ctrl.shutdown(reason)
|
||||||
else: # We are leaving gc without status message or it's a chat
|
else: # We are leaving gc without status message or it's a chat
|
||||||
ctrl.shutdown()
|
ctrl.shutdown()
|
||||||
|
|
||||||
# Update external state
|
# Update external state
|
||||||
gajim.events.remove_events(ctrl.account, ctrl.get_full_jid,
|
gajim.events.remove_events(ctrl.account, ctrl.get_full_jid,
|
||||||
types = ['printed_msg', 'chat', 'gc_msg'])
|
types = ['printed_msg', 'chat', 'gc_msg'])
|
||||||
|
@ -480,6 +472,24 @@ class MessageWindow(object):
|
||||||
self.check_tabs()
|
self.check_tabs()
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
|
||||||
|
def on_yes(ctrl):
|
||||||
|
close(ctrl)
|
||||||
|
|
||||||
|
def on_no(ctrl):
|
||||||
|
if not force:
|
||||||
|
return
|
||||||
|
close(ctrl)
|
||||||
|
|
||||||
|
def on_minimize(ctrl):
|
||||||
|
if method != self.CLOSE_COMMAND:
|
||||||
|
ctrl.minimize()
|
||||||
|
self.check_tabs()
|
||||||
|
return
|
||||||
|
close(ctrl)
|
||||||
|
|
||||||
|
# Shutdown the MessageControl
|
||||||
|
ctrl.allow_shutdown(method, on_yes, on_no, on_minimize)
|
||||||
|
|
||||||
def check_tabs(self):
|
def check_tabs(self):
|
||||||
if self.get_num_controls() == 0:
|
if self.get_num_controls() == 0:
|
||||||
# These are not called when the window is destroyed like this, fake it
|
# These are not called when the window is destroyed like this, fake it
|
||||||
|
|
Loading…
Reference in New Issue