Implemented checkbox into the multiple terminals confirmation dialog, in oder to suppress it if users don't want this annoying message all the time.

This commit is contained in:
Bruno Braga 2011-12-08 23:12:29 +10:00
parent 46a3357b1f
commit df68c6c94d
3 changed files with 22 additions and 6 deletions

View File

@ -102,6 +102,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',

View File

@ -151,6 +151,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)
@ -180,8 +185,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"""

View File

@ -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"""