2010-01-09 11:50:29 +01:00
|
|
|
Index: virt-manager-0.8.1/src/virtManager/manager.py
|
2009-08-01 11:46:10 +02:00
|
|
|
===================================================================
|
2010-01-09 11:50:29 +01:00
|
|
|
--- virt-manager-0.8.1.orig/src/virtManager/manager.py
|
|
|
|
+++ virt-manager-0.8.1/src/virtManager/manager.py
|
|
|
|
@@ -529,7 +529,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()
|
2010-01-09 11:50:29 +01:00
|
|
|
-
|
2009-05-04 18:36:17 +02:00
|
|
|
+ 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:29 +01:00
|
|
|
treestore, treeiter = active
|
|
|
|
if treeiter != None:
|
|
|
|
return treestore[treeiter]
|
|
|
|
@@ -583,7 +591,14 @@ class vmmManager(gobject.GObject):
|
|
|
|
self.emit("action-show-connect")
|
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:29 +01:00
|
|
|
def show_about(self, src):
|
|
|
|
self.emit("action-show-about")
|