mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Sidebar: Add "Commit" action
When this tree leaf is selected, the view switches to the commit view.
This commit is contained in:
@@ -9,11 +9,16 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PBViewController.h"
|
||||
|
||||
@class PBSourceViewAction;
|
||||
|
||||
@interface PBGitSidebarController : PBViewController {
|
||||
IBOutlet NSWindow *window;
|
||||
IBOutlet NSOutlineView *sourceView;
|
||||
|
||||
NSMutableArray *items;
|
||||
|
||||
/* Specific things */
|
||||
PBSourceViewAction *commitAction;
|
||||
}
|
||||
|
||||
@property(readonly) NSMutableArray *items;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#import "PBGitSidebarController.h"
|
||||
#import "PBSourceViewItem.h"
|
||||
#import "NSOutlineViewExt.h"
|
||||
#import "PBSourceViewAction.h"
|
||||
|
||||
@interface PBGitSidebarController ()
|
||||
|
||||
@@ -82,7 +83,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle Remotes etc */
|
||||
if (item == commitAction)
|
||||
[[repository windowController] showCommitView:self];
|
||||
|
||||
/* ... */
|
||||
|
||||
|
||||
/* Handle Remotes */
|
||||
}
|
||||
|
||||
#pragma mark NSOutlineView delegate methods
|
||||
@@ -119,6 +126,12 @@
|
||||
{
|
||||
PBSourceViewItem *actions = [PBSourceViewItem groupItemWithTitle:@"Actions"];
|
||||
|
||||
actions.isUncollapsible = YES;
|
||||
|
||||
commitAction = [PBSourceViewAction itemWithTitle:@"Index / Commit"];
|
||||
commitAction.icon = [NSImage imageNamed:@"CommitViewTemplate"];
|
||||
[actions addChild:commitAction];
|
||||
|
||||
PBSourceViewItem *branches = [PBSourceViewItem groupItemWithTitle:@"Branches"];
|
||||
PBSourceViewItem *remotes = [PBSourceViewItem groupItemWithTitle:@"Remotes"];
|
||||
PBSourceViewItem *tags = [PBSourceViewItem groupItemWithTitle:@"Tags"];
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@
|
||||
PBSourceViewItem *parent;
|
||||
|
||||
BOOL isGroupItem;
|
||||
BOOL isUncollapsible;
|
||||
}
|
||||
|
||||
+ (id)groupItemWithTitle:(NSString *)title;
|
||||
@@ -36,7 +37,7 @@
|
||||
|
||||
@property(retain) NSString *title;
|
||||
@property(readonly) NSMutableArray *children;
|
||||
@property(assign) BOOL isGroupItem;
|
||||
@property(assign) BOOL isGroupItem, isUncollapsible;
|
||||
@property(retain) PBGitRevSpecifier *revSpecifier;
|
||||
@property(retain) PBSourceViewItem *parent;
|
||||
@end
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
#import "PBGitRevSpecifier.h"
|
||||
|
||||
@implementation PBSourceViewItem
|
||||
@synthesize parent, title, isGroupItem, children, revSpecifier;
|
||||
@synthesize parent, title, isGroupItem, children, revSpecifier, isUncollapsible;
|
||||
|
||||
- (id)init
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user