From 32ca88087708a8b1f7e65ecbea6c5fd6690431d3 Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Fri, 1 Mar 2013 18:01:48 +0100 Subject: [PATCH] Fix incorrect config list when there are duplicate names. --- TargetController.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/TargetController.m b/TargetController.m index 9aad491..86fe968 100644 --- a/TargetController.m +++ b/TargetController.m @@ -212,9 +212,14 @@ - (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]; } -- 2.30.2