Be able to remove a terminal without destroying it. This should really be factored out into a deparent() and remove(). Closes LP #313553

This commit is contained in:
Chris Jones 2009-01-04 02:37:42 +00:00
parent eba60f3fcc
commit c7fdbf5aa6
2 changed files with 8 additions and 6 deletions

View File

@ -720,7 +720,7 @@ class Terminator:
dbg ('SEGBUG: spawned child')
return
def remove(self, widget):
def remove(self, widget, keep = False):
"""Remove a TerminatorTerm from the Terminator view and terms list
Returns True on success, False on failure"""
parent = widget.get_parent ()
@ -771,18 +771,20 @@ class Terminator:
if isinstance(sibling, TerminatorTerm) and isinstance(sibling.get_parent(), gtk.Notebook):
sibling._titlebox.hide()
widget._vte.get_parent().remove(widget._vte)
widget._vte = None
self.term_list.remove (widget)
if not keep:
widget._vte.get_parent().remove(widget._vte)
widget._vte = None
elif isinstance (parent, gtk.Notebook):
parent.remove(widget)
nbpages = parent.get_n_pages()
index = self.term_list.index (widget)
widget._vte.get_parent().remove(widget._vte)
widget._vte = None
self.term_list.remove (widget)
if not keep:
widget._vte.get_parent().remove(widget._vte)
widget._vte = None
if nbpages == 1:
if self.window.allocation.height != gtk.gdk.screen_height():
self.window.resize(self.window.allocation.width, min(self.window.allocation.height - parent.get_tab_label(parent.get_nth_page(0)).height_request(), gtk.gdk.screen_height()))

View File

@ -339,7 +339,7 @@ text/plain
return
pos = self.get_location(widget, x, y)
data.terminator.remove(widgetsrc)
data.terminator.remove(widgetsrc, True)
data.terminator.add(self, widgetsrc,pos)
return