diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index a2e180c..9f568ac 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -9,11 +9,16 @@ #import #import "PBViewController.h" +@class PBSourceViewAction; + @interface PBGitSidebarController : PBViewController { IBOutlet NSWindow *window; IBOutlet NSOutlineView *sourceView; NSMutableArray *items; + + /* Specific things */ + PBSourceViewAction *commitAction; } @property(readonly) NSMutableArray *items; diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 6fbf58c..803a19e 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -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"]; diff --git a/PBSourceViewItem.h b/PBSourceViewItem.h index 17b6670..1748f5a 100644 --- a/PBSourceViewItem.h +++ b/PBSourceViewItem.h @@ -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 diff --git a/PBSourceViewItem.m b/PBSourceViewItem.m index bac9099..b7f4045 100644 --- a/PBSourceViewItem.m +++ b/PBSourceViewItem.m @@ -10,7 +10,7 @@ #import "PBGitRevSpecifier.h" @implementation PBSourceViewItem -@synthesize parent, title, isGroupItem, children, revSpecifier; +@synthesize parent, title, isGroupItem, children, revSpecifier, isUncollapsible; - (id)init {