diff --git a/VirtualUI/Source/Session/VirtualMachineSessionView.swift b/VirtualUI/Source/Session/VirtualMachineSessionView.swift index 1e78efd4..d348ce27 100644 --- a/VirtualUI/Source/Session/VirtualMachineSessionView.swift +++ b/VirtualUI/Source/Session/VirtualMachineSessionView.swift @@ -190,7 +190,7 @@ public struct VirtualMachineSessionView: View { { [weak controller] in guard let controller else { return true } - guard controller.isStarting || controller.isRunning else { return true } + if controller.isIdle || controller.isStopped { return true } let confirmed = await NSAlert.runConfirmationAlert( title: "Stop Virtual Machine?", @@ -270,12 +270,19 @@ struct VMCircularButtonStyle: ButtonStyle { } extension VMController { + var isIdle: Bool { + return state == .idle + } + var isStarting: Bool { + guard case .starting = state else { return false } + return true + } var isRunning: Bool { guard case .running = state else { return false } return true } - var isStarting: Bool { - guard case .starting = state else { return false } + var isStopped: Bool { + guard case .stopped = state else { return false } return true } }