[Unison-hackers] [unison-svn] r476 - in trunk/src: . lwt ubase uimacnew09 uimacnew09/uimacnew.xcodeproj
Steve Kalkwarf
steve at kalkwarf.com
Tue Jul 19 15:23:50 EDT 2011
> If you want to try the committed version …
MyController.m:630
'return' with a value, in function returning void
Try this code out:
In MyController.m:
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[_timer invalidate];
switch (returnCode) {
case NSAlertAlternateReturn:
return;
break;
default:
NSLog(@"Quit");
break;
}
}
- (void)updateCountdown
{
if (_secondsRemaining == 0) {
[_timer invalidate];
[[_timeoutAlert window] orderOut: nil];
[self alertDidEnd: _timeoutAlert returnCode: NSAlertDefaultReturn contextInfo: nil];
} else {
[_timeoutAlert setMessageText: [NSString stringWithFormat: @"Unison will quit in %lu seconds", _secondsRemaining]];
_secondsRemaining--;
}
}
- (void)quitIfBatch:(id)ignore
{
if (isBatchSet) {
NSLog(@"Automatically quitting because of -batch");
_timeoutAlert = [NSAlert alertWithMessageText: @"" defaultButton: @"Quit" alternateButton: @"Cancel" otherButton: nil informativeTextWithFormat: @""];
_secondsRemaining = 10;
_timer = [NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @selector(updateCountdown) userInfo: nil repeats: YES];
[_timeoutAlert beginSheetModalForWindow: [self window] modalDelegate: self didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:) contextInfo: NULL];
}
}
===
In MyController.h, add these iVars:
NSTimer *_timer;
NSAlert *_timeoutAlert;
NSUInteger _secondsRemaining;
Season to taste…
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4356 bytes
Desc: not available
URL: <http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20110719/58a5d494/attachment-0001.p7s>
More information about the Unison-hackers
mailing list