Reopen the stage view if that was the last view open

This commit is contained in:
Nathan Kinsinger
2010-03-07 12:14:49 -07:00
parent 388818b045
commit 6427fd90fc
3 changed files with 21 additions and 1 deletions
+2
View File
@@ -25,5 +25,7 @@
+ (void) setRecentCloneDestination:(NSString *)path;
+ (BOOL) suppressAcceptDropRef;
+ (void) setSuppressAcceptDropRef:(BOOL)suppress;
+ (BOOL) showStageView;
+ (void) setShowStageView:(BOOL)suppress;
@end
+12
View File
@@ -20,6 +20,7 @@
#define kShouldCheckoutBranch @"PBShouldCheckoutBranch"
#define kRecentCloneDestination @"PBRecentCloneDestination"
#define kSuppressAcceptDropRef @"PBSuppressAcceptDropRef"
#define kShowStageView @"PBShowStageView"
@implementation PBGitDefaults
@@ -117,4 +118,15 @@
return [[NSUserDefaults standardUserDefaults] setBool:suppress forKey:kSuppressAcceptDropRef];
}
+ (BOOL) showStageView
{
return [[NSUserDefaults standardUserDefaults] boolForKey:kShowStageView];
}
+ (void) setShowStageView:(BOOL)suppress
{
return [[NSUserDefaults standardUserDefaults] setBool:suppress forKey:kShowStageView];
}
@end
+7 -1
View File
@@ -14,6 +14,7 @@
#import "PBSourceViewCell.h"
#import "NSOutlineViewExt.h"
#import "PBAddRemoteSheet.h"
#import "PBGitDefaults.h"
@interface PBGitSidebarController ()
@@ -52,7 +53,10 @@
[self menuNeedsUpdate:[actionButton menu]];
[self selectCurrentBranch];
if ([PBGitDefaults showStageView])
[self selectStage];
else
[self selectCurrentBranch];
}
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
@@ -176,10 +180,12 @@
if ([item revSpecifier]) {
repository.currentBranch = [item revSpecifier];
[superController changeContentController:historyViewController];
[PBGitDefaults setShowStageView:NO];
}
if (item == stage) {
[superController changeContentController:commitViewController];
[PBGitDefaults setShowStageView:YES];
}
[self updateActionMenu];