efm nav menu - fix to not count filtered out and dotfiles in count

This commit is contained in:
Carsten Haitzler 2020-04-24 11:48:29 +01:00
parent 7227173169
commit 785219f3c6
1 changed files with 9 additions and 17 deletions

View File

@ -118,24 +118,16 @@ _e_mod_menu_populate_filter(void *data, Eio_File *handler, const Eina_File_Direc
if (!handler) return EINA_FALSE; if (!handler) return EINA_FALSE;
if (eio_file_check(handler)) return EINA_FALSE; if (eio_file_check(handler)) return EINA_FALSE;
// don't show links to prevent infinte submenus (recursive links)
pd->count++;
if (pd->count > 100)
{
eio_file_cancel(handler);
return EINA_FALSE;
}
/* don't show .dotfiles */
if (fileman_config->view.menu_shows_files)
return (info->path[info->name_start] != '.');
if (lstat(info->path, &st)) return EINA_FALSE; if (lstat(info->path, &st)) return EINA_FALSE;
/* don't show links to prevent infinite submenus */ // don't show dotfiles
if (info->path[info->name_start] == '.') return EINA_FALSE;
return (info->path[info->name_start] != '.') && // limit to only showing up to 100 items
((info->type == EINA_FILE_DIR) || eina_str_has_extension(info->path + info->name_start, "desktop")) && pd->count++;
(!S_ISLNK(st.st_mode)); if (pd->count > 100) return EINA_FALSE;
// if it's a dir or a .desktop file... then include
return ((info->type == EINA_FILE_DIR) ||
eina_str_has_extension(info->path + info->name_start, "desktop"));
} }
static void static void