Skip to content

Commit

Permalink
CommitController: Add status messages for index operations
Browse files Browse the repository at this point in the history
  • Loading branch information
pieter committed Sep 13, 2009
1 parent ff263c6 commit c6d2b61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 2 additions & 0 deletions PBGitCommitController.h
Expand Up @@ -24,13 +24,15 @@
IBOutlet PBWebChangesController *webController;

NSString *status;
BOOL busy;

NSDictionary *amendEnvironment;

}

@property(copy) NSString *status;
@property(readonly) PBGitIndex *index;
@property(assign) BOOL busy;

// FIXME: redo 0823ff859dc65db238951c16e49293ea411c2b5a
- (IBAction) refresh:(id) sender;
Expand Down
19 changes: 11 additions & 8 deletions PBGitCommitController.m
Expand Up @@ -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
{
Expand All @@ -29,14 +29,10 @@ - (id)initWithRepository:(PBGitRepository *)theRepository superController:(PBGit

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];
Expand Down Expand Up @@ -80,6 +76,8 @@ - (IBAction)signOff:(id)sender

- (void) refresh:(id) sender
{
self.busy = YES;
self.status = @"Refreshing index…";
[index refresh];

// Reload refs (in case HEAD changed)
Expand Down Expand Up @@ -128,4 +126,9 @@ - (IBAction) commit:(id) sender
}


- (void)refreshFinished:(NSNotification *)notification
{
self.busy = NO;
self.status = @"Index refresh finished";
}
@end

0 comments on commit c6d2b61

Please sign in to comment.