summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-04 20:01:48 +0000
committerritsuka <[email protected]>2014-12-04 20:01:48 +0000
commit3748bca487db26b2bc411545c983a23f196407d0 (patch)
treed39a2fd352d2a7323fa870e8e5dc8357a55e553e
parenta96af517ab4c9f870759f3fece919d618cebc32d (diff)
MacGui: merged the two browerFile methods.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6582 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.h2
-rw-r--r--macosx/Controller.m32
2 files changed, 14 insertions, 20 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index d72b1ece5..1cff14375 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -196,8 +196,6 @@ extern NSString *keyTitleTag;
- (void) prepareJob;
- (IBAction) browseFile: (id) sender;
-- (void) browseFileDone: (NSSavePanel *) sheet
- returnCode: (int) returnCode contextInfo: (void *) contextInfo;
- (IBAction) showPicturePanel: (id) sender;
- (IBAction) showPreviewWindow: (id) sender;
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