Distinguish icon right click/quit from system shut down

Do you really want to quit ? In order to provide access to font suitcases, Fonts Manager must be running. So I added a dialog upon quit that warns the user that quitting will make these fonts unavailable, when at least one of them is activated.

Until now I had placed the dialog on the File/Quit menu, but left the Icon Right-Click/Quit open. So effectively the user could quit the app without any kind of warning. And of course no problem upon shut down.

But what is not nice is that I foresee the kind of angry support requests that will certainly come, especially since modern fonts using Core Text did not require the app running to be available. “But it was activated. Why is it gone ?”. Me : It is in the manual. “What ? Can’t you tell me ? I want a refund”.

So I wonder if it is possible to distinguish between icon right click/quit, and system shut down.

Is there a message one can catch that indicates the system is going to shut down, before the app receives the quit Apple event ?

That way I can quit outright, instead of displaying the dialog, as I already do when no font suitcase is activated.

Might I suggest you move the suitcase access functionality to a helper app / Status Item?
Harder to accidentally quit, would require them to explicitly go up to the Menu Bar to quit the status item. At that point you could raise the “Are you sure?” when quitting the helper app.

[quote=268101:@jean-paul devulder]The class NSWorkspace have a notification for this “NSWorkspaceWillPowerOffNotification”

MBS also

Sam have write article on Xdev for notification[/quote]

Superb. Thank you Jean-Paul.

[quote=268108:@Tim Parnell]Might I suggest you move the suitcase access functionality to a helper app / Status Item?
Harder to accidentally quit, would require them to explicitly go up to the Menu Bar to quit the status item. At that point you could raise the “Are you sure?” when quitting the helper app.[/quote]

I had a big problem in the MAS because of a similar scheme two years ago. I got an app rejected because the helper remained active after the app had quit. Hence I now keep everything in the main app.

Right now the thing is pretty transparent. If no font suitcase is active, closing the main screen quits the app. If font suitcases are activated, closing the main screen does not quit but a small notification appears explaining why.

The last part was this gracious shutdown I needed, so the user does not get the pesky “Fonts Manager prevented shutdown”. Now I can detect the event and exit right away.

Well, back to the drawing board… The observer does not catch NSWorkspaceWillPowerOffNotification. The quit AppleEvent happens before.

I will probably simply leave HandleAppleEvent alone.