GitIndex: Add a few notifications

This commit is contained in:
Pieter de Bie
2009-09-13 03:20:12 +02:00
parent cdae809f41
commit ff263c6717
2 changed files with 22 additions and 2 deletions
+6
View File
@@ -11,6 +11,12 @@
@class PBGitRepository;
@class PBChangedFile;
extern NSString *PBGitIndexIndexRefreshStatus;
extern NSString *PBGitIndexIndexRefreshFailed;
extern NSString *PBGitIndexFinishedIndexRefresh;
extern NSString *PBGitIndexCommitFailed;
extern NSString *PBGitIndexFinishedCommit;
// Represents a git index for a given work tree.
// As a single git repository can have multiple trees,
// the tree has to be given explicitly, even though
+16 -2
View File
@@ -13,6 +13,13 @@
#import "NSString_RegEx.h"
#import "PBChangedFile.h"
NSString *PBGitIndexIndexRefreshStatus = @"PBGitIndexIndexRefreshStatus";
NSString *PBGitIndexIndexRefreshFailed = @"PBGitIndexIndexRefreshFailed";
NSString *PBGitIndexFinishedIndexRefresh = @"PBGitIndexFinishedIndexRefresh";
NSString *PBGitIndexCommitFailed = @"PBGitIndexCommitFailed";
NSString *PBGitIndexFinishedCommit = @"PBGitIndexFinishedCommit";
@interface PBGitIndex (IndexRefreshMethods)
- (NSArray *)linesFromNotification:(NSNotification *)notification;
@@ -316,10 +323,16 @@
{
if ([(NSNumber *)[(NSDictionary *)[notification userInfo] objectForKey:@"NSFileHandleError"] intValue])
{
// TODO: send updatefailed notification?
[[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexIndexRefreshFailed
object:self
userInfo:[NSDictionary dictionaryWithObject:@"update-index failed" forKey:@"description"]];
return;
}
[[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexIndexRefreshStatus
object:self
userInfo:[NSDictionary dictionaryWithObject:@"update-index success" forKey:@"description"]];
// Now that the index is refreshed, we need to read the information from the index
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
@@ -529,7 +542,8 @@
[self didChangeValueForKey:@"indexChanges"];
}
// TODO: Sent index refresh finished operation
[[NSNotificationCenter defaultCenter] postNotificationName:PBGitIndexFinishedIndexRefresh
object:self];
}
@end