From 96a1cbf820ea03621b429cdeda0da2d0a160fce6 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 29 Aug 2020 22:23:59 -0400 Subject: [PATCH] option to close log window on normal exit. --- MA2ME/Base.lproj/Preferences.xib | 13 ++++++++++++- MA2ME/Defaults.plist | 2 ++ MA2ME/LogWindowController.m | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/MA2ME/Base.lproj/Preferences.xib b/MA2ME/Base.lproj/Preferences.xib index dfe9078..52d23d2 100644 --- a/MA2ME/Base.lproj/Preferences.xib +++ b/MA2ME/Base.lproj/Preferences.xib @@ -35,7 +35,7 @@ - + @@ -43,6 +43,17 @@ + diff --git a/MA2ME/Defaults.plist b/MA2ME/Defaults.plist index 7282f80..8e3cf51 100644 --- a/MA2ME/Defaults.plist +++ b/MA2ME/Defaults.plist @@ -2,6 +2,8 @@ + AutoCloseLogWindow + MamePath /usr/local/bin/mame diff --git a/MA2ME/LogWindowController.m b/MA2ME/LogWindowController.m index 8033603..91dd232 100644 --- a/MA2ME/LogWindowController.m +++ b/MA2ME/LogWindowController.m @@ -144,6 +144,12 @@ static NSMutableSet *LogWindows; _task = nil; [[self window] setDocumentEdited: NO]; + + if (ok && [[NSUserDefaults standardUserDefaults] boolForKey: @"AutoCloseLogWindow"]) { + + [[self window] close]; + //[LogWindows removeObject: self]; // close sends WindowWillClose notification. + } } #pragma mark - NSWindowDelegate