mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
GitIndex: Add a few notifications
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user