Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Switch "Discard changes" panel to a window modal sheet

  • Loading branch information...
commit cfcbec788a7bc879fffa88370934a0f39ff69e18 1 parent c0744f1
@brotherbard authored
Showing with 22 additions and 11 deletions.
  1. +22 −11 PBGitIndexController.m
View
33 PBGitIndexController.m
@@ -196,19 +196,30 @@ - (void) showInFinderAction:(id) sender
[ws selectFile: path inFileViewerRootedAtPath:nil];
}
-- (void)discardChangesForFiles:(NSArray *)files force:(BOOL)force
+- (void) discardChangesForFilesAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
- if (!force) {
- int ret = [[NSAlert alertWithMessageText:@"Discard changes"
- defaultButton:nil
- alternateButton:@"Cancel"
- otherButton:nil
- informativeTextWithFormat:@"Are you sure you wish to discard the changes to this file?\n\nYou cannot undo this operation."] runModal];
- if (ret != NSAlertDefaultReturn)
- return;
+ [[alert window] orderOut:nil];
+
+ if (returnCode == NSAlertDefaultReturn) {
+ [commitController.index discardChangesForFiles:contextInfo];
}
-
- [commitController.index discardChangesForFiles:files];
+}
+
+- (void) discardChangesForFiles:(NSArray *)files force:(BOOL)force
+{
+ if (!force) {
+ NSAlert *alert = [NSAlert alertWithMessageText:@"Discard changes"
+ defaultButton:nil
+ alternateButton:@"Cancel"
+ otherButton:nil
+ informativeTextWithFormat:@"Are you sure you wish to discard the changes to this file?\n\nYou cannot undo this operation."];
+ [alert beginSheetModalForWindow:[[commitController view] window]
+ modalDelegate:self
+ didEndSelector:@selector(discardChangesForFilesAlertDidEnd:returnCode:contextInfo:)
+ contextInfo:files];
+ } else {
+ [commitController.index discardChangesForFiles:files];
+ }
}
# pragma mark TableView icon delegate
Please sign in to comment.
Something went wrong with that request. Please try again.