Add "Install from web" "Install from CD" and "Quit" buttons to the install menu. "From CD" prompts a system file picker (osx only).

This commit is contained in:
Paul Chote
2011-01-19 23:24:13 +13:00
parent 6c14b78b7c
commit 908a927929
6 changed files with 60 additions and 12 deletions

View File

@@ -5,7 +5,7 @@
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#import "main.h"
#import "Controller.h"
@implementation Controller
@@ -43,13 +43,17 @@
[[NSApplication sharedApplication] terminate:self];
}
[self launchMod:@"cnc"];
[self launchMod:@"ra"];
[NSApp terminate: nil];
}
- (void)launchFilePicker:(NSArray *)args
{
hide_menubar_if_necessary();
[NSApp activateIgnoringOtherApps:YES];
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setLevel:CGShieldingWindowLevel()];
[op setAllowsMultipleSelection:NO];
NSUInteger a = [args indexOfObject:@"--title"];
@@ -64,6 +68,18 @@
if (a != NSNotFound)
[op setDirectory:[[args objectAtIndex:a+1] stringByExpandingTildeInPath]];
a = [args indexOfObject:@"--require-directory"];
if (a != NSNotFound)
{
[op setCanChooseFiles:NO];
[op setCanChooseDirectories:YES];
}
a = [args indexOfObject:@"--button-text"];
if (a != NSNotFound)
[op setPrompt:[[args objectAtIndex:a+1] stringByExpandingTildeInPath]];
if ([op runModal] == NSFileHandlingPanelOKButton)
printf("%s\n", [[[op URL] path] UTF8String]);