details: force select list entry before showing popup menu

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@cn.fujitsu.com>
This commit is contained in:
Chen Hanxiao 2014-04-26 22:45:50 +08:00
parent 2dd2e440d1
commit 8d3dbfb90c
1 changed files with 8 additions and 0 deletions

View File

@ -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())