Go to SCM Status is now a toggle

This is implemented by invoking “go back” if already showing an SCM URL. If there is no history (unlikely) then we instead “go up (parent)” which should take us to the root of the repository.
This commit is contained in:
Allan Odgaard
2012-08-17 22:49:58 +02:00
parent 7cca8f3f4a
commit 64ff8a53e7

View File

@@ -831,12 +831,21 @@ static struct data_source_options_map_t { NSString* const name; NSUInteger flag;
- (IBAction)goToSCMDataSource:(id)sender
{
for(NSURL* selectedURL in self.selectedURLs)
if([url.scheme isEqualToString:@"scm"])
{
if([selectedURL isFileURL] && path::is_directory([[selectedURL path] fileSystemRepresentation]))
return [self pushURL:[FSSCMDataSource scmURLWithPath:[selectedURL path]]];
if(historyController.previousURL)
[self goBack:sender];
else [self goToParentFolder:sender];
}
else
{
for(NSURL* selectedURL in self.selectedURLs)
{
if([selectedURL isFileURL] && path::is_directory([[selectedURL path] fileSystemRepresentation]))
return [self pushURL:[FSSCMDataSource scmURLWithPath:[selectedURL path]]];
}
[self pushURL:[FSSCMDataSource scmURLWithPath:[url path]]];
}
[self pushURL:[FSSCMDataSource scmURLWithPath:[url path]]];
}
- (IBAction)goBack:(id)sender { if(historyController.previousURL) { [self setURL:historyController.previousURL]; [historyController retreat:self]; [outlineViewDelegate scrollToOffset:historyController.currentURLScrollOffset]; [self updateView]; } }