Handle the "Hidden" property in .desktop files and complain about it

This resolves #52 while making it visible that the project using
"Hidden" in vendor-provided .desktop files made a mistake there.
This commit is contained in:
Matthias Klumpp 2017-09-22 21:15:04 +02:00
parent ddecdac4a9
commit f325662bad
2 changed files with 17 additions and 1 deletions

View File

@ -17,6 +17,13 @@
"severity": "error"
},
"desktop-file-hidden-set": {
"text": ["This .desktop file has the 'Hidden' property set. This is wrong for vendor-installed .desktop files, and",
"nullifies all effects this .desktop file has, which most certainly not what was intended.",
"See <a href=\"https://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html\">the specification</a> for details."],
"severity": "warning"
},
"metainfo-parsing-error": {
"text": "Unable to parse AppStream metainfo file, the data is likely malformed.<br/>Error: {{msg}}",
"severity": "error"

View File

@ -142,7 +142,7 @@ Component parseDesktopFile (GeneratorResult gres, string fname, string data, boo
try {
auto nodisplay = df.getString (DESKTOP_GROUP, "NoDisplay");
if ((!ignore_nodisplay) && (nodisplay.toLower () == "true")) {
// we ignore this .desktop file, shouldn't be displayed
// we ignore this .desktop file, it's application should not be included
return null;
}
} catch (Throwable) {}
@ -158,6 +158,15 @@ Component parseDesktopFile (GeneratorResult gres, string fname, string data, boo
// if they are not there, the file should be processed.
}
try {
auto hidden = df.getString (DESKTOP_GROUP, "NoDisplay");
if (hidden.toLower () == "true") {
gres.addHint (fnameBase, "desktop-file-hidden-set");
if (!ignore_nodisplay)
return null; // we ignore this .desktop file
}
} catch (Throwable) {}
/* check this is a valid desktop file */
if (!df.hasGroup (DESKTOP_GROUP)) {
gres.addHint (fnameBase,