homescreen: Do not show apps that do not want to be shown

As mandated by the .desktop files.
Otherwise, you might get missing icons.
This commit is contained in:
Xavi Artigas 2020-02-20 13:40:08 +01:00
parent f3076c6d19
commit 6e77c4aae2
1 changed files with 8 additions and 2 deletions

View File

@ -75,7 +75,7 @@ _parse_desktop_file(const char *desktop_file_path, char **app_name, char **app_c
if (!desktop_file) if (!desktop_file)
return 0; return 0;
char *name = NULL, *command = NULL, *icon = NULL; char *name = NULL, *command = NULL, *icon = NULL, *onlyshow = NULL, *nodisplay = NULL;
while (!efl_io_reader_eos_get(desktop_file) && while (!efl_io_reader_eos_get(desktop_file) &&
efl_io_reader_read(desktop_file, &slice) == EINA_ERROR_NO_ERROR) efl_io_reader_read(desktop_file, &slice) == EINA_ERROR_NO_ERROR)
{ {
@ -87,10 +87,12 @@ _parse_desktop_file(const char *desktop_file_path, char **app_name, char **app_c
_parse_token(ptr, "Name=", &name); _parse_token(ptr, "Name=", &name);
_parse_token(ptr, "Exec=", &command); _parse_token(ptr, "Exec=", &command);
_parse_token(ptr, "Icon=", &icon); _parse_token(ptr, "Icon=", &icon);
_parse_token(ptr, "OnlyShowIn=", &onlyshow);
_parse_token(ptr, "NoDisplay=", &nodisplay);
} }
free(content); free(content);
} }
if (name && command && icon) if (name && command && icon && !onlyshow && (!nodisplay || eina_streq(nodisplay, "false")))
{ {
*app_name = name; *app_name = name;
*app_command = command; *app_command = command;
@ -106,6 +108,10 @@ _parse_desktop_file(const char *desktop_file_path, char **app_name, char **app_c
if (icon) if (icon)
free(icon); free(icon);
} }
if (onlyshow)
free(onlyshow);
if (nodisplay)
free(nodisplay);
efl_unref(desktop_file); efl_unref(desktop_file);