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',
|
||||
'LaunchpadCodeURLHandler',
|
||||
'APTURLHandler'],
|
||||
'suppress_multiple_term_dialog': False,
|
||||
},
|
||||
'keybindings': {
|
||||
'zoom_in' : '<Control>plus',
|
||||
|
|
|
@ -155,6 +155,11 @@ class Container(object):
|
|||
|
||||
def construct_confirm_close(self, window, reqtype):
|
||||
"""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.set_has_separator(False)
|
||||
dialog.set_resizable(False)
|
||||
|
@ -170,7 +175,7 @@ class Container(object):
|
|||
secondary = gtk.Label(_('This %s has several terminals open. Closing \
|
||||
the %s will also close all terminals within it.') % (reqtype, reqtype))
|
||||
secondary.set_line_wrap(True)
|
||||
|
||||
|
||||
labels = gtk.VBox()
|
||||
labels.pack_start(primary, False, False, 6)
|
||||
labels.pack_start(secondary, False, False, 6)
|
||||
|
@ -183,9 +188,21 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
|
|||
box.pack_start(image, False, False, 6)
|
||||
box.pack_start(labels, False, False, 6)
|
||||
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()
|
||||
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):
|
||||
"""Pass a title change up the widget stack"""
|
||||
|
|
|
@ -246,10 +246,8 @@ class Window(Container, gtk.Window):
|
|||
def confirm_close(self, window, type):
|
||||
"""Display a confirmation dialog when the user is closing multiple
|
||||
terminals in one window"""
|
||||
dialog = self.construct_confirm_close(window, type)
|
||||
result = dialog.run()
|
||||
dialog.destroy()
|
||||
return(not (result == gtk.RESPONSE_ACCEPT))
|
||||
|
||||
return(not (self.construct_confirm_close(window, type) == gtk.RESPONSE_ACCEPT))
|
||||
|
||||
def on_destroy_event(self, widget, data=None):
|
||||
"""Handle window destruction"""
|
||||
|
|
Loading…
Reference in New Issue