[Unison-hackers] [unison-svn] r479 - in trunk/src: . uimacnew09

bcpierce at seas.upenn.edu bcpierce at seas.upenn.edu
Wed Aug 3 10:40:09 EDT 2011


Author: bcpierce
Date: 2011-08-03 10:40:08 -0400 (Wed, 03 Aug 2011)
New Revision: 479

Modified:
   trunk/src/Makefile.OCaml
   trunk/src/RECENTNEWS
   trunk/src/mkProjectInfo.ml
   trunk/src/uimacnew09/MyController.h
   trunk/src/uimacnew09/MyController.m
Log:
* A small improvement to the uimacnew09 interface from Alan Schmitt
  and Steve Kalkwarf: when Unison is run with the -batch flag, the
  interface will now automatically propagate changes and terminate,
  without waiting for user interaction.

* uimacnew09 is now the standard graphical interface on OSX

Modified: trunk/src/Makefile.OCaml
===================================================================
--- trunk/src/Makefile.OCaml	2011-07-19 14:47:51 UTC (rev 478)
+++ trunk/src/Makefile.OCaml	2011-08-03 14:40:08 UTC (rev 479)
@@ -77,7 +77,7 @@
 ##BCP [3/2007]: Removed temporarily, since the OSX UI is not working well 
 ## at the moment and we don't want to confuse people by building it by default
 ifeq ($(OSARCH),osx)
-  UISTYLE=macnew
+  UISTYLE=macnew09
 else
   ifeq ($(wildcard $(LABLGTK2LIB)),$(LABLGTK2LIB))
     UISTYLE=gtk2

Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2011-07-19 14:47:51 UTC (rev 478)
+++ trunk/src/RECENTNEWS	2011-08-03 14:40:08 UTC (rev 479)
@@ -1,3 +1,12 @@
+CHANGES FROM VERSION 2.44.6
+
+* A small improvement to the uimacnew09 interface from Alan Schmitt
+  and Steve Kalkwarf: when Unison is run with the -batch flag, the
+  interface will now automatically propagate changes and terminate,
+  without waiting for user interaction.
+
+* uimacnew09 is now the standard graphical interface on OSX
+-------------------------------
 CHANGES FROM VERSION 2.44.5
 
 - uimacnew09: file details panel selectable

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2011-07-19 14:47:51 UTC (rev 478)
+++ trunk/src/mkProjectInfo.ml	2011-08-03 14:40:08 UTC (rev 479)
@@ -59,3 +59,4 @@
 
 
 
+

Modified: trunk/src/uimacnew09/MyController.h
===================================================================
--- trunk/src/uimacnew09/MyController.h	2011-07-19 14:47:51 UTC (rev 478)
+++ trunk/src/uimacnew09/MyController.h	2011-08-03 14:40:08 UTC (rev 479)
@@ -78,6 +78,9 @@
   id fontChangeTarget;
 	
   BOOL isBatchSet;
+  NSTimer *_timer;
+  NSAlert *_timeoutAlert;
+  NSUInteger _secondsRemaining;
 }
 
 - (id)init;

Modified: trunk/src/uimacnew09/MyController.m
===================================================================
--- trunk/src/uimacnew09/MyController.m	2011-07-19 14:47:51 UTC (rev 478)
+++ trunk/src/uimacnew09/MyController.m	2011-08-03 14:40:08 UTC (rev 479)
@@ -622,12 +622,45 @@
 	[self updateTableViewWithReset:FALSE];
 }
 
+- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+    [_timer invalidate];
+
+    switch (returnCode) {
+        case NSAlertAlternateReturn:
+            return;
+            break;
+            
+        default:
+            [[NSApplication sharedApplication] performSelector: @selector(terminate:) withObject: nil afterDelay: 0.0];
+            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");
-    [NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0];
-    return Val_unit;
+		_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: mainWindow modalDelegate: self didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:) contextInfo: NULL];
 	}  
 }
 



More information about the Unison-hackers mailing list