diff --git a/PBGitCommitController.h b/PBGitCommitController.h index a8b2802..78ce470 100644 --- a/PBGitCommitController.h +++ b/PBGitCommitController.h @@ -24,6 +24,7 @@ IBOutlet PBWebChangesController *webController; NSString *status; + BOOL busy; NSDictionary *amendEnvironment; @@ -31,6 +32,7 @@ @property(copy) NSString *status; @property(readonly) PBGitIndex *index; +@property(assign) BOOL busy; // FIXME: redo 0823ff859dc65db238951c16e49293ea411c2b5a - (IBAction) refresh:(id) sender; diff --git a/PBGitCommitController.m b/PBGitCommitController.m index 38ecc13..0643402 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -14,13 +14,13 @@ #import "NSString_RegEx.h" -@interface PBGitCommitController (PrivateMethods) -- (void)processHunk:(NSString *)hunk stage:(BOOL)stage reverse:(BOOL)reverse; +@interface PBGitCommitController () +- (void)refreshFinished:(NSNotification *)notification; @end @implementation PBGitCommitController -@synthesize status, index; +@synthesize status, index, busy; - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGitWindowController *)controller { @@ -29,14 +29,10 @@ index = [[PBGitIndex alloc] initWithRepository:theRepository workingDirectory:[NSURL fileURLWithPath:[theRepository workingDirectory]]]; [index refresh]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshFinished:) name:PBGitIndexFinishedIndexRefresh object:index]; return self; } -- (BOOL)busy -{ - return NO; -} - - (void)awakeFromNib { [super awakeFromNib]; @@ -80,6 +76,8 @@ - (void) refresh:(id) sender { + self.busy = YES; + self.status = @"Refreshing index…"; [index refresh]; // Reload refs (in case HEAD changed) @@ -128,4 +126,9 @@ } +- (void)refreshFinished:(NSNotification *)notification +{ + self.busy = NO; + self.status = @"Index refresh finished"; +} @end