diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 53307641..5a1d56d1 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -102,6 +102,7 @@ DEFAULTS = { 'enabled_plugins' : ['LaunchpadBugURLHandler', 'LaunchpadCodeURLHandler', 'APTURLHandler'], + 'suppress_multiple_term_dialog': False, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 35abf981..1541b2ce 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -151,6 +151,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) @@ -166,7 +171,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) @@ -179,9 +184,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""" diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8fb4fbf7..f347a7c0 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -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"""