Instead we date stamp each entry and do a sorted fetch (with a limit of one) to find next/previous entry (when required).
The reason for moving away from an ordered collection is twofold, the main reason is that NSArrayController does not support ordered collections, so we lose one of the advantages of switching to CoreData. The secondary reason is that using an ordered collection requires that we use an index for “current item” (or maybe liberal use of indexOfObject:) and it’s problematic to ensure that the index is kept 100% in sync with the entries in the collection (especially with bindings and delayed actions).
If an exception is thrown, a dialog is shown. This isn’t very user friendly, but the goal is to call attention to the problem, as I wouldn’t expect any exceptions to be thrown by this method, but I have seen multiple “optimistic locking failure” exceptions despite single-app / single-thread access to the persistent store.
This is only done for code where running it twice would actually cause a problem.
Dispatch_once is favored over a static boolean only because it seems to carry slightly more semantic information.
Since we save the history during applicationWillTerminate: there is (in theory) no reason to periodically save the history, but in case of a crash or similar, we would not get to applicationWillTerminate:.
Previously this was stored in NSUserDefaults. The problem with that approach is that if large items were stored in the history, it would cause slowdowns, presumably by periodic writing the entire user defaults to disk.
Remove logic from the setter methods and limit their use. This is in preparation for making the classes NSManagedObject subclasses where we prefer to use the generated accessor methods.
We shouldn’t use Apple’s prefix for our own constants. The actual value of the constant hasn’t been renamed yet as this requires “migration” (renaming the key in user defaults).
When the tab bar overflows and the selected tab would normally be rendered outside the visible area, we use the last visible tab as a proxy. With this commit, the last visible tab keeps showing the document if switching to another (visible) tab.
The behavior is based on Safari where last visible tab is swapped with the selected tab, if selected tab itself would not be visible.
Commit edited by Allan Odgaard, original version used document icons in overflow menu and would make the effective last tab sticky.
Closes#1060
We compared the lowercased extension or file name with the case-preserved entry in the bindings.plist file, meaning e.g. ‘Makefile’ never got the intended icon.