On 5 Feb 2006, at 12:17, Enrico Sersale wrote:
But now my problem is how to implement all the "graceful termination"
stuff; I suppose that I should add a "Logout" menu and send a
NSWorkspaceWillPowerOffNotification through the NSWorkspace notification
center;
I don't think that's necessary ... you can just send a -terminate message to
the application, and the app will generate an
NSWorkspaceWillPowerOffNotification internally.
but, unlike NSApplicationWillTerminateNotification, for
NSWorkspaceWillPowerOffNotification you must explicitly add your
application delegate as a observer of this notification; this means that
*all* the actually existing GNUstep applications will not work...
Well . they probably won't observe the NSWorkspaceWillPowerOffNotification
and won't call - extendPowerOffBy: ... but they should terminate properly. I
think apps probably only need to observe
NSWorkspaceWillPowerOffNotification is they expect their shutdown process to
take a relatively long time and want to ask for enough time to do it cleanly
(eg they need to save a lot of state information to disk).
Moreover, I can't find any Apple documentation about this.
Last question: which is the role of -extendPowerOffBy: in all this
mechanism?
I *think* the shutdown sequence should go like this ...
1. GWorkspace sends a -terminate to the applications.
2. GWorkspace waits some set time for applications to actually terminate.
3. After the timeout expires for an app, GWorkspace prompts the user to ask
whether the app should be killed forcibly, and then either kills the app or
abandons the shutdown process.