enable audio enable/disable switch only for VMs which have such feature (#682)

Check as realiable as possible: existence of dbus connection.
This commit is contained in:
Marek Marczykowski 2012-12-06 06:27:59 +01:00
parent 273cb9257f
commit 82c26dc91f

View File

@ -1114,7 +1114,8 @@ class VmManagerWindow(Ui_VmManagerWindow, QMainWindow):
self.action_appmenus.setEnabled(not vm.is_netvm()) self.action_appmenus.setEnabled(not vm.is_netvm())
self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm())) self.action_editfwrules.setEnabled(vm.is_networked() and not (vm.is_netvm() and not vm.is_proxyvm()))
self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0) self.action_updatevm.setEnabled(vm.is_updateable() or vm.qid == 0)
self.action_toggle_audio_input.setEnabled(vm.last_running and vm.qid != 0) self.action_toggle_audio_input.setEnabled(vm.last_running and vm.qid != 0 and \
session_bus.name_has_owner('org.QubesOS.Audio.%s' % vm.name))
self.action_run_command_in_vm.setEnabled(vm.qid != 0) self.action_run_command_in_vm.setEnabled(vm.qid != 0)
self.action_set_keyboard_layout.setEnabled(vm.qid != 0 and vm.last_running) self.action_set_keyboard_layout.setEnabled(vm.qid != 0 and vm.last_running)
else: else: