6663: RecentFiles.do_save() doesn't do XML escape

reapply from gramps40

svn: r22775
This commit is contained in:
Vassilii Khachaturov 2013-07-30 15:14:07 +00:00
parent 82978c7993
commit 8f14d9cc92
2 changed files with 5 additions and 4 deletions

View File

@ -196,8 +196,8 @@ class RecentFiles(object):
if index > MAX_GRAMPS_ITEMS: if index > MAX_GRAMPS_ITEMS:
break break
xml_file.write(' <RecentItem>\n') xml_file.write(' <RecentItem>\n')
xml_file.write(' <Path>%s</Path>\n' % item.get_path()) xml_file.write(' <Path><![CDATA[%s]]></Path>\n' % item.get_path())
xml_file.write(' <Name>%s</Name>\n' % item.get_name()) xml_file.write(' <Name><![CDATA[%s]]></Name>\n' % item.get_name())
xml_file.write(' <Timestamp>%d</Timestamp>\n' % item.get_time()) xml_file.write(' <Timestamp>%d</Timestamp>\n' % item.get_time())
xml_file.write(' </RecentItem>\n') xml_file.write(' </RecentItem>\n')
xml_file.write('</RecentFiles>\n') xml_file.write('</RecentFiles>\n')

View File

@ -290,17 +290,18 @@ class RecentDocsMenu(object):
for item in rfiles: for item in rfiles:
try: try:
title = item.get_name().replace('_', '__') title = item.get_name()
filename = os.path.basename(item.get_path()) filename = os.path.basename(item.get_path())
action_id = "RecentMenu%d" % count action_id = "RecentMenu%d" % count
buf.write('<menuitem action="%s"/>' % action_id) buf.write('<menuitem action="%s"/>' % action_id)
actions.append((action_id, None, title, None, None, actions.append((action_id, None, title, None, None,
make_callback(item, self.load))) make_callback(item, self.load)))
mitem = Gtk.MenuItem(label=title) mitem = Gtk.MenuItem(label=title, use_underline=False)
mitem.connect('activate', make_callback(item, self.load)) mitem.connect('activate', make_callback(item, self.load))
mitem.show() mitem.show()
new_menu.append(mitem) new_menu.append(mitem)
except RuntimeError: except RuntimeError:
_LOG.info("Ignoring the RecentItem %s (%s)" % (title, filename))
pass # ignore no longer existing files pass # ignore no longer existing files
count += 1 count += 1