From 8c076bb8ad851693624f74fd3afa71fcc3b33776 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Fri, 12 Sep 2008 11:42:06 +0200 Subject: [PATCH] Fix the 'parent' link in commits This allows you to click on the parent link to select a parent. Also fixes an issue that the NSTableView would not scroll to the correct commit. --- PBDetailController.h | 1 + PBDetailController.m | 8 ++++++++ PBWebGitController.m | 4 +--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/PBDetailController.h b/PBDetailController.h index 4717160..0880da1 100644 --- a/PBDetailController.h +++ b/PBDetailController.h @@ -39,6 +39,7 @@ - (IBAction) setRawView: sender; - (IBAction) setTreeView: sender; +- (void) selectCommit: (NSString*) commit; - (IBAction) refresh: sender; - (IBAction) toggleQuickView: sender; - (IBAction) openSelectedFile: sender; diff --git a/PBDetailController.m b/PBDetailController.m index 7c57a5b..3128105 100644 --- a/PBDetailController.m +++ b/PBDetailController.m @@ -152,6 +152,14 @@ repository.currentBranch = repository.currentBranch; } +- (void) selectCommit: (NSString*) commit +{ + NSPredicate* selection = [NSPredicate predicateWithFormat:@"sha == %@", commit]; + NSArray* selectedCommits = [repository.revisionList.commits filteredArrayUsingPredicate:selection]; + [commitController setSelectedObjects: selectedCommits]; + int index = [[commitController selectionIndexes] firstIndex]; + [commitList scrollRowToVisible: index]; +} - (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { diff --git a/PBWebGitController.m b/PBWebGitController.m index a6a5d80..5fd55c7 100644 --- a/PBWebGitController.m +++ b/PBWebGitController.m @@ -64,9 +64,7 @@ - (void) selectCommit: (NSString*) sha { - NSPredicate* selection = [NSPredicate predicateWithFormat:@"sha == %@", sha]; - NSArray* selectedCommits = [detailController.repository.revisionList.commits filteredArrayUsingPredicate:selection]; - // TODO: reimplement this. How can we set the new commit? Our detailscontroller is read-only + [detailController selectCommit:sha]; } + (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector