]> granicus.if.org Git - handbrake/commitdiff
MacGui: merged the two browerFile methods.
authorritsuka <damiog@gmail.com>
Thu, 4 Dec 2014 20:01:48 +0000 (20:01 +0000)
committerritsuka <damiog@gmail.com>
Thu, 4 Dec 2014 20:01:48 +0000 (20:01 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6582 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.h
macosx/Controller.m

index d72b1ece52a17c0fa0569c608a7e82f31205e137..1cff14375e4beaff55f8a03e709a7ecda1f915a3 100644 (file)
@@ -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;
index 39c8e432c7614ba2fce728f19090f9beac69c55b..2c868578222512fd7017d78f7e4cd2370d6b378c 100644 (file)
@@ -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