Simplify config removal since it's always the active config removed.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Fri, 1 Mar 2013 17:41:58 +0000 (18:41 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Fri, 1 Mar 2013 17:41:58 +0000 (18:41 +0100)
ConfigsController.m
TargetController.m

index a9f3f3ed855f8cb33fde224efe7de148a67a32a6..d0d8401c9699e2baca65caa6c0a3123e3b2f9a99 100644 (file)
     if (tableView.selectedRow == 0)
         return;
     
-    Config *toRemove = _configs[tableView.selectedRow];
     [_configs removeObjectAtIndex:tableView.selectedRow];
-    
-    if (toRemove == _currentConfig)
-        _currentConfig = _configs[0];
-    if (toRemove == manualConfig)
-        manualConfig = _configs[0];
-    
-    [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
     [tableView reloadData];
+    [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
+    [self activateConfig:_configs[0]];
     [self save];
 }
 
index 7a4fd058e470d6238dd5b285d3a03770129e0c41..2ecb06057f80e90a909de3616713302d47a6af40 100644 (file)
 }
 
 - (void)refreshConfigs {
-    // TODO: This doesn't work when removing configs.
     NSInteger initialIndex = configPopup.indexOfSelectedItem;
     [configPopup.menu removeAllItems];
     for (Config *config in configsController.configs) {