Added right-click popup menu for vm-list

This commit is contained in:
berrange@roquette.boston.redhat.com 2006-04-03 10:21:51 -04:00
parent 68c22a76ee
commit 06157451a4
2 changed files with 26 additions and 0 deletions

View File

@ -298,6 +298,7 @@ Inactive virtual machines</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
<signal name="row_activated" handler="on_vm_list_row_activated" last_modification_time="Mon, 03 Apr 2006 13:43:20 GMT"/>
<signal name="button_press_event" handler="on_vm_list_button_press_event" last_modification_time="Mon, 03 Apr 2006 14:14:43 GMT"/>
</widget>
</child>
</widget>
@ -2119,6 +2120,7 @@ Inactive virtual machines</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="delete_event" handler="on_vmm_console_delete_event" last_modification_time="Mon, 03 Apr 2006 14:21:14 GMT"/>
<child>
<widget class="GtkVBox" id="vbox6">

View File

@ -483,6 +483,22 @@ class vmmManager:
self.window.get_widget("vm-view").set_sensitive(False)
self.window.get_widget("vm-view").set_active(0)
self.vmmenu = gtk.Menu()
self.vmmenu_items = {}
self.vmmenu_items["details"] = gtk.MenuItem("_Details")
self.vmmenu_items["details"].connect("activate", self.show_vm_details)
self.vmmenu_items["details"].show()
self.vmmenu.add(self.vmmenu_items["details"])
self.vmmenu_items["open"] = gtk.MenuItem("Open")
self.vmmenu_items["open"].connect("activate", self.open_vm_console)
self.vmmenu_items["open"].show()
self.vmmenu.add(self.vmmenu_items["open"])
self.vmmenu.show_all()
self.window.signal_autoconnect({
"on_menu_view_status_activate" : self.toggle_status_visible_conf,
"on_menu_view_cpu_usage_activate" : self.toggle_cpu_usage_visible_conf,
@ -499,6 +515,8 @@ class vmmManager:
"on_vm_list_row_activated": self.open_vm_console,
"on_vm_list_button_press_event": self.popup_vm_menu,
"on_menu_edit_preferences_activate": self.show_preferences,
"on_menu_help_about_activate": self.show_about,
})
@ -582,6 +600,12 @@ class vmmManager:
self.window.get_widget("menu_edit_delete").set_sensitive(False)
self.window.get_widget("menu_edit_details").set_sensitive(True)
def popup_vm_menu(self, widget, event):
vm = self.current_vm()
if vm != None:
if event.button == 3:
self.vmmenu.popup(None, None, None, 0, event.time)
def show_about(self, src):
self.engine.show_about()