createpool: Use StoragePool.default_target_path

Indirectly, rather than the less useful get_default_dir
This commit is contained in:
Cole Robinson 2019-06-11 08:23:59 -04:00
parent abb4719cee
commit e27202d178
2 changed files with 8 additions and 2 deletions

View File

@ -5,6 +5,7 @@
# See the COPYING file in the top-level directory.
import logging
import os
from gi.repository import Gdk
from gi.repository import Gtk
@ -481,7 +482,11 @@ class vmmCreatePool(vmmGObjectUI):
self.widget("pool-source-path").get_child().set_text(source)
def _browse_target_cb(self, src):
startfolder = StoragePool.get_default_dir(self.conn.get_backend())
current = self.widget("pool-target-path").get_child().get_text()
startfolder = None
if current:
startfolder = os.path.dirname(current)
target = self.err.browse_local(self.conn,
_("Choose target directory"),
dialog_type=Gtk.FileChooserAction.SELECT_FOLDER,

View File

@ -313,7 +313,8 @@ class StoragePool(_StorageObject):
if (self.type == self.TYPE_DIR or
self.type == self.TYPE_NETFS or
self.type == self.TYPE_FS):
return os.path.join(self.get_default_dir(self.conn), self.name)
return os.path.join(
_preferred_default_pool_path(self.conn), self.name)
if self.type == self.TYPE_LOGICAL:
name = self.name
if self.source_name: