Sidebar: Add "Commit" action

When this tree leaf is selected, the view switches
to the commit view.
This commit is contained in:
Pieter de Bie
2009-09-10 01:18:26 +02:00
parent fb3a1705e3
commit 692a79c3ad
4 changed files with 22 additions and 3 deletions
+5
View File
@@ -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;
+14 -1
View File
@@ -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
View File
@@ -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
View File
@@ -10,7 +10,7 @@
#import "PBGitRevSpecifier.h"
@implementation PBSourceViewItem
@synthesize parent, title, isGroupItem, children, revSpecifier;
@synthesize parent, title, isGroupItem, children, revSpecifier, isUncollapsible;
- (id)init
{