drun: switch to g_app_info_should_show() for filtering

This function respects OnlyShowIn and NotShowIn to filter out apps that
are not applicable to the current desktop environment. It also does
additional sanity checks on .desktop files, providing the same effect as
the boolean expression it replaced.
This commit is contained in:
Vika Shleina 2022-01-02 14:49:53 +03:00
parent e1355f1ee2
commit 67b592ff2f

View File

@ -75,7 +75,7 @@ static char* get_search_text(char* file) {
static bool populate_widget(char* file, char* action, struct widget_builder* builder) { static bool populate_widget(char* file, char* action, struct widget_builder* builder) {
GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(file); GDesktopAppInfo* info = g_desktop_app_info_new_from_filename(file);
if(info == NULL || g_desktop_app_info_get_is_hidden(info) || g_desktop_app_info_get_nodisplay(info)) { if(info == NULL || !g_app_info_should_show(info)) {
return false; return false;
} }
const char* name; const char* name;