mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-18 12:30:33 +00:00
delete vm from list
This commit is contained in:
parent
b38bb12ab3
commit
abbd1785b1
@ -34,5 +34,6 @@
|
|||||||
- (IBAction) importVirtualMachine: (id) sender;
|
- (IBAction) importVirtualMachine: (id) sender;
|
||||||
- (IBAction) editVirtualMachineSettings: (id) sender;
|
- (IBAction) editVirtualMachineSettings: (id) sender;
|
||||||
- (IBAction) launchVirtualMachine: (id) sender;
|
- (IBAction) launchVirtualMachine: (id) sender;
|
||||||
|
- (IBAction) deleteVirtualMachine: (id) sender;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -21,6 +21,21 @@
|
|||||||
#import "VMListController.h"
|
#import "VMListController.h"
|
||||||
#import "VMSettingsController.h"
|
#import "VMSettingsController.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
|
||||||
|
Verify if VM exists
|
||||||
|
Create Disk on New VM
|
||||||
|
Keep track of VMs that are running and disallow editing settings, re-launching, etc..
|
||||||
|
Drag-drop to re-arrange order of VMs
|
||||||
|
Drag VM from Finder to import
|
||||||
|
Don't show Preferences menu in spawned SheepShaver instances - or make them
|
||||||
|
use the same nib file as this app!
|
||||||
|
Disable buttons on empty selection
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
@implementation VMListController
|
@implementation VMListController
|
||||||
|
|
||||||
+ (id) sharedInstance
|
+ (id) sharedInstance
|
||||||
@ -46,10 +61,20 @@
|
|||||||
- (void) awakeFromNib
|
- (void) awakeFromNib
|
||||||
{
|
{
|
||||||
[vmList setDataSource: self];
|
[vmList setDataSource: self];
|
||||||
//[vmList setDelegate: self];
|
[vmList setDelegate: self];
|
||||||
[vmList reloadData];
|
[vmList reloadData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) keyDown: (NSEvent *) event
|
||||||
|
{
|
||||||
|
if ([event type] == NSKeyDown && [[event characters] length] > 0) {
|
||||||
|
unichar key = [[event characters] characterAtIndex:0];
|
||||||
|
if (key == NSDeleteFunctionKey || key == NSDeleteCharacter) {
|
||||||
|
[self deleteVirtualMachine:self];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (int) numberOfRowsInTableView: (NSTableView *) table
|
- (int) numberOfRowsInTableView: (NSTableView *) table
|
||||||
{
|
{
|
||||||
return [vmArray count];
|
return [vmArray count];
|
||||||
@ -128,7 +153,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) editVirtualMachineSettings:(id)sender
|
- (IBAction) editVirtualMachineSettings: (id) sender
|
||||||
{
|
{
|
||||||
int selectedRow = [vmList selectedRow];
|
int selectedRow = [vmList selectedRow];
|
||||||
if (selectedRow >= 0) {
|
if (selectedRow >= 0) {
|
||||||
@ -136,7 +161,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) launchVirtualMachine:(id)sender
|
- (IBAction) launchVirtualMachine: (id) sender
|
||||||
{
|
{
|
||||||
int selectedRow = [vmList selectedRow];
|
int selectedRow = [vmList selectedRow];
|
||||||
if (selectedRow >= 0) {
|
if (selectedRow >= 0) {
|
||||||
@ -147,4 +172,31 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) deleteVirtualMachine: (id) sender
|
||||||
|
{
|
||||||
|
int selectedRow = [vmList selectedRow];
|
||||||
|
if (selectedRow >= 0) {
|
||||||
|
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
||||||
|
[alert setMessageText:@"Do you wish to remove the selected virtual machine from the list?"];
|
||||||
|
[alert addButtonWithTitle:@"Remove"];
|
||||||
|
[alert addButtonWithTitle:@"Cancel"];
|
||||||
|
[alert setAlertStyle:NSWarningAlertStyle];
|
||||||
|
[alert beginSheetModalForWindow:[self window]
|
||||||
|
modalDelegate:self
|
||||||
|
didEndSelector:@selector(_deleteVirtualMachineDone: returnCode: contextInfo:)
|
||||||
|
contextInfo:nil];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) _deleteVirtualMachineDone: (NSAlert *) alert returnCode: (int) returnCode contextInfo: (void *) contextInfo
|
||||||
|
{
|
||||||
|
if (returnCode == NSAlertFirstButtonReturn) {
|
||||||
|
[vmArray removeObjectAtIndex:[vmList selectedRow]];
|
||||||
|
[vmList deselectAll:self];
|
||||||
|
[vmList reloadData];
|
||||||
|
[[NSUserDefaults standardUserDefaults] setObject:vmArray forKey:@"vm_list"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user