mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
manager: Don't require a list selection to show host details
Just default to the first listed connection.
This commit is contained in:
parent
72fdbd8253
commit
73e99cd2ba
@ -491,11 +491,21 @@ class vmmManager(gobject.GObject):
|
|||||||
return None
|
return None
|
||||||
return vm.get_uuid()
|
return vm.get_uuid()
|
||||||
|
|
||||||
def current_connection_uri(self):
|
def current_connection_uri(self, default_selection=False):
|
||||||
|
vmlist = self.window.get_widget("vm-list")
|
||||||
|
model = vmlist.get_model()
|
||||||
|
|
||||||
conn = self.current_connection()
|
conn = self.current_connection()
|
||||||
if conn is None:
|
if conn is None and default_selection:
|
||||||
return None
|
# Nothing selected, use first connection row
|
||||||
|
for row in model:
|
||||||
|
if row[ROW_IS_CONN]:
|
||||||
|
conn = row[ROW_HANDLE]
|
||||||
|
break
|
||||||
|
|
||||||
|
if conn:
|
||||||
return conn.get_uri()
|
return conn.get_uri()
|
||||||
|
return None
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Action listeners #
|
# Action listeners #
|
||||||
@ -527,7 +537,8 @@ class vmmManager(gobject.GObject):
|
|||||||
self.emit("action-show-preferences")
|
self.emit("action-show-preferences")
|
||||||
|
|
||||||
def show_host(self, src):
|
def show_host(self, src):
|
||||||
self.emit("action-show-host", self.current_connection_uri())
|
uri = self.current_connection_uri(default_selection=True)
|
||||||
|
self.emit("action-show-host", uri)
|
||||||
|
|
||||||
def open_vm_console(self,ignore,ignore2=None,ignore3=None):
|
def open_vm_console(self,ignore,ignore2=None,ignore3=None):
|
||||||
if self.current_vmuuid():
|
if self.current_vmuuid():
|
||||||
@ -919,7 +930,8 @@ class vmmManager(gobject.GObject):
|
|||||||
|
|
||||||
show_open = bool(vm)
|
show_open = bool(vm)
|
||||||
show_details = bool(vm)
|
show_details = bool(vm)
|
||||||
host_details = bool(vm or conn)
|
host_details = bool(len(self.rows))
|
||||||
|
|
||||||
delete = bool((vm and vm.is_runable()) or
|
delete = bool((vm and vm.is_runable()) or
|
||||||
(not vm and conn))
|
(not vm and conn))
|
||||||
show_run = bool(vm and vm.is_runable())
|
show_run = bool(vm and vm.is_runable())
|
||||||
|
Loading…
Reference in New Issue
Block a user