virt-manager

changeset 1350:3b9d502cada4

manager: Add 'delete' option in connection context menu.
author Cole Robinson <crobinso@redhat.com>
date Mon Nov 16 16:35:34 2009 -0500 (2009-11-16)
parents 5792f92367a3
children 72b610046c3f
files src/virtManager/manager.py
line diff
     1.1 --- a/src/virtManager/manager.py	Mon Nov 16 11:36:13 2009 -0500
     1.2 +++ b/src/virtManager/manager.py	Mon Nov 16 16:35:34 2009 -0500
     1.3 @@ -288,7 +288,7 @@
     1.4          self.vmmenu_items["delete"] = gtk.ImageMenuItem("_Delete")
     1.5          self.vmmenu_items["delete"].set_image(self.vmmenu_icons["delete"])
     1.6          self.vmmenu_items["delete"].show()
     1.7 -        self.vmmenu_items["delete"].connect("activate", self.delete_vm)
     1.8 +        self.vmmenu_items["delete"].connect("activate", self.do_delete)
     1.9          self.vmmenu.add(self.vmmenu_items["delete"])
    1.10  
    1.11          self.vmmenu_items["hsep2"] = gtk.SeparatorMenuItem()
    1.12 @@ -316,17 +316,29 @@
    1.13  
    1.14          self.connmenu_items["connect"] = gtk.ImageMenuItem(gtk.STOCK_CONNECT)
    1.15          self.connmenu_items["connect"].show()
    1.16 -        self.connmenu_items["connect"].connect("activate", self.open_connection)
    1.17 +        self.connmenu_items["connect"].connect("activate",
    1.18 +                                               self.open_connection)
    1.19          self.connmenu.add(self.connmenu_items["connect"])
    1.20  
    1.21          self.connmenu_items["disconnect"] = gtk.ImageMenuItem(gtk.STOCK_DISCONNECT)
    1.22          self.connmenu_items["disconnect"].show()
    1.23 -        self.connmenu_items["disconnect"].connect("activate", self.close_connection)
    1.24 +        self.connmenu_items["disconnect"].connect("activate",
    1.25 +                                                  self.close_connection)
    1.26          self.connmenu.add(self.connmenu_items["disconnect"])
    1.27  
    1.28 -        self.connmenu_items["hsep"] = gtk.SeparatorMenuItem()
    1.29 -        self.connmenu_items["hsep"].show()
    1.30 -        self.connmenu.add(self.connmenu_items["hsep"])
    1.31 +        self.connmenu_items["hsep1"] = gtk.SeparatorMenuItem()
    1.32 +        self.connmenu_items["hsep1"].show()
    1.33 +        self.connmenu.add(self.connmenu_items["hsep1"])
    1.34 +
    1.35 +        self.connmenu_items["delete"] = gtk.ImageMenuItem(gtk.STOCK_DELETE)
    1.36 +        self.connmenu_items["delete"].show()
    1.37 +        self.connmenu_items["delete"].connect("activate",
    1.38 +                                              self.do_delete)
    1.39 +        self.connmenu.add(self.connmenu_items["delete"])
    1.40 +
    1.41 +        self.connmenu_items["hsep2"] = gtk.SeparatorMenuItem()
    1.42 +        self.connmenu_items["hsep2"].show()
    1.43 +        self.connmenu.add(self.connmenu_items["hsep2"])
    1.44  
    1.45          self.connmenu_items["details"] = gtk.ImageMenuItem(_("_Details"))
    1.46          self.connmenu_items["details"].connect("activate", self.show_host)
    1.47 @@ -355,7 +367,7 @@
    1.48              "on_vm_shutdown_clicked": self.poweroff_vm,
    1.49              "on_vm_pause_clicked": self.pause_vm_button,
    1.50              "on_menu_edit_details_activate": self.open_vm_console,
    1.51 -            "on_menu_edit_delete_activate": self.delete_vm,
    1.52 +            "on_menu_edit_delete_activate": self.do_delete,
    1.53              "on_menu_host_details_activate": self.show_host,
    1.54  
    1.55              "on_vm_list_row_activated": self.open_vm_console,
    1.56 @@ -812,6 +824,7 @@
    1.57              self.connmenu_items["disconnect"].set_sensitive(not (disconn or
    1.58                                                                   conning))
    1.59              self.connmenu_items["connect"].set_sensitive(disconn)
    1.60 +            self.connmenu_items["delete"].set_sensitive(disconn)
    1.61  
    1.62              self.connmenu.popup(None, None, None, 0, event.time)
    1.63  
    1.64 @@ -820,7 +833,7 @@
    1.65      def new_vm(self, ignore=None):
    1.66          self.emit("action-show-create", self.current_connection_uri())
    1.67  
    1.68 -    def delete_vm(self, ignore=None):
    1.69 +    def do_delete(self, ignore=None):
    1.70          conn = self.current_connection()
    1.71          vm = self.current_vm()
    1.72          if vm is None: