mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-21 00:31:50 +00:00
New Virtual Machine button working
This commit is contained in:
parent
820ae8100c
commit
b38bb12ab3
@ -84,10 +84,20 @@
|
||||
- (IBAction) _newVirtualMachineDone: (NSSavePanel *) save returnCode: (int) returnCode contextInfo: (void *) contextInfo
|
||||
{
|
||||
if (returnCode == NSOKButton) {
|
||||
// make dir.
|
||||
// create prefs file in there
|
||||
// edit said prefs file
|
||||
// advanced: show sub-panel in save dialog that says "Create Disk:"
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
[manager createDirectoryAtPath:[save filename] attributes:nil];
|
||||
[manager createFileAtPath:[[save filename] stringByAppendingPathComponent:@"prefs"] contents:nil attributes:nil];
|
||||
[vmArray addObject:[save filename]];
|
||||
[vmList reloadData];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:vmArray forKey:@"vm_list"];
|
||||
[vmList selectRow:([vmArray count] - 1) byExtendingSelection:NO];
|
||||
[self editVirtualMachineSettings:self];
|
||||
if ([[VMSettingsController sharedInstance] cancelWasClicked]) {
|
||||
[manager removeFileAtPath:[save filename] handler:nil];
|
||||
[vmArray removeObjectAtIndex:([vmArray count] - 1)];
|
||||
[vmList reloadData];
|
||||
}
|
||||
// TODO advanced: show sub-panel in save dialog that says "Create Disk:"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
@interface VMSettingsController : NSWindowController
|
||||
{
|
||||
BOOL cancelWasClicked;
|
||||
|
||||
IBOutlet NSView *diskSaveSize;
|
||||
IBOutlet NSTextField *diskSaveSizeField;
|
||||
NSMutableArray *diskArray;
|
||||
@ -71,6 +73,7 @@
|
||||
- (IBAction) browseForUnixRootClicked: (id) sender;
|
||||
- (void) cancelEdit: (id) sender;
|
||||
- (void) saveChanges: (id) sender;
|
||||
- (BOOL) cancelWasClicked;
|
||||
- (void) dealloc;
|
||||
|
||||
@end
|
||||
|
@ -46,7 +46,11 @@ void prefs_exit()
|
||||
|
||||
- (id) init
|
||||
{
|
||||
return [super initWithWindowNibName:@"VMSettingsWindow"];
|
||||
self = [super initWithWindowNibName:@"VMSettingsWindow"];
|
||||
|
||||
cancelWasClicked = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int) numberOfRowsInTableView: (NSTableView *) table
|
||||
@ -289,6 +293,7 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
||||
PrefsExit();
|
||||
[[self window] close];
|
||||
[NSApp stopModal];
|
||||
cancelWasClicked = YES;
|
||||
}
|
||||
|
||||
- (void) saveChanges: (id) sender
|
||||
@ -346,6 +351,12 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
||||
|
||||
[[self window] close];
|
||||
[NSApp stopModal];
|
||||
cancelWasClicked = NO;
|
||||
}
|
||||
|
||||
- (BOOL) cancelWasClicked
|
||||
{
|
||||
return cancelWasClicked;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
|
Loading…
x
Reference in New Issue
Block a user