Re: Temporarily disabling autosave
Re: Temporarily disabling autosave
- Subject: Re: Temporarily disabling autosave
- From: Mike Abdullah <email@hidden>
- Date: Sat, 20 Apr 2013 14:43:05 +0100
On 20 Apr 2013, at 04:17, Steve Mills <email@hidden> wrote:
> On Apr 19, 2013, at 16:51:20, Jerry Krinock <email@hidden>
> wrote:
>
>> Maybe you Steve and Alex Zavatone may be on to something there. You're suggesting that, rather than handling the autosave when it is requested during a long-winded operation, you turn autosave off *before* the long-winded operation begins, so that you won't get any such requests.
>
> Exactly, and it seems like such a basic part of the entire autosave concept that it's amazing Apple didn't build it in from the start.
Arguably they did! But that they did it by making periodic autosaves something your app can bail out of if it wishes, rather than have to explicitly tell the system to disable autosaving up-front. Two benefits come to mind:
1) It's a little more flexible. Your app can test for conditions on-demand. If it's not condition that can be easily detected when it becomes true, this avoids polling for it
2) Removes the danger that a developer might make a mistake that accidentally causes autosaving to never be re-enabled. I can easily imagine an unexpected exception triggering this, or some particular edge case in an if statement.
>
>> The problem with that is that the way you turn autosave off is by returning NO from +autosavesInPlace, which is a class method. I ask then: Why did Apple make +autosavesInPlace a class method, other than to make it difficult to change on the fly? You could do it with a static or global variable, I guess. Your results will definitely be interesting. Let us know what happens.
>
> Actually, I believe you're mistaken. autosaveInPlace merely tells autosave that, if turned on, it should replace the actual file once the autosave has completed successfully. If it's off, autosaves are stored elsewhere in a folder of NSDocument's choosing. The way to turn autosave on or off is through NSDocumentController's setAutosavingDelay method, where 0 means off. But, doing so doesn't seem to affect open documents if they've already scheduled an autosave (seems like a bug to me - turning it off from here should turn it off everywhere).
+autosavesInPlace controls whether to use the old or new document-saving model. This is primarily about how your users interact with the app. I'm pretty sure the document system is not designed to have this change underneath it while the app is running.
If for some reason you choose the old saving model, then NSDocumentController.autosavingDelay controls whether autosaves should be performed, and how frequently. I believe it has no effect whatsoever when the new document-saving model is in use.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden