[virt-tools-list] [virt-manager PATCH] details: force select list entry before showing popup menu

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Fri Apr 25 06:53:01 UTC 2014


We show/hide remove device menu by the attribute
of config-remove button.
But on some desktop, it showing popup menu before
selection.
This patch will force select list entry before
showing popup menu.

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 virtManager/details.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/virtManager/details.py b/virtManager/details.py
index 38017d1..30a68c1 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1080,6 +1080,14 @@ class vmmDetails(vmmGObjectUI):
         if not devobj:
             return
 
+        # force select the list entry before showing popup_menu
+        path_tuple = widget.get_path_at_pos(int(event.x), int(event.y))
+        if path_tuple is None:
+            return False
+        path = path_tuple[0]
+        _iter = widget.get_model().get_iter(path)
+        widget.get_selection().select_iter(_iter)
+
         rmdev = self._addhwmenuitems["remove"]
         rmdev.set_visible(self.widget("config-remove").get_visible())
         rmdev.set_sensitive(self.widget("config-remove").get_sensitive())
-- 
1.9.0




More information about the virt-tools-list mailing list