[Unison-hackers] Building Unison GUI on OSX 10.6
Benjamin C. Pierce
bcpierce at cis.upenn.edu
Sun Jul 17 15:26:29 EDT 2011
Very cool. :-)
To commit the changes yourself, create a file "logmsg" in the main directory (one up from src), then do "make checkin."
- B
P.S. Not sure whether this bit is needed...
> + (* Extract any command line profile or roots, and whether batch was set *)
> let clprofile = ref None in
> begin
> + let args = Prefs.scanCmdLine Uicommon.usageMsg in
> + (try
> + match Util.StringMap.find "batch" args with
> + | ["true"] -> Prefs.set Globals.batch true
> + | _ -> ()
> + with Not_found -> ());
... since -batch doesn't make much sense without also giving either two roots or a profile on the command line.
On Jul 17, 2011, at 2:25 PM, Alan Schmitt wrote:
> This is what I tried to do:
> - detect the -batch on the command line
> - if -batch was set, when update recognition is done, automatically
> start the sync without waiting for the user
>
> This means that doing a "-batch" without choosing the profile will
> open the profile window, then after update detection (i.e., after
> choosing the profile), the synchronization will automatically proceed.
>
> Here are the diffs. If you prefer that I do the commit myself, could
> you remind me the procedure? (I remember it's not just a "svn commit"
> ...)
>
> Alan
>
> ➜ src svn diff uimacbridgenew.ml
> Index: uimacbridgenew.ml
> ===================================================================
> --- uimacbridgenew.ml (revision 474)
> +++ uimacbridgenew.ml (working copy)
> @@ -142,11 +142,16 @@
> initGlobalProgress Uutil.Filesize.dummy;
> (* Make sure we have a directory for archives and profiles *)
> Os.createUnisonDir();
> - (* Extract any command line profile or roots *)
> + (* Extract any command line profile or roots, and whether batch was set *)
> let clprofile = ref None in
> begin
> + let args = Prefs.scanCmdLine Uicommon.usageMsg in
> + (try
> + match Util.StringMap.find "batch" args with
> + | ["true"] -> Prefs.set Globals.batch true
> + | _ -> ()
> + with Not_found -> ());
> try
> - let args = Prefs.scanCmdLine Uicommon.usageMsg in
> match Util.StringMap.find "rest" args with
> [] -> ()
> | [profile] -> clprofile := Some profile
> @@ -196,7 +201,13 @@
> ;;
> Callback.register "areRootsSet" areRootsSet;;
>
> +(* Utility function to tell the UI whether -batch is set *)
>
> +let isBatchSet () =
> + Prefs.read Globals.batch
> +;;
> +Callback.register "isBatchSet" isBatchSet;;
> +
> (* The first time we load preferences, we also read the command line
> arguments; if we re-load prefs (because the user selected a new profile)
> we ignore the command line *)
>
>
> ➜ src svn diff uimacnew09/MyController.m
> Index: uimacnew09/MyController.m
> ===================================================================
> --- uimacnew09/MyController.m (revision 474)
> +++ uimacnew09/MyController.m (working copy)
> @@ -109,15 +109,15 @@
>
> /* Command-line processing */
> OCamlValue *clprofile = (id)ocamlCall("@", "unisonInit0");
> - BOOL areRootsSet = (long)ocamlCall("i@", "areRootsSet") ? YES : NO;
> +
> + BOOL areRootsSet = (long)ocamlCall("i", "areRootsSet") ? YES : NO;
> if (areRootsSet) {
> NSLog(@"Roots are on the command line");
> }
> else {
> NSLog(@"Roots are not set on the command line");
> }
> -
> -
> +
> /* Add toolbar */
> toolbar = [[[UnisonToolbar alloc]
> initWithIdentifier: @"unisonToolbar" :self :tableView]
> autorelease];
> @@ -166,12 +166,12 @@
>
> [mainWindow display];
> [mainWindow makeKeyAndOrderFront:nil];
> -
> +
> /* unless user has clicked Don't ask me again, ask about cltool */
> - if ( ([[NSUserDefaults standardUserDefaults] boolForKey:@"CheckCltool"]) &&
> - (![[NSFileManager defaultManager]
> - fileExistsAtPath:@"/usr/bin/unison"]) )
> - [self raiseCltoolWindow:nil];
> + if ( ([[NSUserDefaults standardUserDefaults] boolForKey:@"CheckCltool"]) &&
> + (![[NSFileManager defaultManager]
> + fileExistsAtPath:@"/usr/bin/unison"]) )
> + [self raiseCltoolWindow:nil];
> }
>
> - (IBAction) checkOpenProfileChanged:(id)sender {
> @@ -539,7 +539,25 @@
> ocamlCall("x", "unisonInit2");
> }
>
> +- (void)doSync
> +{
> + [tableView setEditable:NO];
> + syncable = NO;
> + duringSync = YES;
> +
> + [self updateToolbar];
> +
> + // This will run in another thread spawned in OCaml and will return
> immediately
> + // We'll get a call back to syncComplete() when it is complete
> + ocamlCall("x", "unisonSynchronize");
> +}
>
> +- (IBAction)syncButton:(id)sender
> +{
> + [self doSync];
> +}
> +
> +
> - (void)afterUpdate:(id)retainedReconItems
> {
> // NSLog(@"In afterUpdate:...");
> @@ -566,6 +584,17 @@
>
> [self updateTableViewWithReset:([reconItems count] > 0)];
> [self updateToolbar];
> + BOOL isBatchSet = (long)ocamlCall("i", "isBatchSet") ? YES : NO;
> + if (isBatchSet) {
> + NSLog(@"batch set on the command line");
> + }
> + else {
> + NSLog(@"batch not set on the command line");
> + }
> +
> + if (isBatchSet) {
> + [self doSync];
> + }
> }
>
> CAMLprim value unisonInit2Complete(value v)
> @@ -576,19 +605,6 @@
> return Val_unit;
> }
>
> -- (IBAction)syncButton:(id)sender
> -{
> - [tableView setEditable:NO];
> - syncable = NO;
> - duringSync = YES;
> -
> - [self updateToolbar];
> -
> - // This will run in another thread spawned in OCaml and will return
> immediately
> - // We'll get a call back to syncComplete() when it is complete
> - ocamlCall("x", "unisonSynchronize");
> -}
> -
> - (void)afterSync:(id)ignore
> {
> [notificationController syncFinishedFor:[self profile]];
> _______________________________________________
> Unison-hackers mailing list
> Unison-hackers at lists.seas.upenn.edu
> http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers
More information about the Unison-hackers
mailing list