mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Use a separate controller for tabs
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
{
|
||||
IBOutlet NSWindow *window;
|
||||
IBOutlet PBGitRepository* repository;
|
||||
IBOutlet NSNumber* selectedTab;
|
||||
|
||||
NSPersistentStoreCoordinator *persistentStoreCoordinator;
|
||||
NSManagedObjectModel *managedObjectModel;
|
||||
@@ -27,5 +26,4 @@
|
||||
- (IBAction)saveAction:sender;
|
||||
|
||||
@property (retain) PBGitRepository* repository;
|
||||
@property (copy) NSNumber* selectedTab;
|
||||
@end
|
||||
|
||||
@@ -10,12 +10,10 @@
|
||||
|
||||
@implementation ApplicationController
|
||||
|
||||
@synthesize repository, selectedTab;
|
||||
@synthesize repository;
|
||||
|
||||
- (ApplicationController*) init
|
||||
{
|
||||
self.selectedTab = [NSNumber numberWithInt:0];
|
||||
|
||||
// Find the current repository
|
||||
char* a = getenv("PWD");
|
||||
NSString* path;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// PBDetailController.h
|
||||
// GitX
|
||||
//
|
||||
// Created by Pieter de Bie on 16-06-08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "PBGitCommit.h"
|
||||
#import "PBGitTree.h"
|
||||
|
||||
@interface PBDetailController : NSObject {
|
||||
IBOutlet NSNumber* selectedTab;
|
||||
IBOutlet NSArrayController* commitController;
|
||||
|
||||
PBGitTree* gitTree;
|
||||
PBGitCommit* webCommit;
|
||||
PBGitCommit* rawCommit;
|
||||
PBGitCommit* realCommit;
|
||||
}
|
||||
|
||||
@property (copy) NSNumber* selectedTab;
|
||||
@property (retain) PBGitCommit* webCommit;
|
||||
@property (retain) PBGitCommit* rawCommit;
|
||||
@property (retain) PBGitCommit* realCommit;
|
||||
@property (retain) PBGitTree* gitTree;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// PBDetailController.m
|
||||
// GitX
|
||||
//
|
||||
// Created by Pieter de Bie on 16-06-08.
|
||||
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "PBDetailController.h"
|
||||
|
||||
|
||||
@implementation PBDetailController
|
||||
|
||||
@synthesize selectedTab, webCommit, rawCommit, realCommit, gitTree;
|
||||
|
||||
- init
|
||||
{
|
||||
self.selectedTab = [NSNumber numberWithInt:0];
|
||||
[commitController bind:@"realCommit" toObject:self withKeyPath:@"selection" options:nil];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) updateKeys
|
||||
{
|
||||
self.webCommit = nil;
|
||||
self.rawCommit = nil;
|
||||
self.gitTree = nil;
|
||||
|
||||
int num = [self.selectedTab intValue];
|
||||
|
||||
if (num == 0) // Detailed view
|
||||
self.webCommit = self.realCommit;
|
||||
if (num == 1)
|
||||
self.rawCommit = self.realCommit;
|
||||
if (num == 2)
|
||||
self.gitTree = self.realCommit.tree;
|
||||
}
|
||||
|
||||
- (void) setRealCommit: (PBGitCommit*) commit
|
||||
{
|
||||
realCommit = commit;
|
||||
[self updateKeys];
|
||||
}
|
||||
|
||||
- (void) setSelectedTab: (NSNumber*) number
|
||||
{
|
||||
selectedTab = number;
|
||||
[self updateKeys];
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user