Lots of rewritten code. Not yet working because the status item doesn't
[MenuTunes.git] / PreferencesController.m
index 0df78f7..82b7f82 100755 (executable)
         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
         
         mt = [tunes retain];
-        [mt registerDefaultsIfNeeded];
-
+        [mt registerDefaults];
+        
         //Load the nib
         [NSBundle loadNibNamed:@"Preferences" owner:self];
         
-        //Show our window
-        [window setLevel:NSStatusWindowLevel];
-        [window center];
-        [window makeKeyAndOrderFront:nil];
-        
         //Set the table view cells up
         [imgCell setImageScaling:NSScaleNone];
         [[menuTableView tableColumnWithIdentifier:@"submenu"] setDataCell:imgCell];
                 }
             }
         }
+        
+        //Show our window
+        [window setLevel:NSStatusWindowLevel];
+        [window center];
+        [window makeKeyAndOrderFront:nil];
+        [window setDelegate:self];
     }
     return self;
 }
         [defaults setInteger:5 forKey:@"SongsInAdvance"];
     }
     
-    {
+    /*{
         NSArray *apps = [[NSWorkspace sharedWorkspace] launchedApplications];
         int i;
         
                 [mt rebuildMenu];
             }
         }
-    }
+    }*/
     [mt clearHotKeys];
 }
 
     [keyComboField setStringValue:string];
 }
 
+//
+//
+
+- (void)windowWillClose:(NSNotification *)note
+{
+    [mt closePreferences];
+}
+
 //
 //
 // Table View Datasource Methods