diff options
author | Stuart Connolly <stuart02@gmail.com> | 2017-03-23 18:40:00 +0000 |
---|---|---|
committer | Stuart Connolly <stuart02@gmail.com> | 2017-03-23 18:40:00 +0000 |
commit | 30d36cbe3be216742156fffded790bf95bfc2622 (patch) | |
tree | a42d69f347c0b3a351a358fad91c78435c5e60b2 /Source/SPAlertSheets.m | |
parent | d37a2f490a271b6170a5c2978f505fb403d1ad64 (diff) | |
download | sequelpro-30d36cbe3be216742156fffded790bf95bfc2622.tar.gz sequelpro-30d36cbe3be216742156fffded790bf95bfc2622.tar.bz2 sequelpro-30d36cbe3be216742156fffded790bf95bfc2622.zip |
Remove duplicate setting of sheet title/message.
Diffstat (limited to 'Source/SPAlertSheets.m')
-rw-r--r-- | Source/SPAlertSheets.m | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/Source/SPAlertSheets.m b/Source/SPAlertSheets.m index 258aac6d..fc98dc7c 100644 --- a/Source/SPAlertSheets.m +++ b/Source/SPAlertSheets.m @@ -53,7 +53,6 @@ modalDelegate:(id)modalDelegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo - msg:(NSString *)msg infoText:(NSString *)infoText returnCode:(NSInteger *)returnCode { @@ -69,7 +68,6 @@ modalDelegate:modalDelegate didEndSelector:didEndSelector contextInfo:contextInfo - msg:msg infoText:infoText returnCode:returnCode]; } @@ -93,43 +91,37 @@ aButton = [alert addButtonWithTitle:alternateButton]; [aButton setTag:NSAlertAlternateReturn]; } + if (otherButton) { aButton = [alert addButtonWithTitle:otherButton]; [aButton setTag:NSAlertOtherReturn]; } // Set alert style - [alert setAlertStyle:NSWarningAlertStyle]; - if(alertStyle) - [alert setAlertStyle:alertStyle]; + [alert setAlertStyle:alertStyle ? alertStyle : NSWarningAlertStyle]; // Set the informative message if supplied if (infoText) [alert setInformativeText:infoText]; - // Set the informative message if supplied - if (msg) [alert setMessageText:msg]; - // Run the alert on the main thread [alert beginSheetModalForWindow:docWindow modalDelegate:modalDelegate didEndSelector:didEndSelector contextInfo:contextInfo]; // wait for the sheet NSModalSession session = [NSApp beginModalSessionForWindow:[alert window]]; + for (;;) { // Since the returnCode can only be -1, 0, or 1 // run the session until returnCode was changed in // the didEndSelector method of the calling class - if(returnCode != &initialReturnCode) - break; + if (returnCode != &initialReturnCode) break; // Execute code on DefaultRunLoop [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; // Break the run loop if sheet was closed - if ([NSApp runModalSession:session] != NSRunContinuesResponse - || ![[alert window] isVisible]) - break; + if ([NSApp runModalSession:session] != NSRunContinuesResponse || ![[alert window] isVisible]) break; // Execute code on DefaultRunLoop [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode |