mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
Add suppression tick box to termination alert
This will disable the warning about multiple window and tabs. Tiger users can access this functionality by setting the user default MMSuppressTerminationAlert to 1.
This commit is contained in:
@@ -222,6 +222,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
[NSNumber numberWithBool:YES], MMUseInlineImKey,
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
[NSNumber numberWithBool:NO], MMSuppressTerminationAlertKey,
|
||||
nil];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:dict];
|
||||
@@ -509,7 +510,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
reply = NSTerminateCancel;
|
||||
|
||||
[alert release];
|
||||
} else {
|
||||
} else if (![[NSUserDefaults standardUserDefaults]
|
||||
boolForKey:MMSuppressTerminationAlertKey]) {
|
||||
// No unmodified buffers, but give a warning if there are multiple
|
||||
// windows and/or tabs open.
|
||||
int numWindows = [vimControllers count];
|
||||
@@ -530,6 +532,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
[alert setMessageText:NSLocalizedString(
|
||||
@"Are you sure you want to quit MacVim?",
|
||||
@"Quit dialog with no changed buffers, title")];
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
[alert setShowsSuppressionButton:YES];
|
||||
#endif
|
||||
|
||||
NSString *info = nil;
|
||||
if (numWindows > 1) {
|
||||
@@ -559,6 +564,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef,
|
||||
if ([alert runModal] != NSAlertFirstButtonReturn)
|
||||
reply = NSTerminateCancel;
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
|
||||
if ([[alert suppressionButton] state] == NSOnState) {
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setBool:YES forKey:MMSuppressTerminationAlertKey];
|
||||
}
|
||||
#endif
|
||||
|
||||
[alert release];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ extern NSString *MMLastWindowClosedBehaviorKey;
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
extern NSString *MMUseInlineImKey;
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
extern NSString *MMSuppressTerminationAlertKey;
|
||||
|
||||
|
||||
// Enum for MMUntitledWindowKey
|
||||
|
||||
@@ -44,6 +44,7 @@ NSString *MMLastWindowClosedBehaviorKey = @"MMLastWindowClosedBehavior";
|
||||
#ifdef INCLUDE_OLD_IM_CODE
|
||||
NSString *MMUseInlineImKey = @"MMUseInlineIm";
|
||||
#endif // INCLUDE_OLD_IM_CODE
|
||||
NSString *MMSuppressTerminationAlertKey = @"MMSuppressTerminationAlert";
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user