2010-01-09 11:50:28 +01:00
|
|
|
Index: virt-manager-0.8.0/src/virtManager/manager.py
|
2009-08-01 11:46:10 +02:00
|
|
|
===================================================================
|
2010-01-09 11:50:28 +01:00
|
|
|
--- virt-manager-0.8.0.orig/src/virtManager/manager.py
|
|
|
|
+++ virt-manager-0.8.0/src/virtManager/manager.py
|
|
|
|
@@ -624,6 +624,15 @@ class vmmManager(gobject.GObject):
|
2009-05-04 18:36:17 +02:00
|
|
|
vmlist = self.window.get_widget("vm-list")
|
|
|
|
selection = vmlist.get_selection()
|
|
|
|
active = selection.get_selected()
|
|
|
|
+ if active[1] == None and active[0] != None:
|
|
|
|
+ # in some cases on vhost, the connection is not being selected at startup.
|
|
|
|
+ # when creating new vms, if current_connection() returns None, several
|
|
|
|
+ # functions will fail, so if the user hasn't selected a connection, default
|
|
|
|
+ # to the first connection in the list.
|
|
|
|
+ first = active[0].get_iter_first()
|
|
|
|
+ if first != None:
|
|
|
|
+ selection.select_iter( first )
|
|
|
|
+ active = selection.get_selected()
|
2010-01-09 11:50:28 +01:00
|
|
|
if active[1] != None:
|
|
|
|
parent = active[0].iter_parent(active[1])
|
|
|
|
# return the connection of the currently selected vm, or the
|
|
|
|
@@ -769,7 +778,14 @@ class vmmManager(gobject.GObject):
|
|
|
|
return False
|
2009-05-04 18:36:17 +02:00
|
|
|
|
|
|
|
def new_vm(self, ignore=None):
|
|
|
|
- self.emit("action-show-create", self.current_connection_uri())
|
|
|
|
+ conn = self.current_connection()
|
|
|
|
+ if conn.get_state() == vmmConnection.STATE_ACTIVE:
|
|
|
|
+ self.emit("action-show-create", self.current_connection_uri())
|
|
|
|
+ else:
|
|
|
|
+ message_box = gtk.MessageDialog( None, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK,
|
|
|
|
+ _("Must select an active connection before creating a Virtual Machine") )
|
|
|
|
+ message_box.run()
|
|
|
|
+ message_box.destroy()
|
|
|
|
|
2010-01-09 11:50:28 +01:00
|
|
|
def delete_vm(self, ignore=None):
|
|
|
|
conn = self.current_connection()
|