From dc234cfdc9de05cb0c81a968412f76ef9204e33f Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Sat, 13 Jun 2009 11:08:01 +0200 Subject: [PATCH] PBGitHistory: Add "Show in Finder" to files This adds the "Show in Finder" menu-entry and logic to files in the tree-view of the history. Also the button "Show commits touching paths" was renamed to "Show history of files". Signed-off-by: Johannes Gilger --- PBGitHistoryController.h | 3 ++- PBGitHistoryController.m | 16 +++++++++++++++- PBGitHistoryView.xib | 38 ++++++++++++++++++++++++++++++++------ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index f9b7f8f..0007760 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -41,7 +41,8 @@ - (IBAction) toggleQuickView: sender; - (IBAction) openSelectedFile: sender; - (void) updateQuicklookForce: (BOOL) force; -- (void) showCommitsFromTree:(id) sender; +- (void)showCommitsFromTree:(id)sender; +- (void)showInFinderAction:(id)sender; - (void) copyCommitInfo; diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m index 6562465..bdfb843 100644 --- a/PBGitHistoryController.m +++ b/PBGitHistoryController.m @@ -218,7 +218,7 @@ return menu; } -- (void) showCommitsFromTree:(id) sender +- (void)showCommitsFromTree:(id)sender { // TODO: Enable this from webview as well! @@ -230,4 +230,18 @@ repository.currentBranch = [repository addBranch:revSpec]; } +- (void)showInFinderAction:(id)sender +{ + NSString *workingDirectory = [[repository workingDirectory] stringByAppendingString:@"/"]; + NSString *path; + NSWorkspace *ws = [NSWorkspace sharedWorkspace]; + + for (PBGitTree *tree in [treeController selectedObjects]) { + path = [workingDirectory stringByAppendingPathComponent:[tree fullPath]]; + [ws selectFile: path inFileViewerRootedAtPath:path]; + } + +} + + @end diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib index 2fdd4fa..6e44446 100644 --- a/PBGitHistoryView.xib +++ b/PBGitHistoryView.xib @@ -8,9 +8,9 @@ 353.00 YES - + - + YES @@ -1524,7 +1524,15 @@ YES - Commits touching paths + Show history of file(s) + + 2147483647 + + + + + + Show in Finder 2147483647 @@ -2138,6 +2146,14 @@ 282 + + + showInFinderAction: + + + + 285 + @@ -2774,6 +2790,7 @@ YES + @@ -2782,6 +2799,11 @@ + + 284 + + + @@ -2866,6 +2888,7 @@ 276.IBPluginDependency 28.IBPluginDependency 28.IBShouldRemoveOnLegacySave + 284.IBPluginDependency 29.IBPluginDependency 29.IBShouldRemoveOnLegacySave 3.IBPluginDependency @@ -2995,11 +3018,12 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{126, 715}, {223, 23}} + {{225, 683}, {202, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3031,7 +3055,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{59, 317}, {852, 432}} + {{76, 44}, {852, 432}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3066,7 +3090,7 @@ - 282 + 285 @@ -3107,6 +3131,7 @@ setRawView: setTreeView: showCommitsFromTree: + showInFinderAction: toggleQuickView: @@ -3118,6 +3143,7 @@ id id id + id