virt-manager/virtman-allow-destroy-from-shutdown-menu-of-crashed-vm.patch

67 lines
2.8 KiB
Diff
Raw Normal View History

bnc#875111
--- virt-manager-1.0.1/virtManager/manager.py.orig 2014-08-18 17:39:09.506148602 -0600
+++ virt-manager-1.0.1/virtManager/manager.py 2014-08-18 17:39:12.440170326 -0600
@@ -892,7 +892,7 @@ class vmmManager(vmmGObjectUI):
show_pause = bool(vm and vm.is_unpauseable())
else:
show_pause = bool(vm and vm.is_pauseable())
- show_shutdown = bool(vm and vm.is_stoppable())
+ show_shutdown = bool(vm and vm.is_destroyable())
if vm and vm.managedsave_supported:
self.change_run_text(vm.hasSavedImage())
--- virt-manager-1.0.1/virtManager/vmmenu.py.orig 2014-08-18 17:39:04.166109065 -0600
+++ virt-manager-1.0.1/virtManager/vmmenu.py 2014-08-18 17:39:15.265191243 -0600
@@ -24,6 +24,7 @@ from gi.repository import Gtk
from virtManager import config
import platform
+import logging
####################################################################
# Build toolbar new button menu (manager and details toolbar) #
@@ -58,6 +59,7 @@ class _VMMenu(Gtk.Menu):
self._parent = src
self._current_vm_cb = current_vm_cb
self._show_open = show_open
+ self._shutdown = None
self._init_state()
@@ -122,6 +124,7 @@ class VMShutdownMenu(_VMMenu):
name = getattr(child, "vmm_widget_name", None)
if name in statemap:
child.set_sensitive(statemap[name])
+ child.set_visible(statemap[name])
class VMActionMenu(_VMMenu):
@@ -133,7 +136,8 @@ class VMActionMenu(_VMMenu):
self._add_action(_("_Pause"), "suspend", Gtk.STOCK_MEDIA_PAUSE)
self._add_action(_("R_esume"), "resume", Gtk.STOCK_MEDIA_PAUSE)
s = self._add_action(_("_Shut Down"), "shutdown", addcb=False)
- s.set_submenu(VMShutdownMenu(self._parent, self._current_vm_cb))
+ self._shutdown = VMShutdownMenu(self._parent, self._current_vm_cb)
+ s.set_submenu(self._shutdown)
self.add(Gtk.SeparatorMenuItem())
self._add_action(_("Clone..."), "clone", None)
@@ -149,7 +153,7 @@ class VMActionMenu(_VMMenu):
def update_widget_states(self, vm):
statemap = {
"run": bool(vm and vm.is_runable()),
- "shutdown": bool(vm and vm.is_stoppable()),
+ "shutdown": bool(vm and vm.is_destroyable()),
"suspend": bool(vm and vm.is_stoppable()),
"resume": bool(vm and vm.is_paused()),
"migrate": bool(vm and vm.is_stoppable()),
@@ -166,6 +170,8 @@ class VMActionMenu(_VMMenu):
child.update_widget_states(vm)
if name in statemap:
child.set_sensitive(statemap[name])
+ if name == "shutdown" and self._shutdown:
+ self._shutdown.update_widget_states(vm)
if name in vismap:
child.set_visible(vismap[name])