Don't store the windowcontroller in an iVar

There's no need to, as we can just retrieve it from
the WindowControllers array.
This commit is contained in:
Pieter de Bie
2008-09-28 13:31:47 +02:00
parent b255fb39d8
commit 95c4bcbaba
2 changed files with 12 additions and 8 deletions
-1
View File
@@ -14,7 +14,6 @@ extern NSString* PBGitRepositoryErrorDomain;
@interface PBGitRepository : NSDocument {
PBGitRevList* revisionList;
NSWindowController *windowController;
BOOL hasChanged;
NSMutableArray* branches;
+12 -7
View File
@@ -19,7 +19,7 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
@implementation PBGitRepository
@synthesize revisionList, branches, currentBranch, refs, windowController, hasChanged;
@synthesize revisionList, branches, currentBranch, refs, hasChanged;
static NSString* gitPath;
+ (void) initialize
@@ -149,8 +149,7 @@ static NSString* gitPath;
// We don't want the window controller to display anything yet..
// We'll leave that to the caller of this method.
windowController = [[PBGitWindowController alloc] initWithRepository:self displayDefault:NO];
[self addWindowController:windowController];
[self addWindowController:[[PBGitWindowController alloc] initWithRepository:self displayDefault:NO]];
[self showWindows];
return self;
@@ -169,10 +168,16 @@ static NSString* gitPath;
// Overridden to create our custom window controller
- (void)makeWindowControllers
{
windowController = [[PBGitWindowController alloc] initWithRepository:self displayDefault:YES];
[self addWindowController:windowController];
[self addWindowController: [[PBGitWindowController alloc] initWithRepository:self displayDefault:YES]];
}
- (NSWindowController *)windowController
{
if ([[self windowControllers] count] == 0)
return NULL;
return [[self windowControllers] objectAtIndex:0];
}
- (void) addRef: (PBGitRef *) ref fromParameters: (NSArray *) components
{
@@ -263,10 +268,10 @@ static NSString* gitPath;
- (void) showHistoryView
{
if (!windowController)
if (!self.windowController)
return;
[((PBGitWindowController *)windowController) showHistoryView:self];
[((PBGitWindowController *)self.windowController) showHistoryView:self];
}
- (void) selectBranch: (PBGitRevSpecifier*) rev