Bug fix: Re-enable the toolbar item validation.

Although it is true that the remote can be chosen arbitrarily through the popup menus
we still need to have a specific local branch. All branches is not a specific branch.
Of course we could do away with determining the current local branch through what's 
selected in the branch popup menu and instead focus on what the appropriate controller's
current selection is.
This commit is contained in:
André Berg
2009-11-10 18:35:00 +01:00
parent d4a8bc9e3c
commit 06d3b9bcc5
+17 -21
View File
@@ -98,27 +98,23 @@
// MARK: NSToolbarItemValidation Methods
// !!! Andre Berg 20091110: I don't think this is needed any more since the Push, Pull
// and Rebase toolbar items are now popup buttons it makes no sense to disable them
// when switching to "All branches" or "Local branches" since you can choose the remote
// from the popup menus.
// - (BOOL) validateToolbarItem:(NSToolbarItem *)theItem {
//
// NSString * curBranchDesc = [[repository currentBranch] description];
// NSArray * candidates = [NSArray arrayWithObjects:@"Push", @"Pull", @"Rebase", nil];
// BOOL res;
//
// if (([candidates containsObject:[theItem label]]) &&
// (([curBranchDesc isEqualToString:@"All branches"]) ||
// ([curBranchDesc isEqualToString:@"Local branches"])))
// {
// res = NO;
// } else {
// res = YES;
// }
//
// return res;
// }
- (BOOL) validateToolbarItem:(NSToolbarItem *)theItem {
NSString * curBranchDesc = [[repository currentBranch] description];
NSArray * candidates = [NSArray arrayWithObjects:@"Push", @"Pull", @"Rebase", nil];
BOOL res;
if (([candidates containsObject:[theItem label]]) &&
(([curBranchDesc isEqualToString:@"All branches"]) ||
([curBranchDesc isEqualToString:@"Local branches"])))
{
res = NO;
} else {
res = YES;
}
return res;
}
// MARK: PBGitHistoryController