gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what to do now? (was: Re: Graceful termination again)


From: Enrico Sersale
Subject: Re: what to do now? (was: Re: Graceful termination again)
Date: Wed, 08 Feb 2006 13:50:27 +0200

On 2006-02-05 18:00:01 +0200 Richard Frith-Macdonald <address@hidden> wrote:


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.

I've implemented the logout mechanism following these rules.
It's on svn. If somebody notices bugs, please report them.

The -extendPowerOfBy: mechanism should allow the application to extend the timeout before GWorkspace forcibly kills it. I would suggest that GWorkspace automatically grants moderate extensions (eg up to 30 seconds) and either denies very long extension requests or, asks user about it.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]