Fixed the delete key in the prefs table view.
[MenuTunes.git] / PreferencesController.m
index 2f1eb9c..c2af444 100755 (executable)
@@ -1,6 +1,7 @@
 #import "PreferencesController.h"
 #import "MainController.h"
 #import "StatusWindow.h"
 #import "PreferencesController.h"
 #import "MainController.h"
 #import "StatusWindow.h"
+#import "CustomMenuTableView.h"
 
 #import <ITKit/ITHotKeyCenter.h>
 #import <ITKit/ITKeyCombo.h>
 
 #import <ITKit/ITHotKeyCenter.h>
 #import <ITKit/ITKeyCombo.h>
@@ -102,9 +103,8 @@ static PreferencesController *prefs = nil;
         [launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized...
     }
     
         [launchPlayerAtLaunchCheckbox setTitle:[NSString stringWithFormat:@"Launch %@ when MenuTunes launches", [[controller currentRemote] playerSimpleName]]]; //This isn't localized...
     }
     
-//  [window setLevel:NSStatusWindowLevel];
+    [window setLevel:NSStatusWindowLevel];
     [window center];
     [window center];
-    [NSApp activateIgnoringOtherApps:YES];
     [window makeKeyAndOrderFront:self];
 }
 
     [window makeKeyAndOrderFront:self];
 }
 
@@ -423,6 +423,27 @@ static PreferencesController *prefs = nil;
     [self cancelHotKey:sender];
 }
 
     [self cancelHotKey:sender];
 }
 
+- (void)deletePressedInTableView:(NSTableView *)tableView
+{
+    if (tableView == menuTableView) {
+        int selRow = [tableView selectedRow];
+        if (selRow != - 1) {
+            NSString *object = [myItems objectAtIndex:selRow];
+            
+            if ([object isEqualToString:@"preferences"]) {
+                NSBeep();
+                return;
+            }
+            
+            if (![object isEqualToString:@"separator"])
+                [availableItems addObject:object];
+            [myItems removeObjectAtIndex:selRow];
+            [menuTableView reloadData];
+            [allTableView reloadData];
+        }
+        [self changeMenus:self];
+    }
+}
 
 
 /*************************************************************************/
 
 
 /*************************************************************************/
@@ -497,6 +518,7 @@ static PreferencesController *prefs = nil;
     id            anItem;
     // Set the list of items you can have.
     availableItems = [[NSMutableArray alloc] initWithObjects:
     id            anItem;
     // Set the list of items you can have.
     availableItems = [[NSMutableArray alloc] initWithObjects:
+        @"separator",
         @"trackInfo",
         @"upcomingSongs",
         @"playlists",
         @"trackInfo",
         @"upcomingSongs",
         @"playlists",
@@ -508,7 +530,6 @@ static PreferencesController *prefs = nil;
         @"fastForward",
         @"rewind",
         @"showPlayer",
         @"fastForward",
         @"rewind",
         @"showPlayer",
-        @"separator",
         @"quit",
         nil];
     
         @"quit",
         nil];