1 #import "MainController.h"
2 #import "MenuController.h"
3 #import "PreferencesController.h"
4 #import <ITKit/ITHotKeyCenter.h>
5 #import <ITKit/ITHotKey.h>
6 #import <ITKit/ITKeyCombo.h>
7 #import "StatusWindow.h"
8 #import "StatusWindowController.h"
9 #import "StatusItemHack.h"
11 @interface MainController(Private)
12 - (ITMTRemote *)loadRemote;
14 - (void)setLatestSongIdentifier:(NSString *)newIdentifier;
15 - (void)showCurrentTrackInfo;
16 - (void)applicationLaunched:(NSNotification *)note;
17 - (void)applicationTerminated:(NSNotification *)note;
20 static MainController *sharedController;
22 @implementation MainController
24 + (MainController *)sharedController
26 return sharedController;
29 /*************************************************************************/
31 #pragma mark INITIALIZATION/DEALLOCATION METHODS
32 /*************************************************************************/
36 if ( ( self = [super init] ) ) {
37 sharedController = self;
39 remoteArray = [[NSMutableArray alloc] initWithCapacity:1];
40 statusWindowController = [StatusWindowController sharedController];
41 menuController = [[MenuController alloc] init];
42 df = [[NSUserDefaults standardUserDefaults] retain];
48 - (void)applicationDidFinishLaunching:(NSNotification *)note
50 //Turn on debug mode if needed
51 if ([df boolForKey:@"ITDebugMode"]) {
55 currentRemote = [self loadRemote];
56 [currentRemote begin];
58 //Setup for notification of the remote player launching or quitting
59 [[[NSWorkspace sharedWorkspace] notificationCenter]
61 selector:@selector(applicationTerminated:)
62 name:NSWorkspaceDidTerminateApplicationNotification
65 [[[NSWorkspace sharedWorkspace] notificationCenter]
67 selector:@selector(applicationLaunched:)
68 name:NSWorkspaceDidLaunchApplicationNotification
71 if ( ! [df objectForKey:@"menu"] ) { // If this is nil, defaults have never been registered.
72 [[PreferencesController sharedPrefs] registerDefaults];
75 [StatusItemHack install];
76 statusItem = [[ITStatusItem alloc]
77 initWithStatusBar:[NSStatusBar systemStatusBar]
78 withLength:NSSquareStatusItemLength];
80 bling = [[MTBlingController alloc] init];
82 registerTimer = [[NSTimer scheduledTimerWithTimeInterval:10.0
84 selector:@selector(blingTime)
88 if ([currentRemote playerRunningState] == ITMTRemotePlayerRunning) {
89 [self applicationLaunched:nil];
91 if ([df boolForKey:@"LaunchPlayerWithMT"])
94 [self applicationTerminated:nil];
97 [statusItem setImage:[NSImage imageNamed:@"MenuNormal"]];
98 [statusItem setAlternateImage:[NSImage imageNamed:@"MenuInverted"]];
103 - (ITMTRemote *)loadRemote
105 NSString *folderPath = [[NSBundle mainBundle] builtInPlugInsPath];
106 ITDebugLog(@"Gathering remotes.");
108 NSArray *bundlePathList = [NSBundle pathsForResourcesOfType:@"remote" inDirectory:folderPath];
109 NSEnumerator *enumerator = [bundlePathList objectEnumerator];
110 NSString *bundlePath;
112 while ( (bundlePath = [enumerator nextObject]) ) {
113 NSBundle* remoteBundle = [NSBundle bundleWithPath:bundlePath];
116 Class remoteClass = [remoteBundle principalClass];
118 if ([remoteClass conformsToProtocol:@protocol(ITMTRemote)] &&
119 [remoteClass isKindOfClass:[NSObject class]]) {
120 id remote = [remoteClass remote];
121 ITDebugLog(@"Adding remote at path %@", bundlePath);
122 [remoteArray addObject:remote];
127 // if ( [remoteArray count] > 0 ) { // UNCOMMENT WHEN WE HAVE > 1 PLUGIN
128 // if ( [remoteArray count] > 1 ) {
129 // [remoteArray sortUsingSelector:@selector(sortAlpha:)];
131 // [self loadModuleAccessUI]; //Comment out this line to disable remote visibility
134 // NSLog(@"%@", [remoteArray objectAtIndex:0]); //DEBUG
135 return [remoteArray objectAtIndex:0];
138 /*************************************************************************/
140 #pragma mark INSTANCE METHODS
141 /*************************************************************************/
143 /*- (void)startTimerInNewThread
145 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
146 NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
147 refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5
149 selector:@selector(timerUpdate)
151 repeats:YES] retain];
153 ITDebugLog(@"Timer started.");
157 - (void)setBlingTime:(NSDate*)date
159 NSMutableDictionary *globalPrefs;
161 globalPrefs = [[df persistentDomainForName:@".GlobalPreferences"] mutableCopy];
162 [globalPrefs setObject:date forKey:@"ITMTTrialStart"];
163 [df setPersistentDomain:globalPrefs forName:@".GlobalPreferences"];
165 [globalPrefs release];
168 - (NSDate*)getBlingTime
171 return [[df persistentDomainForName:@".GlobalPreferences"] objectForKey:@"ITMTTrialStart"];
176 NSDate *now = [NSDate date];
177 if ( (! [self getBlingTime] ) ) {
178 [self setBlingTime:now];
180 if ( ([now timeIntervalSinceDate:[self getBlingTime]] >= 604800) ) {
181 [statusItem setEnabled:NO];
183 if ([refreshTimer isValid]) {
184 [refreshTimer invalidate];
186 if ([registerTimer isValid]) {
187 [registerTimer invalidate];
189 [statusWindowController showRegistrationQueryWindow];
200 if ( ! ([bling checkDone] == 2475) ) {
207 - (BOOL)songIsPlaying
209 return ( ! ([[currentRemote playerStateUniqueIdentifier] isEqualToString:@"0-0"]) );
212 - (BOOL)radioIsPlaying
214 return ( [currentRemote currentPlaylistClass] == ITMTRemotePlayerRadioPlaylist );
219 return ( ! [[currentRemote playerStateUniqueIdentifier] isEqualToString:_latestSongIdentifier] );
222 - (NSString *)latestSongIdentifier
224 return _latestSongIdentifier;
227 - (void)setLatestSongIdentifier:(NSString *)newIdentifier
229 ITDebugLog(@"Setting latest song identifier to %@", newIdentifier);
230 [_latestSongIdentifier autorelease];
231 _latestSongIdentifier = [newIdentifier copy];
236 if ( [self songChanged] && (timerUpdating != YES) ) {
237 ITDebugLog(@"The song changed.");
239 latestPlaylistClass = [currentRemote currentPlaylistClass];
240 [menuController rebuildSubmenus];
242 if ( [df boolForKey:@"showSongInfoOnChange"] ) {
243 [self performSelector:@selector(showCurrentTrackInfo) withObject:nil afterDelay:0.0];
246 [self setLatestSongIdentifier:[currentRemote playerStateUniqueIdentifier]];
254 ITDebugLog(@"Menu clicked.");
255 if ([currentRemote playerRunningState] == ITMTRemotePlayerRunning) {
256 [statusItem setMenu:[menuController menu]];
258 [statusItem setMenu:[menuController menuForNoPlayer]];
270 ITMTRemotePlayerPlayingState state = [currentRemote playerPlayingState];
271 ITDebugLog(@"Play/Pause toggled");
272 if (state == ITMTRemotePlayerPlaying) {
273 [currentRemote pause];
274 } else if ((state == ITMTRemotePlayerForwarding) || (state == ITMTRemotePlayerRewinding)) {
275 [currentRemote pause];
276 [currentRemote play];
278 [currentRemote play];
285 ITDebugLog(@"Going to next song.");
286 [currentRemote goToNextSong];
292 ITDebugLog(@"Going to previous song.");
293 [currentRemote goToPreviousSong];
299 ITDebugLog(@"Fast forwarding.");
300 [currentRemote forward];
306 ITDebugLog(@"Rewinding.");
307 [currentRemote rewind];
311 - (void)selectPlaylistAtIndex:(int)index
313 ITDebugLog(@"Selecting playlist %i", index);
314 [currentRemote switchToPlaylistAtIndex:index];
318 - (void)selectSongAtIndex:(int)index
320 ITDebugLog(@"Selecting song %i", index);
321 [currentRemote switchToSongAtIndex:index];
325 - (void)selectSongRating:(int)rating
327 ITDebugLog(@"Selecting song rating %i", rating);
328 [currentRemote setCurrentSongRating:(float)rating / 100.0];
332 - (void)selectEQPresetAtIndex:(int)index
334 ITDebugLog(@"Selecting EQ preset %i", index);
335 [currentRemote switchToEQAtIndex:index];
341 ITDebugLog(@"Beginning show player.");
342 if ( ( playerRunningState == ITMTRemotePlayerRunning) ) {
343 ITDebugLog(@"Showing player interface.");
344 [currentRemote showPrimaryInterface];
346 ITDebugLog(@"Launching player.");
347 if (![[NSWorkspace sharedWorkspace] launchApplication:[currentRemote playerFullName]]) {
348 ITDebugLog(@"Error Launching Player");
351 ITDebugLog(@"Finished show player.");
354 - (void)showPreferences
356 ITDebugLog(@"Show preferences.");
357 [[PreferencesController sharedPrefs] setController:self];
358 [[PreferencesController sharedPrefs] showPrefsWindow:self];
361 - (void)quitMenuTunes
363 ITDebugLog(@"Quitting MenuTunes.");
364 [NSApp terminate:self];
370 - (void)closePreferences
372 ITDebugLog(@"Preferences closed.");
373 if ( ( playerRunningState == ITMTRemotePlayerRunning) ) {
378 - (ITMTRemote *)currentRemote
380 return currentRemote;
391 NSEnumerator *hotKeyEnumerator = [[[ITHotKeyCenter sharedCenter] allHotKeys] objectEnumerator];
392 ITHotKey *nextHotKey;
393 ITDebugLog(@"Clearing hot keys.");
394 while ( (nextHotKey = [hotKeyEnumerator nextObject]) ) {
395 [[ITHotKeyCenter sharedCenter] unregisterHotKey:nextHotKey];
397 ITDebugLog(@"Done clearing hot keys.");
403 ITDebugLog(@"Setting up hot keys.");
405 if (playerRunningState == ITMTRemotePlayerNotRunning) {
409 if ([df objectForKey:@"PlayPause"] != nil) {
410 ITDebugLog(@"Setting up play pause hot key.");
411 hotKey = [[ITHotKey alloc] init];
412 [hotKey setName:@"PlayPause"];
413 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"PlayPause"]]];
414 [hotKey setTarget:self];
415 [hotKey setAction:@selector(playPause)];
416 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
419 if ([df objectForKey:@"NextTrack"] != nil) {
420 ITDebugLog(@"Setting up next track hot key.");
421 hotKey = [[ITHotKey alloc] init];
422 [hotKey setName:@"NextTrack"];
423 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"NextTrack"]]];
424 [hotKey setTarget:self];
425 [hotKey setAction:@selector(nextSong)];
426 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
429 if ([df objectForKey:@"PrevTrack"] != nil) {
430 ITDebugLog(@"Setting up previous track hot key.");
431 hotKey = [[ITHotKey alloc] init];
432 [hotKey setName:@"PrevTrack"];
433 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"PrevTrack"]]];
434 [hotKey setTarget:self];
435 [hotKey setAction:@selector(prevSong)];
436 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
439 if ([df objectForKey:@"ShowPlayer"] != nil) {
440 ITDebugLog(@"Setting up show player hot key.");
441 hotKey = [[ITHotKey alloc] init];
442 [hotKey setName:@"ShowPlayer"];
443 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"ShowPlayer"]]];
444 [hotKey setTarget:self];
445 [hotKey setAction:@selector(showPlayer)];
446 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
449 if ([df objectForKey:@"TrackInfo"] != nil) {
450 ITDebugLog(@"Setting up track info hot key.");
451 hotKey = [[ITHotKey alloc] init];
452 [hotKey setName:@"TrackInfo"];
453 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"TrackInfo"]]];
454 [hotKey setTarget:self];
455 [hotKey setAction:@selector(showCurrentTrackInfo)];
456 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
459 if ([df objectForKey:@"UpcomingSongs"] != nil) {
460 ITDebugLog(@"Setting up upcoming songs hot key.");
461 hotKey = [[ITHotKey alloc] init];
462 [hotKey setName:@"UpcomingSongs"];
463 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"UpcomingSongs"]]];
464 [hotKey setTarget:self];
465 [hotKey setAction:@selector(showUpcomingSongs)];
466 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
469 if ([df objectForKey:@"ToggleLoop"] != nil) {
470 ITDebugLog(@"Setting up toggle loop hot key.");
471 hotKey = [[ITHotKey alloc] init];
472 [hotKey setName:@"ToggleLoop"];
473 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"ToggleLoop"]]];
474 [hotKey setTarget:self];
475 [hotKey setAction:@selector(toggleLoop)];
476 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
479 if ([df objectForKey:@"ToggleShuffle"] != nil) {
480 ITDebugLog(@"Setting up toggle shuffle hot key.");
481 hotKey = [[ITHotKey alloc] init];
482 [hotKey setName:@"ToggleShuffle"];
483 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"ToggleShuffle"]]];
484 [hotKey setTarget:self];
485 [hotKey setAction:@selector(toggleShuffle)];
486 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
489 if ([df objectForKey:@"IncrementVolume"] != nil) {
490 ITDebugLog(@"Setting up increment volume hot key.");
491 hotKey = [[ITHotKey alloc] init];
492 [hotKey setName:@"IncrementVolume"];
493 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"IncrementVolume"]]];
494 [hotKey setTarget:self];
495 [hotKey setAction:@selector(incrementVolume)];
496 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
499 if ([df objectForKey:@"DecrementVolume"] != nil) {
500 ITDebugLog(@"Setting up decrement volume hot key.");
501 hotKey = [[ITHotKey alloc] init];
502 [hotKey setName:@"DecrementVolume"];
503 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"DecrementVolume"]]];
504 [hotKey setTarget:self];
505 [hotKey setAction:@selector(decrementVolume)];
506 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
509 if ([df objectForKey:@"IncrementRating"] != nil) {
510 ITDebugLog(@"Setting up increment rating hot key.");
511 hotKey = [[ITHotKey alloc] init];
512 [hotKey setName:@"IncrementRating"];
513 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"IncrementRating"]]];
514 [hotKey setTarget:self];
515 [hotKey setAction:@selector(incrementRating)];
516 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
519 if ([df objectForKey:@"DecrementRating"] != nil) {
520 ITDebugLog(@"Setting up decrement rating hot key.");
521 hotKey = [[ITHotKey alloc] init];
522 [hotKey setName:@"DecrementRating"];
523 [hotKey setKeyCombo:[ITKeyCombo keyComboWithPlistRepresentation:[df objectForKey:@"DecrementRating"]]];
524 [hotKey setTarget:self];
525 [hotKey setAction:@selector(decrementRating)];
526 [[ITHotKeyCenter sharedCenter] registerHotKey:[hotKey autorelease]];
528 ITDebugLog(@"Finished setting up hot keys.");
531 - (void)showCurrentTrackInfo
533 ITMTRemotePlayerSource source = [currentRemote currentSource];
534 NSString *title = [currentRemote currentSongTitle];
535 NSString *album = nil;
536 NSString *artist = nil;
537 NSString *time = nil;
538 NSString *track = nil;
541 ITDebugLog(@"Showing track info status window.");
545 if ( [df boolForKey:@"showAlbum"] ) {
546 album = [currentRemote currentSongAlbum];
549 if ( [df boolForKey:@"showArtist"] ) {
550 artist = [currentRemote currentSongArtist];
553 if ( [df boolForKey:@"showTime"] ) {
554 time = [NSString stringWithFormat:@"%@: %@ / %@",
556 [currentRemote currentSongElapsed],
557 [currentRemote currentSongLength]];
560 if ( [df boolForKey:@"showTrackNumber"] ) {
561 int trackNo = [currentRemote currentSongTrack];
562 int trackCount = [currentRemote currentAlbumTrackCount];
564 if ( (trackNo > 0) || (trackCount > 0) ) {
565 track = [NSString stringWithFormat:@"%@: %i %@ %i",
566 @"Track", trackNo, @"of", trackCount];
570 if ( [df boolForKey:@"showTrackRating"] ) {
571 float currentRating = [currentRemote currentSongRating];
572 if (currentRating >= 0.0) {
573 rating = ( currentRating * 5 );
578 title = NSLocalizedString(@"noSongPlaying", @"No song is playing.");
581 [statusWindowController showSongInfoWindowWithSource:source
590 - (void)showUpcomingSongs
592 int curPlaylist = [currentRemote currentPlaylistIndex];
593 int numSongs = [currentRemote numberOfSongsInPlaylistAtIndex:curPlaylist];
594 ITDebugLog(@"Showing upcoming songs status window.");
596 NSMutableArray *songList = [NSMutableArray arrayWithCapacity:5];
597 int numSongsInAdvance = [df integerForKey:@"SongsInAdvance"];
598 int curTrack = [currentRemote currentSongIndex];
601 for (i = curTrack + 1; i <= curTrack + numSongsInAdvance; i++) {
603 [songList addObject:[currentRemote songTitleAtIndex:i]];
607 [statusWindowController showUpcomingSongsWindowWithTitles:songList];
610 [statusWindowController showUpcomingSongsWindowWithTitles:[NSArray arrayWithObject:NSLocalizedString(@"noUpcomingSongs", @"No upcoming songs.")]];
614 - (void)incrementVolume
616 float volume = [currentRemote volume];
617 float dispVol = volume;
618 ITDebugLog(@"Incrementing volume.");
627 ITDebugLog(@"Setting volume to %f", volume);
628 [currentRemote setVolume:volume];
630 // Show volume status window
631 [statusWindowController showVolumeWindowWithLevel:dispVol];
634 - (void)decrementVolume
636 float volume = [currentRemote volume];
637 float dispVol = volume;
638 ITDebugLog(@"Decrementing volume.");
647 ITDebugLog(@"Setting volume to %f", volume);
648 [currentRemote setVolume:volume];
650 //Show volume status window
651 [statusWindowController showVolumeWindowWithLevel:dispVol];
654 - (void)incrementRating
656 float rating = [currentRemote currentSongRating];
657 ITDebugLog(@"Incrementing rating.");
659 if ([currentRemote currentPlaylistIndex] == 0) {
660 ITDebugLog(@"No song playing, rating change aborted.");
668 ITDebugLog(@"Setting rating to %f", rating);
669 [currentRemote setCurrentSongRating:rating];
671 //Show rating status window
672 [statusWindowController showRatingWindowWithRating:rating];
675 - (void)decrementRating
677 float rating = [currentRemote currentSongRating];
678 ITDebugLog(@"Decrementing rating.");
680 if ([currentRemote currentPlaylistIndex] == 0) {
681 ITDebugLog(@"No song playing, rating change aborted.");
689 ITDebugLog(@"Setting rating to %f", rating);
690 [currentRemote setCurrentSongRating:rating];
692 //Show rating status window
693 [statusWindowController showRatingWindowWithRating:rating];
698 ITMTRemotePlayerRepeatMode repeatMode = [currentRemote repeatMode];
699 ITDebugLog(@"Toggling repeat mode.");
700 switch (repeatMode) {
701 case ITMTRemotePlayerRepeatOff:
702 repeatMode = ITMTRemotePlayerRepeatAll;
704 case ITMTRemotePlayerRepeatAll:
705 repeatMode = ITMTRemotePlayerRepeatOne;
707 case ITMTRemotePlayerRepeatOne:
708 repeatMode = ITMTRemotePlayerRepeatOff;
711 ITDebugLog(@"Setting repeat mode to %i", repeatMode);
712 [currentRemote setRepeatMode:repeatMode];
714 //Show loop status window
715 [statusWindowController showRepeatWindowWithMode:repeatMode];
718 - (void)toggleShuffle
720 BOOL newShuffleEnabled = ( ! [currentRemote shuffleEnabled] );
721 ITDebugLog(@"Toggling shuffle mode.");
722 [currentRemote setShuffleEnabled:newShuffleEnabled];
723 //Show shuffle status window
724 ITDebugLog(@"Setting shuffle mode to %i", newShuffleEnabled);
725 [statusWindowController showShuffleWindow:newShuffleEnabled];
728 - (void)registerNowOK
730 [[StatusWindow sharedWindow] setLocked:NO];
731 [[StatusWindow sharedWindow] vanish:self];
732 [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
737 - (void)registerNowCancel
739 [[StatusWindow sharedWindow] setLocked:NO];
740 [[StatusWindow sharedWindow] vanish:self];
741 [[StatusWindow sharedWindow] setIgnoresMouseEvents:YES];
743 [NSApp terminate:self];
747 /*************************************************************************/
749 #pragma mark WORKSPACE NOTIFICATION HANDLERS
750 /*************************************************************************/
752 - (void)applicationLaunched:(NSNotification *)note
754 if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[currentRemote playerFullName]]) {
755 ITDebugLog(@"Remote application launched.");
756 [currentRemote begin];
757 [self setLatestSongIdentifier:@""];
759 refreshTimer = [[NSTimer scheduledTimerWithTimeInterval:0.5
761 selector:@selector(timerUpdate)
763 repeats:YES] retain];
764 //[NSThread detachNewThreadSelector:@selector(startTimerInNewThread) toTarget:self withObject:nil];
766 playerRunningState = ITMTRemotePlayerRunning;
770 - (void)applicationTerminated:(NSNotification *)note
772 if (!note || [[[note userInfo] objectForKey:@"NSApplicationName"] isEqualToString:[currentRemote playerFullName]]) {
773 ITDebugLog(@"Remote application terminated.");
774 [currentRemote halt];
775 [refreshTimer invalidate];
776 [refreshTimer release];
778 [registerTimer invalidate];
779 [registerTimer release];
782 playerRunningState = ITMTRemotePlayerNotRunning;
787 /*************************************************************************/
789 #pragma mark NSApplication DELEGATE METHODS
790 /*************************************************************************/
792 - (void)applicationWillTerminate:(NSNotification *)note
795 [[NSStatusBar systemStatusBar] removeStatusItem:statusItem];
799 /*************************************************************************/
801 #pragma mark DEALLOCATION METHOD
802 /*************************************************************************/
806 [self applicationTerminated:nil];
808 [statusItem release];
809 [statusWindowController release];
810 [menuController release];