details: Pop up 'Add Hardware' option on hw list right click
This commit is contained in:
parent
9876b07ff9
commit
4c2b4f6c43
|
@ -178,6 +178,7 @@ class vmmDetails(gobject.GObject):
|
|||
w, h = self.vm.get_details_window_size()
|
||||
self.topwin.set_default_size(w or 800, h or 600)
|
||||
|
||||
self.addhwmenu = None
|
||||
self.init_menus()
|
||||
self.init_details()
|
||||
|
||||
|
@ -250,6 +251,8 @@ class vmmDetails(gobject.GObject):
|
|||
"on_security_type_changed": self.security_type_changed,
|
||||
"on_security_model_changed": self.security_model_changed,
|
||||
|
||||
"on_hw_list_button_press_event": self.popup_addhw_menu,
|
||||
|
||||
# Listeners stored in vmmConsolePages
|
||||
"on_details_menu_view_fullscreen_activate": self.console.toggle_fullscreen,
|
||||
"on_details_menu_view_size_to_vm_activate": self.console.size_to_vm,
|
||||
|
@ -351,6 +354,16 @@ class vmmDetails(gobject.GObject):
|
|||
image = gtk.image_new_from_icon_name(icon_name, gtk.ICON_SIZE_MENU)
|
||||
self.window.get_widget(name).set_image(image)
|
||||
|
||||
# Add HW popup menu
|
||||
self.addhwmenu = gtk.Menu()
|
||||
addHW = gtk.ImageMenuItem(_("Add Hardware"))
|
||||
addHWImg = gtk.Image()
|
||||
addHWImg.set_from_stock(gtk.STOCK_ADD, gtk.ICON_SIZE_MENU)
|
||||
addHW.set_image(addHWImg)
|
||||
addHW.show()
|
||||
addHW.connect("activate", self.add_hardware)
|
||||
self.addhwmenu.add(addHW)
|
||||
|
||||
# Serial list menu
|
||||
smenu = gtk.Menu()
|
||||
smenu.connect("show", self.populate_serial_menu)
|
||||
|
@ -514,6 +527,12 @@ class vmmDetails(gobject.GObject):
|
|||
|
||||
self.vm.set_details_window_size(event.width, event.height)
|
||||
|
||||
def popup_addhw_menu(self, widget, event):
|
||||
if event.button != 3:
|
||||
return
|
||||
|
||||
self.addhwmenu.popup(None, None, None, 0, event.time)
|
||||
|
||||
def populate_serial_menu(self, src):
|
||||
for ent in src:
|
||||
src.remove(ent)
|
||||
|
|
|
@ -856,6 +856,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<signal name="button_press_event" handler="on_hw_list_button_press_event"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
Loading…
Reference in New Issue