Removed the confirmation-dialog when closing a single terminal. Changed the key-combo to close a single terminal to
Ctrl-Shift-W to mimic the behaviour of Gnome-terminal. Enhanced the look of the confirmation-dialog when closing the whole window.
This commit is contained in:
parent
095bd07cfe
commit
99eeb02259
71
terminator
71
terminator
|
@ -275,7 +275,7 @@ class TerminatorTerm:
|
||||||
elif keyname == 'V':
|
elif keyname == 'V':
|
||||||
self.term.splitaxis (self, True)
|
self.term.splitaxis (self, True)
|
||||||
return (True)
|
return (True)
|
||||||
elif keyname == 'Q':
|
elif keyname == 'W':
|
||||||
self.term.closeterm (self)
|
self.term.closeterm (self)
|
||||||
return (True)
|
return (True)
|
||||||
|
|
||||||
|
@ -405,20 +405,40 @@ class Terminator:
|
||||||
self.window.fullscreen ()
|
self.window.fullscreen ()
|
||||||
self._fullscreen = not self._fullscreen
|
self._fullscreen = not self._fullscreen
|
||||||
|
|
||||||
def on_delete_event (self, widget, event, data=None):
|
def on_delete_event (self, window, event, data=None):
|
||||||
if len (self.term_list) == 1:
|
if len (self.term_list) == 1:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
dialog = gtk.Dialog ("Quit?", self.window, gtk.DIALOG_MODAL, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_QUIT, gtk.RESPONSE_ACCEPT))
|
# show dialog
|
||||||
label = gtk.Label ("Do you really want to quit?")
|
dialog = gtk.Dialog ("Close?", window, gtk.DIALOG_MODAL,
|
||||||
dialog.vbox.pack_start (label, True, True, 0)
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
|
||||||
label.show ()
|
dialog.set_has_separator (False)
|
||||||
|
dialog.set_resizable (False)
|
||||||
|
|
||||||
res = dialog.run ()
|
primairy = gtk.Label ('<big><b>Close all terminals?</b></big>')
|
||||||
if res == gtk.RESPONSE_ACCEPT:
|
primairy.set_use_markup (True)
|
||||||
return False
|
primairy.set_alignment (0, 0.5)
|
||||||
|
secundairy = gtk.Label (("This window has %s terminals open. " % len(self.term_list)) +
|
||||||
|
"Closing the window will also close all terminals.")
|
||||||
|
secundairy.set_line_wrap(True)
|
||||||
|
primairy.set_alignment (0, 0.5)
|
||||||
|
|
||||||
|
labels = gtk.VBox ()
|
||||||
|
labels.pack_start (primairy, False, False, 6)
|
||||||
|
labels.pack_start (secundairy, False, False, 6)
|
||||||
|
|
||||||
|
image = gtk.image_new_from_stock(gtk.STOCK_DIALOG_WARNING, gtk.ICON_SIZE_DIALOG)
|
||||||
|
image.set_alignment (0.5, 0)
|
||||||
|
|
||||||
|
box = gtk.HBox()
|
||||||
|
box.pack_start (image, False, False, 6)
|
||||||
|
box.pack_start (labels, False, False, 6)
|
||||||
|
dialog.vbox.pack_start (box, False, False, 12)
|
||||||
|
|
||||||
|
dialog.show_all ()
|
||||||
|
result = dialog.run ()
|
||||||
dialog.destroy ()
|
dialog.destroy ()
|
||||||
return True
|
return not (result == gtk.RESPONSE_ACCEPT)
|
||||||
|
|
||||||
def on_destroy_event (self, widget, data=None):
|
def on_destroy_event (self, widget, data=None):
|
||||||
gtk.main_quit ()
|
gtk.main_quit ()
|
||||||
|
@ -524,31 +544,18 @@ class Terminator:
|
||||||
print "Error: %s is not a child of %s"%(widget, parent)
|
print "Error: %s is not a child of %s"%(widget, parent)
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.closetermreq ():
|
self.term_list.remove (widget)
|
||||||
self.term_list.remove (widget)
|
grandparent.remove (parent)
|
||||||
grandparent.remove (parent)
|
sibling.reparent (grandparent)
|
||||||
sibling.reparent (grandparent)
|
widget.get_box ().destroy ()
|
||||||
widget.get_box ().destroy ()
|
parent.destroy ()
|
||||||
parent.destroy ()
|
|
||||||
|
|
||||||
for term in self.term_list:
|
for term in self.term_list:
|
||||||
if term.get_box () == sibling:
|
if term.get_box () == sibling:
|
||||||
term._vte.grab_focus ()
|
term._vte.grab_focus ()
|
||||||
break
|
break
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def closetermreq (self):
|
|
||||||
dialog = gtk.Dialog ("Close?", self.window, gtk.DIALOG_MODAL, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
|
|
||||||
label = gtk.Label ("Do you really want to close this terminal?")
|
|
||||||
dialog.vbox.pack_start (label, True, True, 0)
|
|
||||||
label.show ()
|
|
||||||
|
|
||||||
res = dialog.run ()
|
|
||||||
dialog.destroy ()
|
|
||||||
if res == gtk.RESPONSE_ACCEPT:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def go_next (self, term):
|
def go_next (self, term):
|
||||||
current = self.term_list.index (term)
|
current = self.term_list.index (term)
|
||||||
|
|
Loading…
Reference in New Issue