From: Nathan Kinsinger <[email protected]>
---
PBRefController.m | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/PBRefController.m b/PBRefController.m
index 31c5590..7c1ac62 100644
--- a/PBRefController.m
+++ b/PBRefController.m
@@ -34,27 +34,29 @@ - (void) observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object change:(
}
}
-
-- (void) removeRef:(PBRefMenuItem *) sender
+- (void) removeRefSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode
contextInfo:(void *)contextInfo
{
- NSString *ref_desc = [NSString stringWithFormat:@"%@ %@", [[sender ref]
type], [[sender ref] shortName]];
- NSString *question = [NSString stringWithFormat:@"Are you sure you want
to remove the %...@?", ref_desc];
- int choice = NSRunAlertPanel([NSString stringWithFormat:@"Delete
%...@?", ref_desc], question, @"Delete", @"Cancel", nil);
- // TODO: Use a non-modal alert here, so we don't block all the GitX
windows
-
- if(choice) {
+ if (returnCode == NSAlertDefaultReturn) {
int ret = 1;
- [historyController.repository outputForArguments:[NSArray
arrayWithObjects:@"update-ref", @"-d", [[sender ref] ref], nil] retValue: &ret];
+ PBRefMenuItem *refMenuItem = contextInfo;
+ [historyController.repository outputForArguments:[NSArray
arrayWithObjects:@"update-ref", @"-d", [[refMenuItem ref] ref], nil] retValue:
&ret];
if (ret) {
NSLog(@"Removing ref failed!");
return;
}
- [historyController.repository removeBranch:[[PBGitRevSpecifier
alloc] initWithRef:[sender ref]]];
- [[sender commit] removeRef:[sender ref]];
+ [historyController.repository removeBranch:[[PBGitRevSpecifier
alloc] initWithRef:[refMenuItem ref]]];
+ [[refMenuItem commit] removeRef:[refMenuItem ref]];
[commitController rearrangeObjects];
}
}
+- (void) removeRef:(PBRefMenuItem *)sender
+{
+ NSString *ref_desc = [NSString stringWithFormat:@"%@ %@", [[sender ref]
type], [[sender ref] shortName]];
+ NSString *question = [NSString stringWithFormat:@"Are you sure you want
to remove the %...@?", ref_desc];
+ NSBeginAlertSheet([NSString stringWithFormat:@"Delete %...@?", ref_desc],
@"Delete", @"Cancel", nil, [[historyController view] window], self,
@selector(removeRefSheetDidEnd:returnCode:contextInfo:), NULL, sender,
question);
+}
+
- (void) checkoutRef:(PBRefMenuItem *)sender
{
int ret = 1;
--
1.7.0
To unsubscribe from this group, send email to gitx+unsubscribegooglegroups.com
or reply to this email with the words "REMOVE ME" as the subject.