On 06/26/2014 05:54 AM, Giuseppe Scrivano wrote: > 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() > > Good idea, but I think this should be implemented differently so it can tackle some other problems. Right now the connection selected at startup is just determined by how the connection key is hashed in a python dictionary, which is pretty arbitrary. Can you add a new function vmmManager.set_initial_selection, and call that from engine.py:get_manager after add-conn/remove-conn signals are registered? I think the logic should be: - If URI specified via command line --connect, select it - else select the first active connection - else select the first connection Thanks, Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list