diff options
author | ritsuka <[email protected]> | 2014-12-04 20:01:48 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-04 20:01:48 +0000 |
commit | 3748bca487db26b2bc411545c983a23f196407d0 (patch) | |
tree | d39a2fd352d2a7323fa870e8e5dc8357a55e553e /macosx/Controller.m | |
parent | a96af517ab4c9f870759f3fece919d618cebc32d (diff) |
MacGui: merged the two browerFile methods.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6582 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/Controller.m')
-rw-r--r-- | macosx/Controller.m | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m index 39c8e432c..2c8685782 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1678,32 +1678,28 @@ NSString *keyTitleTag = @"keyTitleTag"; #pragma mark - #pragma mark New Output Destination -- (IBAction) browseFile: (id) sender +- (IBAction)browseFile:(id)sender { - /* Open a panel to let the user choose and update the text field */ + // Open a panel to let the user choose and update the text field NSSavePanel * panel = [NSSavePanel savePanel]; - /* We get the current file name and path from the destination field here */ - NSString* destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent]; + + // We get the current file name and path from the destination field here + NSString *destinationDirectory = fDstFile2Field.stringValue.stringByDeletingLastPathComponent; [panel setDirectoryURL:[NSURL fileURLWithPath:destinationDirectory]]; [panel setNameFieldStringValue:[[fDstFile2Field stringValue] lastPathComponent]]; + [panel beginSheetModalForWindow:fWindow completionHandler:^(NSInteger result) { - [self browseFileDone:panel returnCode:(int)result contextInfo:sender]; - }]; -} + if (result == NSFileHandlingPanelOKButton) + { + fDstFile2Field.stringValue = panel.URL.path; -- (void) browseFileDone: (NSSavePanel *) sheet - returnCode: (int) returnCode contextInfo: (void *) contextInfo -{ - if( returnCode == NSOKButton ) - { - [fDstFile2Field setStringValue: [[sheet URL] path]]; - /* Save this path to the prefs so that on next browse destination window it opens there */ - NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent]; - [[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"]; - } + // Save this path to the prefs so that on next browse destination window it opens there + NSString *destinationDirectory = [[fDstFile2Field stringValue] stringByDeletingLastPathComponent]; + [[NSUserDefaults standardUserDefaults] setObject:destinationDirectory forKey:@"LastDestinationDirectory"]; + } + }]; } - #pragma mark - #pragma mark Main Window Control |