virt-manager: automatically select newly created volume

When a new volume is created for a storage, automatically select it;
most likely it is what the user will choose to use.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

(crobinso: util is gone now, replace with uihelpers)
This commit is contained in:
Giuseppe Scrivano 2013-08-13 14:26:29 +02:00 committed by Cole Robinson
parent 155a7f1f03
commit da3237e8a6

View File

@ -272,13 +272,21 @@ class vmmStorageBrowser(vmmGObjectUI):
canchoose = bool(vol and vol[5])
self.widget("choose-volume").set_sensitive(canchoose)
def refresh_current_pool(self, ignore):
def refresh_current_pool(self, createvol):
cp = self.current_pool()
if cp is None:
return
cp.refresh()
self.refresh_storage_pool(None, cp.get_uuid())
vol_list = self.widget("vol-list")
def select_volume(model, path, it, volume_name):
if model.get(it, 0)[0] == volume_name:
uihelpers.set_list_selection(vol_list, path)
vol_list.get_model().foreach(select_volume, createvol.vol.name)
def new_volume(self, src_ignore):
pool = self.current_pool()
if pool is None: