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

View File

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