Re: [virt-manager PATCH] details: disable "Remove Hardware" popup menu for USB controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 04/18/2014 12:12 AM, Cole Robinson wrote:
On 04/17/2014 11:13 AM, Chen Hanxiao wrote:
From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>

We could not delete USB controller by "Remove" button.
But we could delete it by right click option.
This patch will disable remove popup menu for USB controller.

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
---
  virtManager/details.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/virtManager/details.py b/virtManager/details.py
index 2e8991b..beb2dcd 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1081,7 +1081,8 @@ class vmmDetails(vmmGObjectUI):
              return
rmdev = self._addhwmenuitems["remove"]
-        if hasattr(devobj, "virtual_device_type"):
+        if (hasattr(devobj, "virtual_device_type") and
+                devobj.type != "usb"):
              rmdev.show()
          else:
              rmdev.hide()

This would require duplicating all the logic in two places. And this fix isn't
exhaustive, since for example it will still allow right-click removal of ps2
mouse which is also disallowed.

Can we do something like check if the 'remove' button is sensitive or visible?
And make the same change for the popup window.

- Cole

Do you mean we should do something like:

diff --git a/virtManager/details.py b/virtManager/details.py
index beb2dcd..798edd0 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1082,7 +1082,7 @@ class vmmDetails(vmmGObjectUI):

         rmdev = self._addhwmenuitems["remove"]
         if (hasattr(devobj, "virtual_device_type") and
-                devobj.type != "usb"):
+                self.widget("config-remove").get_sensitive()):
             rmdev.show()
         else:
             rmdev.hide()

But popup menu could be shown before selecting controllers.

- Chen




_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux