Merge branch from Bruno Braga that implements a checkbox when closing multiple terminals, to suppress future dialogs
This commit is contained in:
commit
12e76b7c78
|
@ -104,6 +104,7 @@ DEFAULTS = {
|
||||||
'enabled_plugins' : ['LaunchpadBugURLHandler',
|
'enabled_plugins' : ['LaunchpadBugURLHandler',
|
||||||
'LaunchpadCodeURLHandler',
|
'LaunchpadCodeURLHandler',
|
||||||
'APTURLHandler'],
|
'APTURLHandler'],
|
||||||
|
'suppress_multiple_term_dialog': False,
|
||||||
},
|
},
|
||||||
'keybindings': {
|
'keybindings': {
|
||||||
'zoom_in' : '<Control>plus',
|
'zoom_in' : '<Control>plus',
|
||||||
|
|
|
@ -155,6 +155,11 @@ class Container(object):
|
||||||
|
|
||||||
def construct_confirm_close(self, window, reqtype):
|
def construct_confirm_close(self, window, reqtype):
|
||||||
"""Create a confirmation dialog for closing things"""
|
"""Create a confirmation dialog for closing things"""
|
||||||
|
|
||||||
|
# skip this dialog if applicable
|
||||||
|
if self.config['suppress_multiple_term_dialog']:
|
||||||
|
return gtk.RESPONSE_ACCEPT
|
||||||
|
|
||||||
dialog = gtk.Dialog(_('Close?'), window, gtk.DIALOG_MODAL)
|
dialog = gtk.Dialog(_('Close?'), window, gtk.DIALOG_MODAL)
|
||||||
dialog.set_has_separator(False)
|
dialog.set_has_separator(False)
|
||||||
dialog.set_resizable(False)
|
dialog.set_resizable(False)
|
||||||
|
@ -184,8 +189,20 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
|
||||||
box.pack_start(labels, False, False, 6)
|
box.pack_start(labels, False, False, 6)
|
||||||
dialog.vbox.pack_start(box, False, False, 12)
|
dialog.vbox.pack_start(box, False, False, 12)
|
||||||
|
|
||||||
|
checkbox = gtk.CheckButton(_("Do not show this message next time"))
|
||||||
|
dialog.vbox.pack_end(checkbox)
|
||||||
|
|
||||||
dialog.show_all()
|
dialog.show_all()
|
||||||
return(dialog)
|
|
||||||
|
result = dialog.run()
|
||||||
|
|
||||||
|
# set configuration
|
||||||
|
self.config['suppress_multiple_term_dialog'] = checkbox.get_active()
|
||||||
|
self.config.save()
|
||||||
|
|
||||||
|
dialog.destroy()
|
||||||
|
|
||||||
|
return(result)
|
||||||
|
|
||||||
def propagate_title_change(self, widget, title):
|
def propagate_title_change(self, widget, title):
|
||||||
"""Pass a title change up the widget stack"""
|
"""Pass a title change up the widget stack"""
|
||||||
|
|
|
@ -246,10 +246,8 @@ class Window(Container, gtk.Window):
|
||||||
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
|
||||||
terminals in one window"""
|
terminals in one window"""
|
||||||
dialog = self.construct_confirm_close(window, type)
|
|
||||||
result = dialog.run()
|
return(not (self.construct_confirm_close(window, type) == gtk.RESPONSE_ACCEPT))
|
||||||
dialog.destroy()
|
|
||||||
return(not (result == gtk.RESPONSE_ACCEPT))
|
|
||||||
|
|
||||||
def on_destroy_event(self, widget, data=None):
|
def on_destroy_event(self, widget, data=None):
|
||||||
"""Handle window destruction"""
|
"""Handle window destruction"""
|
||||||
|
|
Loading…
Reference in New Issue