details: add a remove_devobj_internal function

Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Lily Nie 2020-01-24 16:25:12 +08:00 committed by Cole Robinson
parent 11d6536542
commit 71befc0f5d
1 changed files with 8 additions and 4 deletions

View File

@ -1801,8 +1801,7 @@ class vmmDetails(vmmGObjectUI):
kwargs, self.vm, self.err, kwargs, self.vm, self.err,
devobj=devobj) devobj=devobj)
# Device removal def remove_devobj_internal(self, devobj):
def remove_device(self, devobj):
log.debug("Removing device: %s", devobj) log.debug("Removing device: %s", devobj)
# Define the change # Define the change
@ -1822,8 +1821,7 @@ class vmmDetails(vmmGObjectUI):
detach_err = (str(e), "".join(traceback.format_exc())) detach_err = (str(e), "".join(traceback.format_exc()))
if not detach_err: if not detach_err:
self.disable_apply() return True
return
self.err.show_err( self.err.show_err(
_("Device could not be removed from the running machine"), _("Device could not be removed from the running machine"),
@ -1833,6 +1831,12 @@ class vmmDetails(vmmGObjectUI):
buttons=Gtk.ButtonsType.OK, buttons=Gtk.ButtonsType.OK,
dialog_type=Gtk.MessageType.INFO) dialog_type=Gtk.MessageType.INFO)
# Device removal
def remove_device(self, devobj):
success = self.remove_devobj_internal(devobj)
if success:
self.disable_apply()
####################### #######################
# vmwindow Public API # # vmwindow Public API #
####################### #######################