Skip to content

Commit

Permalink
Change the target and action of a menu only if it's enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gcamp committed Jun 8, 2011
1 parent fb1c5a4 commit 895042b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions GCJumpBar/GCJumpBarLabel.m
Expand Up @@ -153,10 +153,12 @@ - (NSDictionary *)attributes {

- (void)setPropretyOnMenu:(NSMenu *)menu deep:(NSInteger) deep {
for (NSMenuItem* item in [menu itemArray]) {
[item setTag:deep];
[item setTarget:self];
[item setAction:@selector(menuClicked:)];
if ([item hasSubmenu]) [self setPropretyOnMenu:item.submenu deep:deep + 1];
if (item.isEnabled) {
[item setTag:deep];
[item setTarget:self];
[item setAction:@selector(menuClicked:)];
if ([item hasSubmenu]) [self setPropretyOnMenu:item.submenu deep:deep + 1];
}
}
}

Expand Down

0 comments on commit 895042b

Please sign in to comment.