Skip to content

Commit dc234cf

Browse files
heipeipieter
authored andcommitted
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 <[email protected]>
1 parent d973dc5 commit dc234cf

File tree

3 files changed

+49
-8
lines changed

3 files changed

+49
-8
lines changed

PBGitHistoryController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
- (IBAction) toggleQuickView: sender;
4242
- (IBAction) openSelectedFile: sender;
4343
- (void) updateQuicklookForce: (BOOL) force;
44-
- (void) showCommitsFromTree:(id) sender;
44+
- (void)showCommitsFromTree:(id)sender;
45+
- (void)showInFinderAction:(id)sender;
4546

4647
- (void) copyCommitInfo;
4748

PBGitHistoryController.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ - (NSMenu *)tableColumnMenu
218218
return menu;
219219
}
220220

221-
- (void) showCommitsFromTree:(id) sender
221+
- (void)showCommitsFromTree:(id)sender
222222
{
223223
// TODO: Enable this from webview as well!
224224

@@ -230,4 +230,18 @@ - (void) showCommitsFromTree:(id) sender
230230
repository.currentBranch = [repository addBranch:revSpec];
231231
}
232232

233+
- (void)showInFinderAction:(id)sender
234+
{
235+
NSString *workingDirectory = [[repository workingDirectory] stringByAppendingString:@"/"];
236+
NSString *path;
237+
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
238+
239+
for (PBGitTree *tree in [treeController selectedObjects]) {
240+
path = [workingDirectory stringByAppendingPathComponent:[tree fullPath]];
241+
[ws selectFile: path inFileViewerRootedAtPath:path];
242+
}
243+
244+
}
245+
246+
233247
@end

PBGitHistoryView.xib

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<string key="IBDocument.HIToolboxVersion">353.00</string>
99
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
1010
<bool key="EncodedWithXMLCoder">YES</bool>
11-
<integer value="275"/>
11+
<integer value="276"/>
1212
<integer value="237"/>
13-
<integer value="27"/>
13+
<integer value="9"/>
1414
</object>
1515
<object class="NSArray" key="IBDocument.PluginDependencies">
1616
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1524,7 +1524,15 @@
15241524
<bool key="EncodedWithXMLCoder">YES</bool>
15251525
<object class="NSMenuItem" id="661418857">
15261526
<reference key="NSMenu" ref="500542810"/>
1527-
<string key="NSTitle">Commits touching paths</string>
1527+
<string key="NSTitle">Show history of file(s)</string>
1528+
<string key="NSKeyEquiv"/>
1529+
<int key="NSMnemonicLoc">2147483647</int>
1530+
<reference key="NSOnImage" ref="908677745"/>
1531+
<reference key="NSMixedImage" ref="746375230"/>
1532+
</object>
1533+
<object class="NSMenuItem" id="85225954">
1534+
<reference key="NSMenu" ref="500542810"/>
1535+
<string key="NSTitle">Show in Finder</string>
15281536
<string key="NSKeyEquiv"/>
15291537
<int key="NSMnemonicLoc">2147483647</int>
15301538
<reference key="NSOnImage" ref="908677745"/>
@@ -2138,6 +2146,14 @@
21382146
</object>
21392147
<int key="connectionID">282</int>
21402148
</object>
2149+
<object class="IBConnectionRecord">
2150+
<object class="IBActionConnection" key="connection">
2151+
<string key="label">showInFinderAction:</string>
2152+
<reference key="source" ref="1001"/>
2153+
<reference key="destination" ref="85225954"/>
2154+
</object>
2155+
<int key="connectionID">285</int>
2156+
</object>
21412157
</object>
21422158
<object class="IBMutableOrderedSet" key="objectRecords">
21432159
<object class="NSArray" key="orderedObjects">
@@ -2774,6 +2790,7 @@
27742790
<object class="NSMutableArray" key="children">
27752791
<bool key="EncodedWithXMLCoder">YES</bool>
27762792
<reference ref="661418857"/>
2793+
<reference ref="85225954"/>
27772794
</object>
27782795
<reference key="parent" ref="1002"/>
27792796
</object>
@@ -2782,6 +2799,11 @@
27822799
<reference key="object" ref="661418857"/>
27832800
<reference key="parent" ref="500542810"/>
27842801
</object>
2802+
<object class="IBObjectRecord">
2803+
<int key="objectID">284</int>
2804+
<reference key="object" ref="85225954"/>
2805+
<reference key="parent" ref="500542810"/>
2806+
</object>
27852807
</object>
27862808
</object>
27872809
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2866,6 +2888,7 @@
28662888
<string>276.IBPluginDependency</string>
28672889
<string>28.IBPluginDependency</string>
28682890
<string>28.IBShouldRemoveOnLegacySave</string>
2891+
<string>284.IBPluginDependency</string>
28692892
<string>29.IBPluginDependency</string>
28702893
<string>29.IBShouldRemoveOnLegacySave</string>
28712894
<string>3.IBPluginDependency</string>
@@ -2995,11 +3018,12 @@
29953018
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29963019
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
29973020
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2998-
<string>{{126, 715}, {223, 23}}</string>
3021+
<string>{{225, 683}, {202, 43}}</string>
29993022
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30003023
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30013024
<reference ref="9"/>
30023025
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
3026+
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30033027
<reference ref="9"/>
30043028
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30053029
<reference ref="9"/>
@@ -3031,7 +3055,7 @@
30313055
</object>
30323056
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30333057
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
3034-
<string>{{59, 317}, {852, 432}}</string>
3058+
<string>{{76, 44}, {852, 432}}</string>
30353059
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30363060
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
30373061
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3066,7 +3090,7 @@
30663090
</object>
30673091
</object>
30683092
<nil key="sourceID"/>
3069-
<int key="maxID">282</int>
3093+
<int key="maxID">285</int>
30703094
</object>
30713095
<object class="IBClassDescriber" key="IBDocument.Classes">
30723096
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3107,6 +3131,7 @@
31073131
<string>setRawView:</string>
31083132
<string>setTreeView:</string>
31093133
<string>showCommitsFromTree:</string>
3134+
<string>showInFinderAction:</string>
31103135
<string>toggleQuickView:</string>
31113136
</object>
31123137
<object class="NSMutableArray" key="dict.values">
@@ -3118,6 +3143,7 @@
31183143
<string>id</string>
31193144
<string>id</string>
31203145
<string>id</string>
3146+
<string>id</string>
31213147
</object>
31223148
</object>
31233149
<object class="NSMutableDictionary" key="outlets">

0 commit comments

Comments
 (0)