From 06f675b8994a6d8b8605dd9836ebf04cd7d03395 Mon Sep 17 00:00:00 2001 From: Johannes Gilger Date: Sat, 31 Jan 2009 10:29:08 +0100 Subject: [PATCH] PBGitWindowController: Default to historyViewController for bare repo If the repository we're working on is bare and through some default value we are asked to display the commit-view, we simply change it back to history. --- PBGitWindowController.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PBGitWindowController.m b/PBGitWindowController.m index c430ba6..9f1a93e 100644 --- a/PBGitWindowController.m +++ b/PBGitWindowController.m @@ -51,8 +51,6 @@ - (void) setSelectedViewIndex: (int) i { - selectedViewIndex = i; - [[NSUserDefaults standardUserDefaults] setInteger:i forKey:@"selectedViewIndex"]; [self changeViewController: i]; } @@ -63,6 +61,14 @@ if (viewController != nil) [[viewController view] removeFromSuperview]; + if ([repository isBareRepository]) { // in bare repository we don't want to view commit + whichViewTag = 0; // even if it was selected by default + } + + // Set our default here because we might have changed it (based on bare repo) before + selectedViewIndex = whichViewTag; + [[NSUserDefaults standardUserDefaults] setInteger:whichViewTag forKey:@"selectedViewIndex"]; + switch (whichViewTag) { case 0: // swap in the "CustomImageViewController - NSImageView" @@ -93,6 +99,7 @@ // Allow the viewcontroller to catch actions [self setNextResponder: viewController]; [self didChangeValueForKey:@"viewController"]; // this will trigger the NSTextField's value binding to change + } - (void)awakeFromNib