choosecd: Give proper titles if browsing for floppy media

This commit is contained in:
Cole Robinson 2011-07-22 19:12:48 -04:00
parent 28839cab4d
commit f752d948cd
4 changed files with 29 additions and 9 deletions

View File

@ -161,7 +161,12 @@ class vmmChooseCD(vmmGObjectUI):
rhel6 = self.vm.rhel6_defaults()
self.storage_browser.rhel6_defaults = rhel6
self.storage_browser.set_browse_reason(self.config.CONFIG_DIR_MEDIA)
if self.media_type == MEDIA_FLOPPY:
self.storage_browser.set_browse_reason(
self.config.CONFIG_DIR_FLOPPY_MEDIA)
else:
self.storage_browser.set_browse_reason(
self.config.CONFIG_DIR_ISO_MEDIA)
self.storage_browser.show(self.topwin, self.conn)
vmmGObjectUI.type_register(vmmChooseCD)

View File

@ -32,7 +32,8 @@ class vmmConfig(object):
# GConf directory names for saving last used paths
CONFIG_DIR_IMAGE = "image"
CONFIG_DIR_MEDIA = "media"
CONFIG_DIR_ISO_MEDIA = "isomedia"
CONFIG_DIR_FLOPPY_MEDIA = "floppymedia"
CONFIG_DIR_SAVE = "save"
CONFIG_DIR_RESTORE = "restore"
CONFIG_DIR_SCREENSHOT = "screenshot"
@ -47,12 +48,18 @@ class vmmConfig(object):
"local_title" : _("Locate existing storage"),
},
CONFIG_DIR_MEDIA : {
CONFIG_DIR_ISO_MEDIA : {
"enable_create" : False,
"storage_title" : _("Locate ISO media volume"),
"local_title" : _("Locate ISO media"),
},
CONFIG_DIR_FLOPPY_MEDIA : {
"enable_create" : False,
"storage_title" : _("Locate floppy media volume"),
"local_title" : _("Locate floppy media"),
},
CONFIG_DIR_FS : {
"enable_create" : False,
"storage_title" : _("Locate directory volume"),
@ -655,20 +662,28 @@ class vmmConfig(object):
# Default directory location dealings
def _get_default_dir_key(self, typ):
if (typ == self.CONFIG_DIR_ISO_MEDIA or
typ == self.CONFIG_DIR_FLOPPY_MEDIA):
return "media"
return typ
def get_default_directory(self, conn, _type):
if not _type:
logging.error("Unknown type for get_default_directory")
logging.error("Unknown type '%s' for get_default_directory" % _type)
return
key = self._get_default_dir_key(_type)
try:
path = self.conf.get_value(self.conf_dir + "/paths/default-%s-path"
% _type)
path = self.conf.get_value(self.conf_dir +
"/paths/default-%s-path" % key)
except:
path = None
if not path:
if (_type == self.CONFIG_DIR_IMAGE or
_type == self.CONFIG_DIR_MEDIA):
_type == self.CONFIG_DIR_ISO_MEDIA or
_type == self.CONFIG_DIR_FLOPPY_MEDIA):
path = self.get_default_image_dir(conn)
if (_type == self.CONFIG_DIR_SAVE or
_type == self.CONFIG_DIR_RESTORE):

View File

@ -1971,7 +1971,7 @@ class vmmCreate(vmmGObjectUI):
def _browse_file(self, callback, is_media=False, is_dir=False):
if is_media:
reason = self.config.CONFIG_DIR_MEDIA
reason = self.config.CONFIG_DIR_ISO_MEDIA
elif is_dir:
reason = self.config.CONFIG_DIR_FS
else:

View File

@ -1577,7 +1577,7 @@ class vmmDetails(vmmGObjectUI):
def _browse_file(self, callback, is_media=False):
if is_media:
reason = self.config.CONFIG_DIR_MEDIA
reason = self.config.CONFIG_DIR_ISO_MEDIA
else:
reason = self.config.CONFIG_DIR_IMAGE