virt-manager/virtman-manager.diff
Charles Arnold 30975c8aa6 Accepting request 32662 from home:computersalat:devel:Virtualization
Copy from home:computersalat:devel:Virtualization/virt-manager via accept of submit request 32662 revision 3.
Request was accepted with message:
Reviewed ok

OBS-URL: https://build.opensuse.org/request/show/32662
OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=14
2010-02-16 16:11:41 +00:00

38 lines
1.8 KiB
Diff

Index: virt-manager-0.8.1/src/virtManager/manager.py
===================================================================
--- 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):
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()
treestore, treeiter = active
if treeiter != None:
return treestore[treeiter]
@@ -583,7 +591,14 @@ class vmmManager(gobject.GObject):
self.emit("action-show-connect")
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()
def show_about(self, src):
self.emit("action-show-about")