mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Allow a user to select which columns to display
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
PBGitCommit* webCommit;
|
||||
PBGitCommit* rawCommit;
|
||||
PBGitCommit* realCommit;
|
||||
|
||||
}
|
||||
|
||||
@property (assign) int selectedTab;
|
||||
@@ -46,4 +45,6 @@
|
||||
- (void) copyCommitInfo;
|
||||
|
||||
- (BOOL) hasNonlinearPath;
|
||||
|
||||
- (NSMenu *)tableColumnMenu;
|
||||
@end
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
// Set a sort descriptor for the subject column in the history list, as
|
||||
// It can't be sorted by default (because it's bound to a PBGitCommit)
|
||||
[[commitList tableColumnWithIdentifier:@"subject"] setSortDescriptorPrototype:[[NSSortDescriptor alloc] initWithKey:@"subject" ascending:YES]];
|
||||
|
||||
// Add a menu that allows a user to select which columns to view
|
||||
[[commitList headerView] setMenu:[self tableColumnMenu]];
|
||||
[super awakeFromNib];
|
||||
}
|
||||
|
||||
@@ -202,4 +203,19 @@
|
||||
[super removeView];
|
||||
}
|
||||
|
||||
- (NSMenu *)tableColumnMenu
|
||||
{
|
||||
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"Table columns menu"];
|
||||
for (NSTableColumn *column in [commitList tableColumns]) {
|
||||
NSMenuItem *item = [[NSMenuItem alloc] init];
|
||||
[item setTitle:[[column headerCell] stringValue]];
|
||||
[item bind:@"value"
|
||||
toObject:column
|
||||
withKeyPath:@"hidden"
|
||||
options:[NSDictionary dictionaryWithObject:@"NSNegateBoolean" forKey:NSValueTransformerNameBindingOption]];
|
||||
[menu addItem:item];
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user