diff options
author | Benjamin C. Pierce <bcpierce@cis.upenn.edu> | 2007-04-13 19:33:39 +0000 |
---|---|---|
committer | Benjamin C. Pierce <bcpierce@cis.upenn.edu> | 2007-04-13 19:33:39 +0000 |
commit | 275ec30d81e5b4d2c57280f63f2f1e4e6cf69047 (patch) | |
tree | 7d4b498a30eafebe637dbd114b88b6e698a96158 | |
parent | f8198495b64fb2d9b9afe656810f1729955aaaec (diff) | |
parent | b183fcf095df29fced15d5dd3945c9a3ff9a6abd (diff) | |
download | unison-275ec30d81e5b4d2c57280f63f2f1e4e6cf69047.zip unison-275ec30d81e5b4d2c57280f63f2f1e4e6cf69047.tar.gz unison-275ec30d81e5b4d2c57280f63f2f1e4e6cf69047.tar.bz2 |
* Copying over changes from 2.27 branch to developer sources (checkpoint)
-rw-r--r-- | src/Makefile.OCaml | 28 | ||||
-rw-r--r-- | src/RECENTNEWS | 33 | ||||
-rw-r--r-- | src/mkProjectInfo.ml | 60 | ||||
-rw-r--r-- | src/pty.c | 1 | ||||
-rw-r--r-- | src/uimacbridge.ml | 106 | ||||
-rw-r--r-- | src/uimacbridgenew.ml | 594 | ||||
-rw-r--r-- | src/uimacnew/English.lproj/InfoPlist.strings (renamed from src/uimac/English.lproj/InfoPlist.strings) | bin | 90 -> 90 bytes | |||
-rw-r--r-- | src/uimacnew/English.lproj/MainMenu.nib/classes.nib (renamed from src/uimac/English.lproj/MainMenu.nib/classes.nib) | 0 | ||||
-rw-r--r-- | src/uimacnew/English.lproj/MainMenu.nib/info.nib (renamed from src/uimac/English.lproj/MainMenu.nib/info.nib) | 0 | ||||
-rw-r--r-- | src/uimacnew/English.lproj/MainMenu.nib/keyedobjects.nib (renamed from src/uimac/English.lproj/MainMenu.nib/keyedobjects.nib) | bin | 37370 -> 37370 bytes | |||
-rw-r--r-- | src/uimacnew/English.lproj/MainMenu.nib/objects.nib (renamed from src/uimac/English.lproj/MainMenu.nib/objects.nib) | bin | 17091 -> 17091 bytes | |||
l--------- | src/uimacnew/Growl.framework/Growl (renamed from src/uimac/Growl.framework/Growl) | 0 | ||||
l--------- | src/uimacnew/Growl.framework/Headers (renamed from src/uimac/Growl.framework/Headers) | 0 | ||||
l--------- | src/uimacnew/Growl.framework/Resources (renamed from src/uimac/Growl.framework/Resources) | 0 | ||||
-rwxr-xr-x | src/uimacnew/Growl.framework/Versions/A/Growl (renamed from src/uimac/Growl.framework/Versions/A/Growl) | bin | 139412 -> 139412 bytes | |||
-rw-r--r-- | src/uimacnew/Growl.framework/Versions/A/Headers/Growl.h (renamed from src/uimac/Growl.framework/Versions/A/Headers/Growl.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/Growl.framework/Versions/A/Headers/GrowlApplicationBridge-Carbon.h (renamed from src/uimac/Growl.framework/Versions/A/Headers/GrowlApplicationBridge-Carbon.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h (renamed from src/uimac/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/Growl.framework/Versions/A/Headers/GrowlDefines.h (renamed from src/uimac/Growl.framework/Versions/A/Headers/GrowlDefines.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/Growl.framework/Versions/A/Resources/Info.plist (renamed from src/uimac/Growl.framework/Versions/A/Resources/Info.plist) | 0 | ||||
l--------- | src/uimacnew/Growl.framework/Versions/Current (renamed from src/uimac/Growl.framework/Versions/Current) | 0 | ||||
-rw-r--r-- | src/uimacnew/Info.plist.template (renamed from src/uimac/Info.plist.template) | 0 | ||||
-rw-r--r-- | src/uimacnew/MyController.h (renamed from src/uimac/MyController.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/MyController.m (renamed from src/uimac/MyController.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/NotificationController.h (renamed from src/uimac/NotificationController.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/NotificationController.m (renamed from src/uimac/NotificationController.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/PreferencesController.h (renamed from src/uimac/PreferencesController.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/PreferencesController.m (renamed from src/uimac/PreferencesController.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/ProfileController.h (renamed from src/uimac/ProfileController.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/ProfileController.m (renamed from src/uimac/ProfileController.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/ProfileTableView.h (renamed from src/uimac/ProfileTableView.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/ProfileTableView.m (renamed from src/uimac/ProfileTableView.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/ReconItem.h (renamed from src/uimac/ReconItem.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/ReconItem.m (renamed from src/uimac/ReconItem.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/ReconTableView.h (renamed from src/uimac/ReconTableView.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/ReconTableView.m (renamed from src/uimac/ReconTableView.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/TrevorsUnison.icns (renamed from src/uimac/TrevorsUnison.icns) | bin | 24548 -> 24548 bytes | |||
-rw-r--r-- | src/uimacnew/Unison.icns (renamed from src/uimac/Unison.icns) | bin | 44086 -> 44086 bytes | |||
-rw-r--r-- | src/uimacnew/UnisonToolbar.h (renamed from src/uimac/UnisonToolbar.h) | 0 | ||||
-rw-r--r-- | src/uimacnew/UnisonToolbar.m (renamed from src/uimac/UnisonToolbar.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/cltool.c (renamed from src/uimac/cltool.c) | 0 | ||||
-rw-r--r-- | src/uimacnew/main.m (renamed from src/uimac/main.m) | 0 | ||||
-rw-r--r-- | src/uimacnew/tableicons/table-conflict.tif (renamed from src/uimac/tableicons/table-conflict.tif) | bin | 5240 -> 5240 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-error.tif (renamed from src/uimac/tableicons/table-error.tif) | bin | 5254 -> 5254 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-left-blue.tif (renamed from src/uimac/tableicons/table-left-blue.tif) | bin | 5240 -> 5240 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-left-green.tif (renamed from src/uimac/tableicons/table-left-green.tif) | bin | 5242 -> 5242 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-merge.tif (renamed from src/uimac/tableicons/table-merge.tif) | bin | 5236 -> 5236 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-right-blue.tif (renamed from src/uimac/tableicons/table-right-blue.tif) | bin | 5242 -> 5242 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-right-green.tif (renamed from src/uimac/tableicons/table-right-green.tif) | bin | 5242 -> 5242 bytes | |||
-rw-r--r-- | src/uimacnew/tableicons/table-skip.tif (renamed from src/uimac/tableicons/table-skip.tif) | bin | 5236 -> 5236 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/add.tif (renamed from src/uimac/toolbar/add.tif) | bin | 5488 -> 5488 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/diff.tif (renamed from src/uimac/toolbar/diff.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/go.tif (renamed from src/uimac/toolbar/go.tif) | bin | 5488 -> 5488 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/left.tif (renamed from src/uimac/toolbar/left.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/merge.tif (renamed from src/uimac/toolbar/merge.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/quit.tif (renamed from src/uimac/toolbar/quit.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/rescan.tif (renamed from src/uimac/toolbar/rescan.tif) | bin | 5512 -> 5512 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/restart.tif (renamed from src/uimac/toolbar/restart.tif) | bin | 5492 -> 5492 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/right.tif (renamed from src/uimac/toolbar/right.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/save.tif (renamed from src/uimac/toolbar/save.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/toolbar/skip.tif (renamed from src/uimac/toolbar/skip.tif) | bin | 5490 -> 5490 bytes | |||
-rw-r--r-- | src/uimacnew/uimac.pbproj/project.pbxproj (renamed from src/uimac/uimac.pbproj/project.pbxproj) | 0 | ||||
-rw-r--r-- | src/uimacnew/uimac.xcodeproj/project.pbxproj (renamed from src/uimac/uimac.xcodeproj/project.pbxproj) | 0 | ||||
-rw-r--r-- | src/uitext.ml | 58 |
64 files changed, 703 insertions, 177 deletions
diff --git a/src/Makefile.OCaml b/src/Makefile.OCaml index d573807..c212e36 100644 --- a/src/Makefile.OCaml +++ b/src/Makefile.OCaml @@ -55,13 +55,14 @@ OCAMLLIBDIR=$(shell ocamlc -v | tail -n -1 | sed -e 's/.* //g' | sed -e 's/\\/\/ # UISTYLE=text # UISTYLE=gtk # UISTYLE=gtk2 -# UISTYLE=mac +# UISTYLE=mac (old and limited, but working) +# UISTYLE=macnew (spiffy, but not yet working) # # This should be set to an appropriate value automatically, depending # on whether the lablgtk library is available LABLGTKLIB=$(OCAMLLIBDIR)/lablgtk LABLGTK2LIB=$(OCAMLLIBDIR)/lablgtk2 -##BCP [3/2007]: Removed temporarily, since OSX UI is not working well +##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=mac @@ -133,20 +134,26 @@ clean:: ifeq ($(UISTYLE),mac) buildexecutable:: macexecutable + UIMACDIR=uimac +else +ifeq ($(UISTYLE),macnew) + buildexecutable:: macexecutable + UIMACDIR=uimacnew else buildexecutable:: $(NAME)$(EXEC_EXT) endif +endif # NOTE: the OCAMLLIBDIR is not getting passed correctly? # The two cases for cltool are needed because Xcode 2.1+ # builds in build/Default/, and earlier versions use build/ macexecutable: $(NAME)-blob.o - sed -e's/@@VERSION@@/$(VERSION)/' uimac/Info.plist.template > uimac/Info.plist - (cd uimac; xcodebuild OCAMLLIBDIR="$(OCAMLLIBDIR)") - if [ -e uimac/build/Default ]; then \ - gcc uimac/cltool.c -o uimac/build/Default/Unison.app/Contents/MacOS/cltool -framework Carbon; \ + sed -e's/@@VERSION@@/$(VERSION)/' $(UIMACDIR)/Info.plist.template > $(UIMACDIR)/Info.plist + (cd $(UIMACDIR); xcodebuild OCAMLLIBDIR="$(OCAMLLIBDIR)") + if [ -e $(UIMACDIR)/build/Default ]; then \ + gcc $(UIMACDIR)/cltool.c -o $(UIMACDIR)/build/Default/Unison.app/Contents/MacOS/cltool -framework Carbon; \ else \ - gcc uimac/cltool.c -o uimac/build/Unison.app/Contents/MacOS/cltool -framework Carbon; \ + gcc $(UIMACDIR)/cltool.c -o $(UIMACDIR)/build/Unison.app/Contents/MacOS/cltool -framework Carbon; \ fi # OCaml objects for the bytecode version @@ -185,11 +192,16 @@ ifeq ($(UISTYLE), text) OCAMLOBJS+=linktext.cmo endif -## Mac UI +## Old Mac UI ifeq ($(UISTYLE),mac) OCAMLOBJS+=uimacbridge.cmo endif +## New Mac UI +ifeq ($(UISTYLE),macnew) + OCAMLOBJS+=uimacbridgenew.cmo +endif + ## Graphic UI # Setup the lib directories diff --git a/src/RECENTNEWS b/src/RECENTNEWS index 6dde8bc..d5a960d 100644 --- a/src/RECENTNEWS +++ b/src/RECENTNEWS @@ -1,4 +1,35 @@ -CHANGES FROM VERSION 2.27.13 +CHANGES FROM VERSION 2.27.14 + +* Copying over changes from 2.27 branch to developer sources (checkpoint) + +------------------------------- +CHANGES FROM VERSION 2.27.14 + +* Copying over changes from 2.27 branch to developer sources (checkpoint) + +------------------------------- +CHANGES FROM VERSION 2.27.17 + +* Restored old OSX GUI from version 2.17. This UI is not nearly as + pretty or featureful as the new one that's been under construction + for a while, but at least it works! (The new one does not handle + multiple UI threads correctly when it is calling back and forth + between OCaml and Objective C, leading to UI freezes and random + crashes.) + + Building Unison with 'make UISTYLE=mac' will build you the old, + working UI. Building with 'make UISTYLE=macnew' will build you the + new UI, in case you'd like to help fix it. :-) + +------------------------------- +CHANGES FROM VERSION 2.27.16 + +* Rename OSX GUI from "mac" to "macnew" (in preparation for restoring old + GUI and calling it "mac") + + +------------------------------- +CHANGES FROM VERSION 2.27.15 * Correction to earlier patch diff --git a/src/mkProjectInfo.ml b/src/mkProjectInfo.ml index 2b74782..098427c 100644 --- a/src/mkProjectInfo.ml +++ b/src/mkProjectInfo.ml @@ -51,63 +51,3 @@ Printf.printf "VERSION=%d.%d.%d\n" majorVersion minorVersion pointVersion;; Printf.printf "NAME=%s\n" projectName;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -21,6 +21,7 @@ extern void uerror (char * cmdname, value arg) Noreturn; #endif #ifdef __FreeBSD__ +#include <sys/types.h> #include <libutil.h> #define HAS_OPENPTY 1 #endif diff --git a/src/uimacbridge.ml b/src/uimacbridge.ml index 849ff24..9e6ee50 100644 --- a/src/uimacbridge.ml +++ b/src/uimacbridge.ml @@ -21,29 +21,7 @@ let theState = ref [| |];; let unisonDirectory() = Fspath.toString Os.unisonDir ;; Callback.register "unisonDirectory" unisonDirectory;; - -(* Global progress indicator, similar to uigtk2.m; *) -external displayGlobalProgress : float -> unit = "displayGlobalProgress";; - -let totalBytesToTransfer = ref Uutil.Filesize.zero;; -let totalBytesTransferred = ref Uutil.Filesize.zero;; - -let showGlobalProgress b = - (* Concatenate the new message *) - totalBytesTransferred := Uutil.Filesize.add !totalBytesTransferred b; - let v = - if !totalBytesToTransfer = Uutil.Filesize.dummy then 0. - else if !totalBytesToTransfer = Uutil.Filesize.zero then 100. - else (Uutil.Filesize.percentageOfTotalSize - !totalBytesTransferred !totalBytesToTransfer) - in - displayGlobalProgress v;; - -let initGlobalProgress b = - totalBytesToTransfer := b; - totalBytesTransferred := Uutil.Filesize.zero; - showGlobalProgress Uutil.Filesize.zero;; - + (* Defined in MyController.m, used to redisplay the table when the status for a row changes *) external displayStatus : string -> unit = "displayStatus";; @@ -66,7 +44,6 @@ let showProgress i bytes dbg = Printf.sprintf "%5s " (Uutil.Filesize.toString b) else Util.percent2string (Uutil.Filesize.percentageOfTotalSize b len) in item.statusMessage <- Some newstatus; - showGlobalProgress bytes; (* FIX: No status window in Mac version, see GTK version for how to do it *) reloadTable i;; @@ -92,8 +69,6 @@ let unisonInit0() = Trace.sendLogMsgsToStderr := false; (* Display progress in GUI *) Uutil.setProgressPrinter showProgress; - (* Initialise global progress so progress bar is not updated *) - initGlobalProgress Uutil.Filesize.dummy; (* Make sure we have a directory for archives and profiles *) Os.createUnisonDir(); (* Extract any command line profile or roots *) @@ -358,68 +333,12 @@ let unisonRiToProgress ri = | (_,Some (Util.Failed s),_) -> "FAILED";; Callback.register "unisonRiToProgress" unisonRiToProgress;; -(* --------------------------------------------------- *) - -(* Defined in MyController.m, used to show diffs *) -external displayDiff : string -> string -> unit = "displayDiff";; -external displayDiffErr : string -> unit = "displayDiffErr";; - -(* If only properties have changed, we can't diff or merge. - 'Can't diff' is produced (uicommon.ml) if diff is attemped - when either side has PropsChanged *) -let filesAreDifferent status1 status2 = - match status1, status2 with - `PropsChanged, `Unchanged -> false - | `Unchanged, `PropsChanged -> false - | `PropsChanged, `PropsChanged -> false - | _, _ -> true;; - -(* check precondition for diff; used to disable diff button *) -let canDiff ri = - match ri.ri.replicas with - Problem _ -> false - | Different((`FILE, status1, _, _),(`FILE, status2, _, _), _, _) -> - filesAreDifferent status1 status2 - | Different _ -> false;; -Callback.register "canDiff" canDiff;; - -(* from Uicommon *) -(* precondition: uc = File (Updates(_, ..) on both sides *) -let showDiffs ri printer errprinter id = - let p = ri.path in - match ri.replicas with - Problem _ -> - errprinter - "Can't diff files: there was a problem during update detection" - | Different((`FILE, status1, _, ui1), (`FILE, status2, _, ui2), _, _) -> - if filesAreDifferent status1 status2 then - (let (root1,root2) = Globals.roots() in - begin - try Files.diff root1 p ui1 root2 p ui2 printer id - with Util.Transient e -> errprinter e - end) - | Different _ -> - errprinter "Can't diff: path doesn't refer to a file in both replicas" - -let runShowDiffs ri i = - let file = Uutil.File.ofLine i in - showDiffs ri.ri displayDiff displayDiffErr file;; -Callback.register "runShowDiffs" runShowDiffs;; - -(* --------------------------------------------------- *) - let unisonSynchronize () = if Array.length !theState = 0 then Trace.status "Nothing to synchronize" else begin Trace.status "Propagating changes"; Transport.logStart (); - let totalLength = - Array.fold_left - (fun l si -> Uutil.Filesize.add l (Common.riLength si.ri)) - Uutil.Filesize.zero !theState in - displayGlobalProgress 0.; - initGlobalProgress totalLength; let t = Trace.startTimer "Propagating changes" in let im = Array.length !theState in let rec loop i actions pRiThisRound = @@ -432,12 +351,10 @@ let unisonSynchronize () = return () else catch (fun () -> - Transport.transportItem - theSI.ri (Uutil.File.ofLine i) - (fun title text -> - debug (fun () -> Util.msg "MERGE '%s': '%s'" - title text); - displayDiff title text; true) + Transport.transportItem + theSI.ri (Uutil.File.ofLine i) + (fun title text -> + Trace.status (Printf.sprintf "MERGE %s: %s" title text); true) >>= (fun () -> return Util.Succeeded)) (fun e -> @@ -488,7 +405,6 @@ let unisonSynchronize () = Trace.status (Printf.sprintf "Synchronization complete %s%s%s" failures (if failures=""||skipped="" then "" else ", ") skipped); - initGlobalProgress Uutil.Filesize.zero; end;; Callback.register "unisonSynchronize" unisonSynchronize;; @@ -555,16 +471,6 @@ let unisonRiIsConflict ri = | Different(_,_,_,Conflict) -> true | _ -> false;; Callback.register "unisonRiIsConflict" unisonRiIsConflict;; - -(* Test whether reconItem's current state is different from - Unison's recommendation. Used to colour arrows in - the reconItems table *) -let changedFromDefault ri = - match ri.ri.replicas with - Different(_,_,{contents=curr},default) -> curr<>default - | _ -> false;; -Callback.register "changedFromDefault" changedFromDefault;; - let unisonRiRevert ri = match ri.ri.replicas with | Different(_,_,d,d0) -> d := d0 @@ -580,7 +486,6 @@ let unisonProfileInit (profileName:string) (r1:string) (r2:string) = Callback.register "unisonProfileInit" unisonProfileInit;; Callback.register "unisonPasswordMsg" Terminal.password;; -Callback.register "unisonPassphraseMsg" Terminal.passphrase;; Callback.register "unisonAuthenticityMsg" Terminal.authenticity;; let unisonExnInfo e = @@ -591,4 +496,3 @@ let unisonExnInfo e = Printf.sprintf "Unix error(%s,%s,%s)" (Unix.error_message ue) s1 s2 | _ -> Printexc.to_string e;; Callback.register "unisonExnInfo" unisonExnInfo;; - diff --git a/src/uimacbridgenew.ml b/src/uimacbridgenew.ml new file mode 100644 index 0000000..849ff24 --- /dev/null +++ b/src/uimacbridgenew.ml @@ -0,0 +1,594 @@ +(* ML side of a bridge to C for the Mac GUI *) + +open Common;; +open Lwt;; + +let debug = Trace.debug "startup" + +let unisonNonGuiStartup() = begin + (* If there's no GUI, don't print progress in the GUI *) + Uutil.setProgressPrinter (fun _ _ _ -> ()); + Main.nonGuiStartup() (* If this returns the GUI should be started *) +end;; +Callback.register "unisonNonGuiStartup" unisonNonGuiStartup;; + +type stateItem = { mutable ri : reconItem; + mutable bytesTransferred : Uutil.Filesize.t; + mutable whatHappened : Util.confirmation option; + mutable statusMessage : string option };; +let theState = ref [| |];; + +let unisonDirectory() = Fspath.toString Os.unisonDir +;; +Callback.register "unisonDirectory" unisonDirectory;; + +(* Global progress indicator, similar to uigtk2.m; *) +external displayGlobalProgress : float -> unit = "displayGlobalProgress";; + +let totalBytesToTransfer = ref Uutil.Filesize.zero;; +let totalBytesTransferred = ref Uutil.Filesize.zero;; + +let showGlobalProgress b = + (* Concatenate the new message *) + totalBytesTransferred := Uutil.Filesize.add !totalBytesTransferred b; + let v = + if !totalBytesToTransfer = Uutil.Filesize.dummy then 0. + else if !totalBytesToTransfer = Uutil.Filesize.zero then 100. + else (Uutil.Filesize.percentageOfTotalSize + !totalBytesTransferred !totalBytesToTransfer) + in + displayGlobalProgress v;; + +let initGlobalProgress b = + totalBytesToTransfer := b; + totalBytesTransferred := Uutil.Filesize.zero; + showGlobalProgress Uutil.Filesize.zero;; + +(* Defined in MyController.m, used to redisplay the table + when the status for a row changes *) +external displayStatus : string -> unit = "displayStatus";; + +(* Defined in MyController.m, used to redisplay the table + when the status for a row changes *) +external reloadTable : int -> unit = "reloadTable";; +(* from uigtk2 *) +let showProgress i bytes dbg = +(* Trace.status "showProgress"; *) +(* XXX There should be a way to reset the amount of bytes transferred... *) + let i = Uutil.File.toLine i in + let item = !theState.(i) in + item.bytesTransferred <- Uutil.Filesize.add item.bytesTransferred bytes; + let b = item.bytesTransferred in + let len = Common.riLength item.ri in + let newstatus = + if b = Uutil.Filesize.zero || len = Uutil.Filesize.zero then "start " + else if len = Uutil.Filesize.zero then + Printf.sprintf "%5s " (Uutil.Filesize.toString b) + else Util.percent2string (Uutil.Filesize.percentageOfTotalSize b len) in + item.statusMessage <- Some newstatus; + showGlobalProgress bytes; +(* FIX: No status window in Mac version, see GTK version for how to do it *) + reloadTable i;; + +let unisonGetVersion() = Uutil.myVersion +;; +Callback.register "unisonGetVersion" unisonGetVersion;; + +(* snippets from Uicommon, duplicated for now *) +(* BCP: Duplicating this is a bad idea!!! *) +(* First initialization sequence *) +(* Returns a string option: command line profile, if any *) +let unisonInit0() = + ignore (Gc.set {(Gc.get ()) with Gc.max_overhead = 150}); + (* Install an appropriate function for finding preference files. (We put + this in Util just because the Prefs module lives below the Os module in the + dependency hierarchy, so Prefs can't call Os directly.) *) + Util.supplyFileInUnisonDirFn + (fun n -> Fspath.toString (Os.fileInUnisonDir(n))); + (* Display status in GUI instead of on stderr *) + let formatStatus major minor = (Util.padto 30 (major ^ " ")) ^ minor in + Trace.messageDisplayer := displayStatus; + Trace.statusFormatter := formatStatus; + Trace.sendLogMsgsToStderr := false; + (* Display progress in GUI *) + Uutil.setProgressPrinter showProgress; + (* Initialise global progress so progress bar is not updated *) + initGlobalProgress Uutil.Filesize.dummy; + (* Make sure we have a directory for archives and profiles *) + Os.createUnisonDir(); + (* Extract any command line profile or roots *) + let clprofile = ref None in + begin + try + let args = Prefs.scanCmdLine Uicommon.usageMsg in + match Util.StringMap.find "rest" args with + [] -> () + | [profile] -> clprofile := Some profile + | [root1;root2] -> Globals.setRawRoots [root1;root2] + | [root1;root2;profile] -> + Globals.setRawRoots [root1;root2]; + clprofile := Some profile + | _ -> + (Printf.eprintf + "%s was invoked incorrectly (too many roots)" Uutil.myName; + exit 1) + with Not_found -> () + end; + (* Print header for debugging output *) + debug (fun() -> + Printf.eprintf "%s, version %s\n\n" Uutil.myName Uutil.myVersion); + debug (fun() -> Util.msg "initializing UI"); + debug (fun () -> + (match !clprofile with + None -> Util.msg "No profile given on command line" + | Some s -> Printf.eprintf "Profile '%s' given on command line" s); + (match Globals.rawRoots() with + [] -> Util.msg "No roots given on command line" + | [root1;root2] -> + Printf.eprintf "Roots '%s' and '%s' given on command line" + root1 root2 + | _ -> assert false)); + begin match !clprofile with + None -> () + | Some n -> + let f = Prefs.profilePathname n in + if not(Sys.file_exists f) + then (Printf.eprintf "Profile %s does not exist" f; + exit 1) + end; + !clprofile +;; +Callback.register "unisonInit0" unisonInit0;; + +(* 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 *) +let firstTime = ref(true) + +(* After figuring out the profile name *) +let unisonInit1 profileName = + (* Load the profile and command-line arguments *) + (* Restore prefs to their default values, if necessary *) + if not !firstTime then Prefs.resetToDefaults(); + + (* Tell the preferences module the name of the profile *) + Prefs.profileName := Some(profileName); + + (* If the profile does not exist, create an empty one (this should only + happen if the profile is 'default', since otherwise we will already + have checked that the named one exists). *) + if not(Sys.file_exists (Prefs.profilePathname profileName)) then + Prefs.addComment "Unison preferences file"; + + (* Load the profile *) + (Trace.debug "" (fun() -> Util.msg "about to load prefs"); + Prefs.loadTheFile()); + + (* Parse the command line. This will temporarily override + settings from the profile. *) + if !firstTime then begin + Trace.debug "" (fun() -> Util.msg "about to parse command line"); + Prefs.parseCmdLine Uicommon.usageMsg; + end; + + firstTime := false; + + (* Print the preference settings *) + Trace.debug "" (fun() -> Prefs.dumpPrefsToStderr() ); + + (* FIX: if no roots, ask the user *) + let localRoots,remoteRoots = + Safelist.partition + (function Clroot.ConnectLocal _ -> true | _ -> false) + (Safelist.map Clroot.parseRoot (Globals.rawRoots())) in + + match remoteRoots with + [r] -> + (* FIX: tell the user the next step (contacting server) might + take a while *) + Remote.openConnectionStart r + | _::_::_ -> + raise(Util.Fatal "cannot synchronize more than one remote root"); + | _ -> None +;; +Callback.register "unisonInit1" unisonInit1;; +Callback.register "openConnectionPrompt" Remote.openConnectionPrompt;; +Callback.register "openConnectionReply" Remote.openConnectionReply;; +Callback.register "openConnectionEnd" Remote.openConnectionEnd;; +Callback.register "openConnectionCancel" Remote.openConnectionCancel;; + +let unisonInit2 () = + (* Canonize the names of the roots and install them in Globals. *) + Globals.installRoots2(); + + (* If both roots are local, disable the xferhint table to save time *) + begin match Globals.roots() with + ((Local,_),(Local,_)) -> Prefs.set Xferhint.xferbycopying false + | _ -> () + end; + + (* If no paths were specified, then synchronize the whole replicas *) + if Prefs.read Globals.paths = [] then Prefs.set Globals.paths [Path.empty]; + + (* Expand any "wildcard" paths [with final component *] *) + Globals.expandWildcardPaths(); + + Update.storeRootsName (); + + Trace.debug "" + (fun() -> + Printf.eprintf "Roots: \n"; + Safelist.iter (fun clr -> Printf.eprintf " %s\n" clr) + (Globals.rawRoots ()); + Printf.eprintf " i.e. \n"; + Safelist.iter (fun clr -> Printf.eprintf " %s\n" + (Clroot.clroot2string (Clroot.parseRoot clr))) + (Globals.rawRoots ()); + Printf.eprintf " i.e. (in canonical order)\n"; + Safelist.iter (fun r -> + Printf.eprintf " %s\n" (root2string r)) + (Globals.rootsInCanonicalOrder()); + Printf.eprintf "\n" + ); + + Recon.checkThatPreferredRootIsValid(); + + Lwt_unix.run + (Uicommon.checkCaseSensitivity () >>= + Globals.propagatePrefs); + + (* Initializes some backups stuff according to the preferences just loaded from the profile. + Important to do it here, after prefs are propagated, because the function will also be + run on the server, if any. Also, this should be done each time a profile is reloaded + on this side, that's why it's here. *) + Stasher.initBackups (); + + (* Turn on GC messages, if the '-debug gc' flag was provided *) + if Trace.enabled "gc" then Gc.set {(Gc.get ()) with Gc.verbose = 0x3F}; + + (* BCPFIX: Should/can this be done earlier?? *) + Files.processCommitLogs(); + + (* from Uigtk2 *) + (* detect updates and reconcile *) + let _ = Globals.roots () in + let t = Trace.startTimer "Checking for updates" in + let findUpdates () = + Trace.status "Looking for changes"; + let updates = Update.findUpdates () in + Trace.showTimer t; + updates in + let reconcile updates = Recon.reconcileAll updates in + let (reconItemList, thereAreEqualUpdates, dangerousPaths) = + reconcile (findUpdates ()) in + if reconItemList = [] then + if thereAreEqualUpdates then + Trace.status "Replicas have been changed only in identical ways since last sync" + else + Trace.status "Everything is up to date" + else + Trace.status "Check and/or adjust selected actions; then press Go"; + Trace.status (Printf.sprintf "There are %d reconitems" (Safelist.length reconItemList)); + let stateItemList = + Safelist.map + (fun ri -> { ri = ri; bytesTransferred = Uutil.Filesize.zero; + whatHappened = None; statusMessage = None }) + reconItemList in + theState := Array.of_list stateItemList; + if dangerousPaths <> [] then begin + Prefs.set Globals.batch false; + Util.warn (Uicommon.dangerousPathMsg dangerousPaths) + end; + !theState +;; +Callback.register "unisonInit2" unisonInit2;; + +let unisonRiToDetails ri = + match ri.whatHappened with + Some (Util.Failed s) -> (Path.toString ri.ri.path) ^ "\n" ^ s + | _ -> (Path.toString ri.ri.path) ^ "\n" ^ (Uicommon.details2string ri.ri " ");; +Callback.register "unisonRiToDetails" unisonRiToDetails;; + +let unisonRiToPath ri = Path.toString ri.ri.path;; +Callback.register "unisonRiToPath" unisonRiToPath;; + +let rcToString (_,status,_,_) = + match status with + `Deleted -> "Deleted" + | `Modified -> "Modified" + | `PropsChanged -> "PropsChanged" + | `Created -> "Created" + | `Unchanged -> "";; +let unisonRiToLeft ri = + match ri.ri.replicas with + Problem _ -> "" + | Different(rc,_,_,_) -> rcToString rc;; +Callback.register "unisonRiToLeft" unisonRiToLeft;; +let unisonRiToRight ri = + match ri.ri.replicas with + Problem _ -> "" + | Different(_,rc,_,_) -> rcToString rc;; +Callback.register "unisonRiToRight" unisonRiToRight;; + +let direction2niceString = function (* from Uicommon where it's not exported *) + Conflict -> "<-?->" + | Replica1ToReplica2 -> "---->" + | Replica2ToReplica1 -> "<----" + | Merge -> "<-M->" +let unisonRiToDirection ri = + match ri.ri.replicas with + Problem _ -> "XXXXX" + | Different(_,_,d,_) -> direction2niceString !d;; +Callback.register "unisonRiToDirection" unisonRiToDirection;; + +let unisonRiSetLeft ri = + match ri.ri.replicas with + Problem _ -> () + | Different(_,_,d,_) -> d := Replica2ToReplica1;; +Callback.register "unisonRiSetLeft" unisonRiSetLeft;; +let unisonRiSetRight ri = + match ri.ri.replicas with + Problem _ -> () + | Different(_,_,d,_) -> d := Replica1ToReplica2;; +Callback.register "unisonRiSetRight" unisonRiSetRight;; +let unisonRiSetConflict ri = + match ri.ri.replicas with + Problem _ -> () + | Different(_,_,d,_) -> d := Conflict;; +Callback.register "unisonRiSetConflict" unisonRiSetConflict;; +let unisonRiSetMerge ri = + match ri.ri.replicas with + Problem _ -> () + | Different(_,_,d,_) -> d := Merge;; +Callback.register "unisonRiSetMerge" unisonRiSetMerge;; +let unisonRiForceOlder ri = + Recon.setDirection ri.ri `Older `Force;; +Callback.register "unisonRiForceOlder" unisonRiForceOlder;; +let unisonRiForceNewer ri = + Recon.setDirection ri.ri `Newer `Force;; +Callback.register "unisonRiForceNewer" unisonRiForceNewer;; + +let unisonRiToProgress ri = + match (ri.statusMessage, ri.whatHappened,ri.ri.replicas) with + (None,None,_) -> "" + | (Some s,None,_) -> s + | (_,_,Different(_,_,{contents=Conflict},_)) -> "" + | (_,_,Problem _) -> "" + | (_,Some Util.Succeeded,_) -> "done" + | (_,Some (Util.Failed s),_) -> "FAILED";; +Callback.register "unisonRiToProgress" unisonRiToProgress;; + +(* --------------------------------------------------- *) + +(* Defined in MyController.m, used to show diffs *) +external displayDiff : string -> string -> unit = "displayDiff";; +external displayDiffErr : string -> unit = "displayDiffErr";; + +(* If only properties have changed, we can't diff or merge. + 'Can't diff' is produced (uicommon.ml) if diff is attemped + when either side has PropsChanged *) +let filesAreDifferent status1 status2 = + match status1, status2 with + `PropsChanged, `Unchanged -> false + | `Unchanged, `PropsChanged -> false + | `PropsChanged, `PropsChanged -> false + | _, _ -> true;; + +(* check precondition for diff; used to disable diff button *) +let canDiff ri = + match ri.ri.replicas with + Problem _ -> false + | Different((`FILE, status1, _, _),(`FILE, status2, _, _), _, _) -> + filesAreDifferent status1 status2 + | Different _ -> false;; +Callback.register "canDiff" canDiff;; + +(* from Uicommon *) +(* precondition: uc = File (Updates(_, ..) on both sides *) +let showDiffs ri printer errprinter id = + let p = ri.path in + match ri.replicas with + Problem _ -> + errprinter + "Can't diff files: there was a problem during update detection" + | Different((`FILE, status1, _, ui1), (`FILE, status2, _, ui2), _, _) -> + if filesAreDifferent status1 status2 then + (let (root1,root2) = Globals.roots() in + begin + try Files.diff root1 p ui1 root2 p ui2 printer id + with Util.Transient e -> errprinter e + end) + | Different _ -> + errprinter "Can't diff: path doesn't refer to a file in both replicas" + +let runShowDiffs ri i = + let file = Uutil.File.ofLine i in + showDiffs ri.ri displayDiff displayDiffErr file;; +Callback.register "runShowDiffs" runShowDiffs;; + +(* --------------------------------------------------- *) + +let unisonSynchronize () = + if Array.length !theState = 0 then + Trace.status "Nothing to synchronize" + else begin + Trace.status "Propagating changes"; + Transport.logStart (); + let totalLength = + Array.fold_left + (fun l si -> Uutil.Filesize.add l (Common.riLength si.ri)) + Uutil.Filesize.zero !theState in + displayGlobalProgress 0.; + initGlobalProgress totalLength; + let t = Trace.startTimer "Propagating changes" in + let im = Array.length !theState in + let rec loop i actions pRiThisRound = + if i < im then begin + let theSI = !theState.(i) in + let action = + match theSI.whatHappened with + None -> + if not (pRiThisRound theSI.ri) then + return () + else + catch (fun () -> + Transport.transportItem + theSI.ri (Uutil.File.ofLine i) + (fun title text -> + debug (fun () -> Util.msg "MERGE '%s': '%s'" + title text); + displayDiff title text; true) + >>= (fun () -> + return Util.Succeeded)) + (fun e -> + match e with + Util.Transient s -> + return (Util.Failed s) + | _ -> + fail e) + >>= (fun res -> + theSI.whatHappened <- Some res; + return ()) + | Some _ -> + return () (* Already processed this one (e.g. merged it) *) + in + loop (i + 1) (action :: actions) pRiThisRound + end else + return actions + in + Lwt_unix.run + (loop 0 [] (fun ri -> not (Common.isDeletion ri)) >>= (fun actions -> + Lwt_util.join actions)); + Lwt_unix.run + (loop 0 [] Common.isDeletion >>= (fun actions -> + Lwt_util.join actions)); + Transport.logFinish (); + Trace.showTimer t; + Trace.status "Updating synchronizer state"; + let t = Trace.startTimer "Updating synchronizer state" in + Update.commitUpdates(); + Trace.showTimer t; + + let failures = + let count = + Array.fold_left + (fun l si -> + l + (match si.whatHappened with Some(Util.Failed(_)) -> 1 | _ -> 0)) + 0 !theState in + if count = 0 then "" else + Printf.sprintf "%d failure%s" count (if count=1 then "" else "s") in + let skipped = + let count = + Array.fold_left + (fun l si -> + l + (if problematic si.ri then 1 else 0)) + 0 !theState in + if count = 0 then "" else + Printf.sprintf "%d skipped" count in + Trace.status + (Printf.sprintf "Synchronization complete %s%s%s" + failures (if failures=""||skipped="" then "" else ", ") skipped); + initGlobalProgress Uutil.Filesize.zero; + end;; +Callback.register "unisonSynchronize" unisonSynchronize;; + +let unisonIgnorePath si = + Uicommon.addIgnorePattern (Uicommon.ignorePath si.ri.path);; +let unisonIgnoreExt si = + Uicommon.addIgnorePattern (Uicommon.ignoreExt si.ri.path);; +let unisonIgnoreName si = + Uicommon.addIgnorePattern (Uicommon.ignoreName si.ri.path);; +Callback.register "unisonIgnorePath" unisonIgnorePath;; +Callback.register "unisonIgnoreExt" unisonIgnoreExt;; +Callback.register "unisonIgnoreName" unisonIgnoreName;; + +(* Update the state to take into account ignore patterns. + Return the new index of the first state item that is + not ignored starting at old index i. +*) +let unisonUpdateForIgnore i = + let l = ref [] in + let num = ref(-1) in + let newI = ref None in + (* FIX: we should actually test whether any prefix is now ignored *) + let keep s = not (Globals.shouldIgnore s.ri.path) in + for j = 0 to (Array.length !theState - 1) do + let s = !theState.(j) in + if keep s then begin + l := s :: !l; + num := !num + 1; + if (j>=i && !newI=None) then newI := Some !num + end + done; + theState := Array.of_list (Safelist.rev !l); + match !newI with None -> (Array.length !theState - 1) + | Some i' -> i';; +Callback.register "unisonUpdateForIgnore" unisonUpdateForIgnore;; + +let unisonState () = !theState;; +Callback.register "unisonState" unisonState;; + +(* from Uicommon *) +let roots2niceStrings length = function + (Local,fspath1), (Local,fspath2) -> + let name1, name2 = Fspath.differentSuffix fspath1 fspath2 in + (Util.truncateString name1 length, Util.truncateString name2 length) + | (Local,fspath1), (Remote host, fspath2) -> + (Util.truncateString "local" length, Util.truncateString host length) + | (Remote host, fspath1), (Local,fspath2) -> + (Util.truncateString host length, Util.truncateString "local" length) + | _ -> assert false (* BOGUS? *);; +let unisonFirstRootString() = + let replica1, replica2 = roots2niceStrings 32 (Globals.roots()) in + replica1;; +let unisonSecondRootString() = + let replica1, replica2 = roots2niceStrings 32 (Globals.roots()) in + replica2;; +Callback.register "unisonFirstRootString" unisonFirstRootString;; +Callback.register "unisonSecondRootString" unisonSecondRootString;; + + +(* Note, this returns whether the files conflict, NOT whether + the current setting is Conflict *) +let unisonRiIsConflict ri = + match ri.ri.replicas with + | Different(_,_,_,Conflict) -> true + | _ -> false;; +Callback.register "unisonRiIsConflict" unisonRiIsConflict;; + +(* Test whether reconItem's current state is different from + Unison's recommendation. Used to colour arrows in + the reconItems table *) +let changedFromDefault ri = + match ri.ri.replicas with + Different(_,_,{contents=curr},default) -> curr<>default + | _ -> false;; +Callback.register "changedFromDefault" changedFromDefault;; + +let unisonRiRevert ri = + match ri.ri.replicas with + | Different(_,_,d,d0) -> d := d0 + | _ -> ();; +Callback.register "unisonRiRevert" unisonRiRevert;; + +let unisonProfileInit (profileName:string) (r1:string) (r2:string) = + Prefs.resetToDefaults(); + Prefs.profileName := Some(profileName); + Prefs.addComment "Unison preferences file"; (* Creates the file, assumes it doesn't exist *) + ignore (Prefs.add "root" r1); + ignore (Prefs.add "root" r2);; +Callback.register "unisonProfileInit" unisonProfileInit;; + +Callback.register "unisonPasswordMsg" Terminal.password;; +Callback.register "unisonPassphraseMsg" Terminal.passphrase;; +Callback.register "unisonAuthenticityMsg" Terminal.authenticity;; + +let unisonExnInfo e = + match e with + Util.Fatal s -> Printf.sprintf "Fatal error: %s" s + | Invalid_argument s -> Printf.sprintf "Invalid argument: %s" s + | Unix.Unix_error(ue,s1,s2) -> + Printf.sprintf "Unix error(%s,%s,%s)" (Unix.error_message ue) s1 s2 + | _ -> Printexc.to_string e;; +Callback.register "unisonExnInfo" unisonExnInfo;; + diff --git a/src/uimac/English.lproj/InfoPlist.strings b/src/uimacnew/English.lproj/InfoPlist.strings Binary files differindex f1eb09d..f1eb09d 100644 --- a/src/uimac/English.lproj/InfoPlist.strings +++ b/src/uimacnew/English.lproj/InfoPlist.strings diff --git a/src/uimac/English.lproj/MainMenu.nib/classes.nib b/src/uimacnew/English.lproj/MainMenu.nib/classes.nib index 13554ec..13554ec 100644 --- a/src/uimac/English.lproj/MainMenu.nib/classes.nib +++ b/src/uimacnew/English.lproj/MainMenu.nib/classes.nib diff --git a/src/uimac/English.lproj/MainMenu.nib/info.nib b/src/uimacnew/English.lproj/MainMenu.nib/info.nib index d748bc1..d748bc1 100644 --- a/src/uimac/English.lproj/MainMenu.nib/info.nib +++ b/src/uimacnew/English.lproj/MainMenu.nib/info.nib diff --git a/src/uimac/English.lproj/MainMenu.nib/keyedobjects.nib b/src/uimacnew/English.lproj/MainMenu.nib/keyedobjects.nib Binary files differindex 310eb8e..310eb8e 100644 --- a/src/uimac/English.lproj/MainMenu.nib/keyedobjects.nib +++ b/src/uimacnew/English.lproj/MainMenu.nib/keyedobjects.nib diff --git a/src/uimac/English.lproj/MainMenu.nib/objects.nib b/src/uimacnew/English.lproj/MainMenu.nib/objects.nib Binary files differindex bedbdda..bedbdda 100644 --- a/src/uimac/English.lproj/MainMenu.nib/objects.nib +++ b/src/uimacnew/English.lproj/MainMenu.nib/objects.nib diff --git a/src/uimac/Growl.framework/Growl b/src/uimacnew/Growl.framework/Growl index 85956e2..85956e2 120000 --- a/src/uimac/Growl.framework/Growl +++ b/src/uimacnew/Growl.framework/Growl diff --git a/src/uimac/Growl.framework/Headers b/src/uimacnew/Growl.framework/Headers index a177d2a..a177d2a 120000 --- a/src/uimac/Growl.framework/Headers +++ b/src/uimacnew/Growl.framework/Headers diff --git a/src/uimac/Growl.framework/Resources b/src/uimacnew/Growl.framework/Resources index 953ee36..953ee36 120000 --- a/src/uimac/Growl.framework/Resources +++ b/src/uimacnew/Growl.framework/Resources diff --git a/src/uimac/Growl.framework/Versions/A/Growl b/src/uimacnew/Growl.framework/Versions/A/Growl Binary files differindex 62cb342..62cb342 100755 --- a/src/uimac/Growl.framework/Versions/A/Growl +++ b/src/uimacnew/Growl.framework/Versions/A/Growl diff --git a/src/uimac/Growl.framework/Versions/A/Headers/Growl.h b/src/uimacnew/Growl.framework/Versions/A/Headers/Growl.h index e2a4425..e2a4425 100644 --- a/src/uimac/Growl.framework/Versions/A/Headers/Growl.h +++ b/src/uimacnew/Growl.framework/Versions/A/Headers/Growl.h diff --git a/src/uimac/Growl.framework/Versions/A/Headers/GrowlApplicationBridge-Carbon.h b/src/uimacnew/Growl.framework/Versions/A/Headers/GrowlApplicationBridge-Carbon.h index fb70509..fb70509 100644 --- a/src/uimac/Growl.framework/Versions/A/Headers/GrowlApplicationBridge-Carbon.h +++ b/src/uimacnew/Growl.framework/Versions/A/Headers/GrowlApplicationBridge-Carbon.h diff --git a/src/uimac/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h b/src/uimacnew/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h index 7ac315a..7ac315a 100644 --- a/src/uimac/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h +++ b/src/uimacnew/Growl.framework/Versions/A/Headers/GrowlApplicationBridge.h diff --git a/src/uimac/Growl.framework/Versions/A/Headers/GrowlDefines.h b/src/uimacnew/Growl.framework/Versions/A/Headers/GrowlDefines.h index 6ff6ee3..6ff6ee3 100644 --- a/src/uimac/Growl.framework/Versions/A/Headers/GrowlDefines.h +++ b/src/uimacnew/Growl.framework/Versions/A/Headers/GrowlDefines.h diff --git a/src/uimac/Growl.framework/Versions/A/Resources/Info.plist b/src/uimacnew/Growl.framework/Versions/A/Resources/Info.plist index 0444144..0444144 100644 --- a/src/uimac/Growl.framework/Versions/A/Resources/Info.plist +++ b/src/uimacnew/Growl.framework/Versions/A/Resources/Info.plist diff --git a/src/uimac/Growl.framework/Versions/Current b/src/uimacnew/Growl.framework/Versions/Current index 8c7e5a6..8c7e5a6 120000 --- a/src/uimac/Growl.framework/Versions/Current +++ b/src/uimacnew/Growl.framework/Versions/Current diff --git a/src/uimac/Info.plist.template b/src/uimacnew/Info.plist.template index 22a46af..22a46af 100644 --- a/src/uimac/Info.plist.template +++ b/src/uimacnew/Info.plist.template diff --git a/src/uimac/MyController.h b/src/uimacnew/MyController.h index bccb607..bccb607 100644 --- a/src/uimac/MyController.h +++ b/src/uimacnew/MyController.h diff --git a/src/uimac/MyController.m b/src/uimacnew/MyController.m index a2f6c50..a2f6c50 100644 --- a/src/uimac/MyController.m +++ b/src/uimacnew/MyController.m diff --git a/src/uimac/NotificationController.h b/src/uimacnew/NotificationController.h index 899bf83..899bf83 100644 --- a/src/uimac/NotificationController.h +++ b/src/uimacnew/NotificationController.h diff --git a/src/uimac/NotificationController.m b/src/uimacnew/NotificationController.m index 7749534..7749534 100644 --- a/src/uimac/NotificationController.m +++ b/src/uimacnew/NotificationController.m diff --git a/src/uimac/PreferencesController.h b/src/uimacnew/PreferencesController.h index 4a4a330..4a4a330 100644 --- a/src/uimac/PreferencesController.h +++ b/src/uimacnew/PreferencesController.h diff --git a/src/uimac/PreferencesController.m b/src/uimacnew/PreferencesController.m index e5479ac..e5479ac 100644 --- a/src/uimac/PreferencesController.m +++ b/src/uimacnew/PreferencesController.m diff --git a/src/uimac/ProfileController.h b/src/uimacnew/ProfileController.h index 20bbc97..20bbc97 100644 --- a/src/uimac/ProfileController.h +++ b/src/uimacnew/ProfileController.h diff --git a/src/uimac/ProfileController.m b/src/uimacnew/ProfileController.m index 0515399..0515399 100644 --- a/src/uimac/ProfileController.m +++ b/src/uimacnew/ProfileController.m diff --git a/src/uimac/ProfileTableView.h b/src/uimacnew/ProfileTableView.h index 2ff6a86..2ff6a86 100644 --- a/src/uimac/ProfileTableView.h +++ b/src/uimacnew/ProfileTableView.h diff --git a/src/uimac/ProfileTableView.m b/src/uimacnew/ProfileTableView.m index 7a3c1e1..7a3c1e1 100644 --- a/src/uimac/ProfileTableView.m +++ b/src/uimacnew/ProfileTableView.m diff --git a/src/uimac/ReconItem.h b/src/uimacnew/ReconItem.h index 2e4f074..2e4f074 100644 --- a/src/uimac/ReconItem.h +++ b/src/uimacnew/ReconItem.h diff --git a/src/uimac/ReconItem.m b/src/uimacnew/ReconItem.m index 544d070..544d070 100644 --- a/src/uimac/ReconItem.m +++ b/src/uimacnew/ReconItem.m diff --git a/src/uimac/ReconTableView.h b/src/uimacnew/ReconTableView.h index a976bc6..a976bc6 100644 --- a/src/uimac/ReconTableView.h +++ b/src/uimacnew/ReconTableView.h diff --git a/src/uimac/ReconTableView.m b/src/uimacnew/ReconTableView.m index 4021f43..4021f43 100644 --- a/src/uimac/ReconTableView.m +++ b/src/uimacnew/ReconTableView.m diff --git a/src/uimac/TrevorsUnison.icns b/src/uimacnew/TrevorsUnison.icns Binary files differindex e1fa6f8..e1fa6f8 100644 --- a/src/uimac/TrevorsUnison.icns +++ b/src/uimacnew/TrevorsUnison.icns diff --git a/src/uimac/Unison.icns b/src/uimacnew/Unison.icns Binary files differindex b7a4e60..b7a4e60 100644 --- a/src/uimac/Unison.icns +++ b/src/uimacnew/Unison.icns diff --git a/src/uimac/UnisonToolbar.h b/src/uimacnew/UnisonToolbar.h index 2020808..2020808 100644 --- a/src/uimac/UnisonToolbar.h +++ b/src/uimacnew/UnisonToolbar.h diff --git a/src/uimac/UnisonToolbar.m b/src/uimacnew/UnisonToolbar.m index fef964f..fef964f 100644 --- a/src/uimac/UnisonToolbar.m +++ b/src/uimacnew/UnisonToolbar.m diff --git a/src/uimac/cltool.c b/src/uimacnew/cltool.c index 9a1049d..9a1049d 100644 --- a/src/uimac/cltool.c +++ b/src/uimacnew/cltool.c diff --git a/src/uimac/main.m b/src/uimacnew/main.m index 1d8cb8d..1d8cb8d 100644 --- a/src/uimac/main.m +++ b/src/uimacnew/main.m diff --git a/src/uimac/tableicons/table-conflict.tif b/src/uimacnew/tableicons/table-conflict.tif Binary files differindex b84cd1b..b84cd1b 100644 --- a/src/uimac/tableicons/table-conflict.tif +++ b/src/uimacnew/tableicons/table-conflict.tif diff --git a/src/uimac/tableicons/table-error.tif b/src/uimacnew/tableicons/table-error.tif Binary files differindex 72ebafb..72ebafb 100644 --- a/src/uimac/tableicons/table-error.tif +++ b/src/uimacnew/tableicons/table-error.tif diff --git a/src/uimac/tableicons/table-left-blue.tif b/src/uimacnew/tableicons/table-left-blue.tif Binary files differindex 9a2ad1b..9a2ad1b 100644 --- a/src/uimac/tableicons/table-left-blue.tif +++ b/src/uimacnew/tableicons/table-left-blue.tif diff --git a/src/uimac/tableicons/table-left-green.tif b/src/uimacnew/tableicons/table-left-green.tif Binary files differindex e5f2909..e5f2909 100644 --- a/src/uimac/tableicons/table-left-green.tif +++ b/src/uimacnew/tableicons/table-left-green.tif diff --git a/src/uimac/tableicons/table-merge.tif b/src/uimacnew/tableicons/table-merge.tif Binary files differindex beb33ff..beb33ff 100644 --- a/src/uimac/tableicons/table-merge.tif +++ b/src/uimacnew/tableicons/table-merge.tif diff --git a/src/uimac/tableicons/table-right-blue.tif b/src/uimacnew/tableicons/table-right-blue.tif Binary files differindex 6cc7f30..6cc7f30 100644 --- a/src/uimac/tableicons/table-right-blue.tif +++ b/src/uimacnew/tableicons/table-right-blue.tif diff --git a/src/uimac/tableicons/table-right-green.tif b/src/uimacnew/tableicons/table-right-green.tif Binary files differindex 6a8a420..6a8a420 100644 --- a/src/uimac/tableicons/table-right-green.tif +++ b/src/uimacnew/tableicons/table-right-green.tif diff --git a/src/uimac/tableicons/table-skip.tif b/src/uimacnew/tableicons/table-skip.tif Binary files differindex 4cc8b8c..4cc8b8c 100644 --- a/src/uimac/tableicons/table-skip.tif +++ b/src/uimacnew/tableicons/table-skip.tif diff --git a/src/uimac/toolbar/add.tif b/src/uimacnew/toolbar/add.tif Binary files differindex 7d1e413..7d1e413 100644 --- a/src/uimac/toolbar/add.tif +++ b/src/uimacnew/toolbar/add.tif diff --git a/src/uimac/toolbar/diff.tif b/src/uimacnew/toolbar/diff.tif Binary files differindex c424403..c424403 100644 --- a/src/uimac/toolbar/diff.tif +++ b/src/uimacnew/toolbar/diff.tif diff --git a/src/uimac/toolbar/go.tif b/src/uimacnew/toolbar/go.tif Binary files differindex ed368e3..ed368e3 100644 --- a/src/uimac/toolbar/go.tif +++ b/src/uimacnew/toolbar/go.tif diff --git a/src/uimac/toolbar/left.tif b/src/uimacnew/toolbar/left.tif Binary files differindex 0633aff..0633aff 100644 --- a/src/uimac/toolbar/left.tif +++ b/src/uimacnew/toolbar/left.tif diff --git a/src/uimac/toolbar/merge.tif b/src/uimacnew/toolbar/merge.tif Binary files differindex d41dc06..d41dc06 100644 --- a/src/uimac/toolbar/merge.tif +++ b/src/uimacnew/toolbar/merge.tif diff --git a/src/uimac/toolbar/quit.tif b/src/uimacnew/toolbar/quit.tif Binary files differindex f2911c2..f2911c2 100644 --- a/src/uimac/toolbar/quit.tif +++ b/src/uimacnew/toolbar/quit.tif diff --git a/src/uimac/toolbar/rescan.tif b/src/uimacnew/toolbar/rescan.tif Binary files differindex 5e9ac45..5e9ac45 100644 --- a/src/uimac/toolbar/rescan.tif +++ b/src/uimacnew/toolbar/rescan.tif diff --git a/src/uimac/toolbar/restart.tif b/src/uimacnew/toolbar/restart.tif Binary files differindex fe58a07..fe58a07 100644 --- a/src/uimac/toolbar/restart.tif +++ b/src/uimacnew/toolbar/restart.tif diff --git a/src/uimac/toolbar/right.tif b/src/uimacnew/toolbar/right.tif Binary files differindex 1391f49..1391f49 100644 --- a/src/uimac/toolbar/right.tif +++ b/src/uimacnew/toolbar/right.tif diff --git a/src/uimac/toolbar/save.tif b/src/uimacnew/toolbar/save.tif Binary files differindex bc1a468..bc1a468 100644 --- a/src/uimac/toolbar/save.tif +++ b/src/uimacnew/toolbar/save.tif diff --git a/src/uimac/toolbar/skip.tif b/src/uimacnew/toolbar/skip.tif Binary files differindex 7ca1bb9..7ca1bb9 100644 --- a/src/uimac/toolbar/skip.tif +++ b/src/uimacnew/toolbar/skip.tif diff --git a/src/uimac/uimac.pbproj/project.pbxproj b/src/uimacnew/uimac.pbproj/project.pbxproj index 5fd3d1d..5fd3d1d 100644 --- a/src/uimac/uimac.pbproj/project.pbxproj +++ b/src/uimacnew/uimac.pbproj/project.pbxproj diff --git a/src/uimac/uimac.xcodeproj/project.pbxproj b/src/uimacnew/uimac.xcodeproj/project.pbxproj index 66719df..66719df 100644 --- a/src/uimac/uimac.xcodeproj/project.pbxproj +++ b/src/uimacnew/uimac.xcodeproj/project.pbxproj diff --git a/src/uitext.ml b/src/uitext.ml index af2afed..420685a 100644 --- a/src/uitext.ml +++ b/src/uitext.ml @@ -582,6 +582,47 @@ let synchronizeOnce() = (exitStatus, failedPaths) end +let watchinterval = 10 + +let charsRead = ref [] +let linesRead = ref [] +let whatcherchan = ref None + +(* +let suckOnFile () = + let ch = match !watcherchan with None -> assert false | Some(x) -> x in + let rec loop() = + match try Some(System.input_char ch) with End_of_file -> None with + None -> ... + | Some(c) -> + if c = '\n' then begin + linesRead := <turn (Safelist.rev !charsRead) into a string> :: !linesRead; + charsRead := [] + end else begin + charsRead := c :: !charsRead; + loop() + end in + loop() +*) + +let synchronizePathsFromFilesystemWatcher () = +assert false +(* + let watcherfilename = Prefs.read Uicommon.repeat in + ... open this file on both client and server and store a channel in + a global variable in each... + let rec loop failedPaths = + ... read (on both hosts) from this channel till it is empty, keep + any partial line in a buffer for next time, add all full lines + (from both hosts) to the Globals.paths preference, together + with failedPaths... + Prefs.set Globals.paths (failedPaths @ ...); + let (exitStatus,newFailedPaths) = synchronizeOnce() in + Trace.status (Printf.sprintf "\nSleeping for %d seconds...\n" watchinterval); + Unix.sleep watchinterval; + loop newFailedPaths +*) + let synchronizeUntilNoFailures () = let initValueOfPathsPreference = Prefs.read Globals.paths in let rec loop triesLeft = @@ -595,17 +636,20 @@ let synchronizeUntilNoFailures () = loop (Prefs.read Uicommon.retry) let rec synchronizeUntilDone () = + let repeatinterval = + if Prefs.read Uicommon.repeat = "" then -1 else + try int_of_string (Prefs.read Uicommon.repeat) + with Invalid_argument "int_of_string" -> + (* If the 'repeat' pref is not a number, switch modes... *) + synchronizePathsFromFilesystemWatcher() in + let exitStatus = synchronizeUntilNoFailures() in - if Prefs.read Uicommon.repeat = "" then - (* Done *) + if repeatinterval < 0 then exitStatus else begin (* Do it again *) - let n = try int_of_string (Prefs.read Uicommon.repeat) - with Invalid_argument "int_of_string" -> - assert false (* file watching not yet implemented *) in - Trace.status (Printf.sprintf "\nSleeping for %d seconds...\n" n); - Unix.sleep n; + Trace.status (Printf.sprintf "\nSleeping for %d seconds...\n" repeatinterval); + Unix.sleep repeatinterval; synchronizeUntilDone () end |