// Copyright GreenKeeper Software 2005 #import "ShutdownController.h" #import "BOINCController.h" @implementation ShutdownController - (void)awakeFromNib { // Guarantees a clean quit when the user logs out [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(lastAction:) name:NSWorkspaceWillPowerOffNotification object:nil]; // Makes sure boinc is terminated when the application is quit [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(lastAction:) name:@"userRequestedQuit" object:nil]; } // Terminates the application - (void)lastAction:(NSNotification *)notification { // If boinc is running, stop it if([BOINCController boincIsRunning]) [BOINCController stopBOINC]; // Quit the application [NSApp terminate:self]; } @end