manager: Properly show domain names with reserved XML characters

This commit is contained in:
Cole Robinson 2011-08-29 12:11:43 -04:00
parent a1057be68f
commit 8a51336152
4 changed files with 9 additions and 7 deletions

View File

@ -91,7 +91,7 @@ class vmmDeleteDialog(vmmGObjectUI):
# Set VM name in title'
title_str = ("<span size='x-large'>%s '%s'</span>" %
(_("Delete"), self.vm.get_name()))
(_("Delete"), util.xml_escape(self.vm.get_name())))
self.widget("delete-main-label").set_markup(title_str)
self.widget("delete-cancel").grab_focus()

View File

@ -701,12 +701,12 @@ class vmmManager(vmmGObjectUI):
return hint
def _build_conn_markup(self, conn, row):
name = util.xml_escape(row[ROW_NAME])
text = name
if conn.state == conn.STATE_DISCONNECTED:
text = str(row[ROW_NAME]) + " - " + _("Not Connected")
text += " - " + _("Not Connected")
elif conn.state == conn.STATE_CONNECTING:
text = str(row[ROW_NAME]) + " - " + _("Connecting...")
else:
text = str(row[ROW_NAME])
text += " - " + _("Connecting...")
markup = "<span size='smaller'>%s</span>" % text
return markup
@ -720,7 +720,7 @@ class vmmManager(vmmGObjectUI):
def _build_vm_markup(self, row):
domtext = ("<span size='smaller' weight='bold'>%s</span>" %
row[ROW_NAME])
util.xml_escape(row[ROW_NAME]))
statetext = "<span size='smaller'>%s</span>" % row[ROW_STATUS]
return domtext + "\n" + statetext

View File

@ -122,7 +122,7 @@ class vmmMigrateDialog(vmmGObjectUI):
def reset_state(self):
title_str = ("<span size='large' color='white'>%s '%s'</span>" %
(_("Migrate"), self.vm.get_name()))
(_("Migrate"), util.xml_escape(self.vm.get_name())))
self.widget("migrate-main-label").set_markup(title_str)
self.widget("migrate-cancel").grab_focus()

View File

@ -29,6 +29,8 @@ import virtinst
running_config = None
xml_escape = virtinst.util.xml_escape
# FIXME: selinux policy also has a ~/VirtualMachines/isos dir
def get_default_pool_path(conn):
if conn.is_session_uri():