From 6427fd90fc470b8ec089f63a3f1326e0018c443e Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 7 Mar 2010 12:14:49 -0700 Subject: [PATCH] Reopen the stage view if that was the last view open --- PBGitDefaults.h | 2 ++ PBGitDefaults.m | 12 ++++++++++++ PBGitSidebarController.m | 8 +++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/PBGitDefaults.h b/PBGitDefaults.h index f56709d..16ff6f9 100644 --- a/PBGitDefaults.h +++ b/PBGitDefaults.h @@ -25,5 +25,7 @@ + (void) setRecentCloneDestination:(NSString *)path; + (BOOL) suppressAcceptDropRef; + (void) setSuppressAcceptDropRef:(BOOL)suppress; ++ (BOOL) showStageView; ++ (void) setShowStageView:(BOOL)suppress; @end diff --git a/PBGitDefaults.m b/PBGitDefaults.m index 66e3422..fe459f4 100644 --- a/PBGitDefaults.m +++ b/PBGitDefaults.m @@ -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 diff --git a/PBGitSidebarController.m b/PBGitSidebarController.m index 707cb5b..5bd1b0f 100644 --- a/PBGitSidebarController.m +++ b/PBGitSidebarController.m @@ -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];