From 71befc0f5d0e968451c459e66e1c9e0f6f75bdb8 Mon Sep 17 00:00:00 2001 From: Lily Nie Date: Fri, 24 Jan 2020 16:25:12 +0800 Subject: [PATCH] details: add a remove_devobj_internal function Reviewed-by: Cole Robinson --- virtManager/details/details.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/virtManager/details/details.py b/virtManager/details/details.py index 215079d0..c5d49859 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -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 # #######################