config: Validate graphics type directly after reading

Fixes an error in 'new vm' wizard if graphics_type is unset in gconf
This commit is contained in:
Cole Robinson 2011-03-24 11:37:26 -04:00
parent 3b2cba5b1a
commit 1d8222d9ea
1 changed files with 4 additions and 1 deletions

View File

@ -509,7 +509,10 @@ class vmmConfig(object):
self.conf.notify_add(self.conf_dir + "/new-vm/remote-sound", cb, data)
def get_graphics_type(self):
return self.conf.get_string(self.conf_dir + "/new-vm/graphics_type")
ret = self.conf.get_string(self.conf_dir + "/new-vm/graphics_type")
if ret not in ["vnc", "spice"]:
return "vnc"
return ret
def set_graphics_type(self, gtype):
self.conf.set_string(self.conf_dir + "/new-vm/graphics_type",
gtype.lower())