Windows need to commit suicide when their last terminal exits. Previously there was an assumption of only having one window, so monitoring the global terminal list was acceptable. no more
This commit is contained in:
parent
4b58b0c738
commit
1236a85370
|
@ -58,7 +58,11 @@ class Terminator(Borg):
|
||||||
"""de-register a window widget"""
|
"""de-register a window widget"""
|
||||||
dbg('Terminator::deregister_window: de-registering %s:%s' %
|
dbg('Terminator::deregister_window: de-registering %s:%s' %
|
||||||
(id(window), type(window)))
|
(id(window), type(window)))
|
||||||
self.windows.remove(window)
|
if window in self.windows:
|
||||||
|
self.windows.remove(window)
|
||||||
|
else:
|
||||||
|
err('%s is not in registered window list' % window)
|
||||||
|
|
||||||
if len(self.windows) == 0:
|
if len(self.windows) == 0:
|
||||||
# We have no windows left, we should exit
|
# We have no windows left, we should exit
|
||||||
dbg('no windows remain, quitting')
|
dbg('no windows remain, quitting')
|
||||||
|
|
|
@ -171,7 +171,10 @@ class Window(Container, gtk.Window):
|
||||||
if maker.isinstance(self.get_child(), 'Terminal'):
|
if maker.isinstance(self.get_child(), 'Terminal'):
|
||||||
dbg('Window::on_delete_event: Only one child, closing is fine')
|
dbg('Window::on_delete_event: Only one child, closing is fine')
|
||||||
return(False)
|
return(False)
|
||||||
return(self.confirm_close(window, _('window')))
|
elif maker.isinstance(self.get_child(), 'Container'):
|
||||||
|
return(self.confirm_close(window, _('window')))
|
||||||
|
else:
|
||||||
|
dbg('unknown child: %s' % self.get_child())
|
||||||
|
|
||||||
def confirm_close(self, window, type):
|
def confirm_close(self, window, type):
|
||||||
"""Display a confirmation dialog when the user is closing multiple
|
"""Display a confirmation dialog when the user is closing multiple
|
||||||
|
@ -183,6 +186,7 @@ class Window(Container, gtk.Window):
|
||||||
|
|
||||||
def on_destroy_event(self, widget, data=None):
|
def on_destroy_event(self, widget, data=None):
|
||||||
"""Handle window descruction"""
|
"""Handle window descruction"""
|
||||||
|
dbg('destroying self')
|
||||||
self.cnxids.remove_all()
|
self.cnxids.remove_all()
|
||||||
self.terminator.deregister_window(self)
|
self.terminator.deregister_window(self)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
@ -276,6 +280,13 @@ class Window(Container, gtk.Window):
|
||||||
self.disconnect_child(widget)
|
self.disconnect_child(widget)
|
||||||
return(True)
|
return(True)
|
||||||
|
|
||||||
|
def closeterm(self, widget):
|
||||||
|
"""Handle a terminal closing"""
|
||||||
|
Container.closeterm(self, widget)
|
||||||
|
|
||||||
|
if len(self.get_children()) == 0:
|
||||||
|
self.emit('destroy')
|
||||||
|
|
||||||
def split_axis(self, widget, vertical=True, sibling=None):
|
def split_axis(self, widget, vertical=True, sibling=None):
|
||||||
"""Split the window"""
|
"""Split the window"""
|
||||||
maker = Factory()
|
maker = Factory()
|
||||||
|
|
Loading…
Reference in New Issue