6663: RecentFiles.do_save() doesn't do XML escape
As John Ralls suggested, wrapped the path/db name in a CDATA section upon writeout. In DisplayState, instead of escaping _, tell gtk to ignore the underline; add logging to help seeing ignored files. svn: r22773
This commit is contained in:
parent
e93edb9ad2
commit
3a77392cbb
@ -273,17 +273,18 @@ class RecentDocsMenu(object):
|
||||
|
||||
for item in rfiles:
|
||||
try:
|
||||
title = item.get_name().replace('_', '__')
|
||||
title = item.get_name()
|
||||
filename = os.path.basename(item.get_path())
|
||||
action_id = "RecentMenu%d" % count
|
||||
buf.write('<menuitem action="%s"/>' % action_id)
|
||||
actions.append((action_id, None, title, None, None,
|
||||
make_callback(item, self.load)))
|
||||
mitem = gtk.MenuItem(title)
|
||||
mitem = gtk.MenuItem(title, use_underline=False)
|
||||
mitem.connect('activate', make_callback(item, self.load))
|
||||
mitem.show()
|
||||
new_menu.append(mitem)
|
||||
except RuntimeError:
|
||||
_LOG.info("Ignoring the RecentItem %s (%s)" % (title, filename))
|
||||
pass # ignore no longer existing files
|
||||
|
||||
count += 1
|
||||
|
@ -173,8 +173,8 @@ class RecentFiles(object):
|
||||
if index > MAX_GRAMPS_ITEMS:
|
||||
break
|
||||
xml_file.write(' <RecentItem>\n')
|
||||
xml_file.write(' <Path>%s</Path>\n' % item.get_path())
|
||||
xml_file.write(' <Name>%s</Name>\n' % item.get_name())
|
||||
xml_file.write(' <Path><![CDATA[%s]]></Path>\n' % item.get_path())
|
||||
xml_file.write(' <Name><![CDATA[%s]]></Name>\n' % item.get_name())
|
||||
xml_file.write(' <Timestamp>%d</Timestamp>\n' % item.get_time())
|
||||
xml_file.write(' </RecentItem>\n')
|
||||
xml_file.write('</RecentFiles>\n')
|
||||
|
Loading…
Reference in New Issue
Block a user