mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Add convenience method for showing an error sheet.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
- (void)useToolbar:(NSToolbar *)toolbar;
|
||||
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText;
|
||||
- (void)showErrorSheet:(NSError *)error;
|
||||
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output;
|
||||
|
||||
- (IBAction) showCommitView:(id)sender;
|
||||
- (IBAction) showHistoryView:(id)sender;
|
||||
|
||||
@@ -137,6 +137,18 @@
|
||||
[[NSAlert alertWithError:error] beginSheetModalForWindow: [self window] modalDelegate:self didEndSelector:nil contextInfo:nil];
|
||||
}
|
||||
|
||||
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output
|
||||
{
|
||||
NSString *command = [arguments componentsJoinedByString:@" "];
|
||||
NSString *reason = [NSString stringWithFormat:@"%@\n\ncommand: git %@\n%@", message, command, output];
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
title, NSLocalizedDescriptionKey,
|
||||
reason, NSLocalizedRecoverySuggestionErrorKey,
|
||||
nil];
|
||||
NSError *error = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:userInfo];
|
||||
[self showErrorSheet:error];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Toolbar Delegates
|
||||
|
||||
Reference in New Issue
Block a user