diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2021-10-15 20:18:01 +0100 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2021-10-15 20:18:01 +0100 |
commit | b8dacd70870d8472e412b4a38db0030c87a9356c (patch) | |
tree | e1c0d3fe6b9285bb09e61a06ad7c7791ce229e4b | |
parent | c63b005b925d234898f4be04e2e64bfa985506fe (diff) | |
download | enlightenment-b8dacd70870d8472e412b4a38db0030c87a9356c.tar.gz |
e exec recent files - filter out files that don't exist at some points
if files do not exist anymore, then filter them out.
-rw-r--r-- | src/bin/e_exec.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/bin/e_exec.c b/src/bin/e_exec.c index a3ce5f823d..0ff86a1d8d 100644 --- a/src/bin/e_exec.c +++ b/src/bin/e_exec.c @@ -91,6 +91,24 @@ E_API int E_EVENT_EXEC_DEL = -1; static E_Exec_Recent * _e_exec_recent = NULL; static Ecore_Idler *_e_exec_recent_idler = NULL; +static void +_e_exec_recent_exists_filter(void) +{ + Eina_List *l, *ll; + E_Exec_Recent_File *fl; + + if ((!_e_exec_recent) || (!_e_exec_recent->files)) return; + EINA_LIST_FOREACH_SAFE(_e_exec_recent->files, l, ll, fl) + { + if (!ecore_file_exists(fl->file)) + { + _e_exec_recent->files = + eina_list_remove_list(_e_exec_recent->files, l); + free(fl); + } + } +} + static Eina_Bool _e_exec_cb_recent_idler(void *data EINA_UNUSED) { @@ -99,9 +117,10 @@ _e_exec_cb_recent_idler(void *data EINA_UNUSED) Eina_List *l; E_Exec_Recent_File *fl; - e_user_dir_snprintf(buf, sizeof(buf), "recent-files.txt"); + _e_exec_recent_exists_filter(); if ((_e_exec_recent) && (_e_exec_recent->files)) { + e_user_dir_snprintf(buf, sizeof(buf), "recent-files.txt"); f = fopen(buf, "w"); if (f) { @@ -248,6 +267,7 @@ e_exec_recent_files_get(void) { _e_exec_recent_load(); if (!_e_exec_recent) return NULL; + _e_exec_recent_exists_filter(); return _e_exec_recent->files; } |