Make writing multiline hint definitions easier

This commit is contained in:
Matthias Klumpp 2016-03-22 02:14:55 +01:00
parent a5498385d7
commit 82a7e129c4
2 changed files with 19 additions and 12 deletions

View File

@ -3,7 +3,7 @@
"desktop-file-read-error": {
"text": "Unable to read data from .desktop file: %(msg)s",
"severity": "error"
},
},
"metainfo-parsing-error": {
"text": "Unable to parse AppStream upstream XML, the file is likely malformed. Error:<br/>%(msg)s",
@ -16,15 +16,15 @@
},
"icon-not-found": {
"text": "The icon '%(icon_fname)s' was not found in the archive. This issue can have multiple reasons:
<ul>
<li>The icon is not present in the archive.</li>
<li>The icon is in a wrong directory.</li>
<li>The icon is not available in a suitable size (at least 64x64px)</li>
</ul>
To make the icon easier to find, place it in <code>/usr/share/icons/hicolor/&lt;size&gt;/apps</code> and ensure the <code>Icon=</code> value
of the .desktop file is set correctly.",
"text": [ "The icon '%(icon_fname)s' was not found in the archive. This issue can have multiple reasons:",
"<ul>",
"<li>The icon is not present in the archive.</li>",
"<li>The icon is in a wrong directory.</li>",
"<li>The icon is not available in a suitable size (at least 64x64px)</li>",
"</ul>",
"To make the icon easier to find, place it in <code>/usr/share/icons/hicolor/&lt;size&gt;/apps</code> and ensure the <code>Icon=</code> value",
"of the .desktop file is set correctly."],
"severity": "error"
},
}
}

View File

@ -166,7 +166,14 @@ class HintsStorage
def.tag = tag;
def.severity = severityFromString (j["severity"].str);
def.text = j["text"].str;
if (j["text"].type == JSON_TYPE.ARRAY) {
foreach (l; j["text"].array)
def.text ~= l.str ~ "\n";
} else {
def.text = j["text"].str;
}
if ("internal" in j)
def.internal = j["internal"].type == JSON_TYPE.TRUE;
@ -191,7 +198,7 @@ class HintsStorage
unittest
{
writeln ("TEST: ", "GeneratorHint");
writeln ("TEST: ", "Issue Hints");
auto hint = new GeneratorHint ("just-a-unittest", "org.freedesktop.foobar.desktop");
hint.vars = ["rainbows": "yes", "unicorns": "no", "storage": "towel"];