Skip to content

Commit

Permalink
Merge pull request laullon#147 from Kyriakis/master
Browse files Browse the repository at this point in the history
Bugfix Branch Moving
  • Loading branch information
laullon committed Dec 17, 2011
2 parents ce241c6 + 1d3caf6 commit 613f231
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions PBRefController.h
Expand Up @@ -21,6 +21,7 @@
IBOutlet PBCommitList *commitList;

IBOutlet NSPopUpButton *branchPopUp;
NSDictionary *dropInfo;
}

- (void) fetchRemote:(PBRefMenuItem *)sender;
Expand Down
25 changes: 16 additions & 9 deletions PBRefController.m
Expand Up @@ -25,6 +25,13 @@

@implementation PBRefController

-(void)dealloc
{
[dropInfo release];

[super dealloc];
}

- (void)awakeFromNib
{
[commitList registerForDraggedTypes:[NSArray arrayWithObject:@"PBGitRef"]];
Expand Down Expand Up @@ -359,7 +366,7 @@ - (NSDragOperation)tableView:(NSTableView*)tv
return NSDragOperationNone;
}

- (void) dropRef:(NSDictionary *)dropInfo
- (void) dropRef
{
PBGitRef *ref = [dropInfo objectForKey:@"dragRef"];
PBGitCommit *oldCommit = [dropInfo objectForKey:@"oldCommit"];
Expand Down Expand Up @@ -401,14 +408,14 @@ - (BOOL)tableView:(NSTableView *)aTableView

PBGitCommit *dropCommit = [[commitController arrangedObjects] objectAtIndex:row];

NSDictionary *dropInfo = [NSDictionary dictionaryWithObjectsAndKeys:
ref, @"dragRef",
oldCommit, @"oldCommit",
dropCommit, @"dropCommit",
nil];
dropInfo = [NSDictionary dictionaryWithObjectsAndKeys:
ref, @"dragRef",
oldCommit, @"oldCommit",
dropCommit, @"dropCommit",
nil];

if ([PBGitDefaults isDialogWarningSuppressedForDialog:kDialogAcceptDroppedRef]) {
[self dropRef:dropInfo];
[self dropRef];
return YES;
}

Expand All @@ -427,7 +434,7 @@ - (BOOL)tableView:(NSTableView *)aTableView
[alert beginSheetModalForWindow:[historyController.repository.windowController window]
modalDelegate:self
didEndSelector:@selector(acceptDropInfoAlertDidEnd:returnCode:contextInfo:)
contextInfo:dropInfo];
contextInfo:Nil];

return YES;
}
Expand All @@ -437,7 +444,7 @@ - (void)acceptDropInfoAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnC
[[alert window] orderOut:nil];

if (returnCode == NSAlertDefaultReturn)
[self dropRef:contextInfo];
[self dropRef];

if ([[alert suppressionButton] state] == NSOnState)
[PBGitDefaults suppressDialogWarningForDialog:kDialogAcceptDroppedRef];
Expand Down

0 comments on commit 613f231

Please sign in to comment.