Fix incorrect config list when there are duplicate names.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Fri, 1 Mar 2013 17:01:48 +0000 (18:01 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Fri, 1 Mar 2013 17:01:48 +0000 (18:01 +0100)
TargetController.m

index 9aad491d17eb41a936d21e08f37e4eda7ef781fe..86fe9688aaa21d029a125c90d635026b673d6119 100644 (file)
 - (void)refreshConfigs {
     // TODO: This doesn't work when removing configs.
     NSInteger initialIndex = configPopup.indexOfSelectedItem;
-    [configPopup removeAllItems];
-    for (Config *config in configsController.configs)
-        [configPopup addItemWithTitle:config.name];
+    [configPopup.menu removeAllItems];
+    for (Config *config in configsController.configs) {
+        NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:config.name
+                                                      action:@selector(configChosen:)
+                                               keyEquivalent:@""];
+        item.target = self;
+        [configPopup.menu addItem:item];
+    }
     [configPopup selectItemAtIndex:initialIndex];
 }