[PATCH virt-manager] virt-manager: automatically select the only active connection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If there is only one active connection, automatically select it.  The
advantage is that it makes easier to jump into the connection details
when there is only one Autoconnect connection.

Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx>
---
 virtManager/manager.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/virtManager/manager.py b/virtManager/manager.py
index 1ca84e4..05491be 100644
--- a/virtManager/manager.py
+++ b/virtManager/manager.py
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2008, 2013 Red Hat, Inc.
+# Copyright (C) 2006-2008, 2013-2014 Red Hat, Inc.
 # Copyright (C) 2006 Daniel P. Berrange <berrange@xxxxxxxxxx>
 #
 # This program is free software; you can redistribute it and/or modify
@@ -845,6 +845,13 @@ class vmmManager(vmmGObjectUI):
                     model.remove(child)
                     child = model.iter_children(parent)
 
+        # If there is only one active connection, automatically select it
+        if conn.get_state() == vmmConnection.STATE_ACTIVE:
+            active_conns = [i for i in self.rows.values()
+                            if i[0].get_state() == vmmConnection.STATE_ACTIVE]
+            if len(active_conns) == 1:
+                self.widget("vm-list").get_selection().select_iter(row.iter)
+
         self.conn_row_updated(conn)
         self.update_current_selection()
 
-- 
1.9.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux