mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Add the contextual menu to the other columns of the commit list
Now all the columns have the menu for the commit, not just the subject column.
This commit is contained in:
+2
-1
@@ -7,10 +7,11 @@
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PBRefContextDelegate.h"
|
||||
|
||||
|
||||
@interface GitXTextFieldCell : NSTextFieldCell {
|
||||
|
||||
IBOutlet id<PBRefContextDelegate> contextMenuDelegate;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
//
|
||||
|
||||
#import "GitXTextFieldCell.h"
|
||||
#import "PBGitCommit.h"
|
||||
#import "PBRefController.h"
|
||||
|
||||
|
||||
@implementation GitXTextFieldCell
|
||||
@@ -17,4 +19,19 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSMenu *)menuForEvent:(NSEvent *)anEvent inRect:(NSRect)cellFrame ofView:(NSTableView *)commitList
|
||||
{
|
||||
NSInteger rowIndex = [commitList rowAtPoint:(cellFrame.origin)];
|
||||
NSArray *items = [contextMenuDelegate menuItemsForRow:rowIndex];
|
||||
if (!items)
|
||||
return nil;
|
||||
|
||||
NSMenu *menu = [[NSMenu alloc] init];
|
||||
[menu setAutoenablesItems:NO];
|
||||
for (NSMenuItem *item in items)
|
||||
[menu addItem:item];
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
+68
-17
@@ -1616,14 +1616,6 @@
|
||||
</object>
|
||||
<int key="connectionID">95</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="254268962"/>
|
||||
<reference key="destination" ref="1001"/>
|
||||
</object>
|
||||
<int key="connectionID">96</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
@@ -1696,14 +1688,6 @@
|
||||
</object>
|
||||
<int key="connectionID">234</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="254268962"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">235</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">contextMenuDelegate</string>
|
||||
@@ -2097,13 +2081,69 @@
|
||||
</object>
|
||||
<int key="connectionID">436</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">contextMenuDelegate</string>
|
||||
<reference key="source" ref="746918365"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">438</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">contextMenuDelegate</string>
|
||||
<reference key="source" ref="853819733"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">439</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">contextMenuDelegate</string>
|
||||
<reference key="source" ref="750921840"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">440</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">contextMenuDelegate</string>
|
||||
<reference key="source" ref="671609291"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">441</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">contextMenuDelegate</string>
|
||||
<reference key="source" ref="493129112"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">442</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="254268962"/>
|
||||
<reference key="destination" ref="1001"/>
|
||||
</object>
|
||||
<int key="connectionID">444</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">dataSource</string>
|
||||
<reference key="source" ref="254268962"/>
|
||||
<reference key="destination" ref="892732705"/>
|
||||
</object>
|
||||
<int key="connectionID">445</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">searchController</string>
|
||||
<reference key="source" ref="1001"/>
|
||||
<reference key="destination" ref="596748029"/>
|
||||
</object>
|
||||
<int key="connectionID">437</int>
|
||||
<int key="connectionID">446</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
@@ -3064,6 +3104,17 @@
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">GitXTextFieldCell</string>
|
||||
<string key="superclassName">NSTextFieldCell</string>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">contextMenuDelegate</string>
|
||||
<string key="NS.object.0">id</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<string key="NS.key.0">contextMenuDelegate</string>
|
||||
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||
<string key="name">contextMenuDelegate</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">GitXTextFieldCell.h</string>
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
//
|
||||
|
||||
|
||||
@class PBGitRef;
|
||||
@class PBGitCommit;
|
||||
|
||||
|
||||
@protocol PBRefContextDelegate
|
||||
- (NSArray *) menuItemsForRef:(PBGitRef *)ref;
|
||||
- (NSArray *) menuItemsForCommit:(PBGitCommit *)commit;
|
||||
- (NSArray *)menuItemsForRow:(NSInteger)rowIndex;
|
||||
@end
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
- (NSArray *) menuItemsForRef:(PBGitRef *)ref;
|
||||
- (NSArray *) menuItemsForCommit:(PBGitCommit *)commit;
|
||||
- (NSArray *)menuItemsForRow:(NSInteger)rowIndex;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -275,6 +275,15 @@
|
||||
return [PBRefMenuItem defaultMenuItemsForCommit:commit target:self];
|
||||
}
|
||||
|
||||
- (NSArray *)menuItemsForRow:(NSInteger)rowIndex
|
||||
{
|
||||
NSArray *commits = [commitController arrangedObjects];
|
||||
if ([commits count] <= rowIndex)
|
||||
return nil;
|
||||
|
||||
return [self menuItemsForCommit:[commits objectAtIndex:rowIndex]];
|
||||
}
|
||||
|
||||
|
||||
# pragma mark Tableview delegate methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user