forked from enlightenment/efl
parent
2ce2d03609
commit
fec2ca310f
|
@ -51,6 +51,8 @@ static Efreet_Desktop *efreet_util_cache_find(const char *search, const char *wh
|
||||||
static Eina_List *efreet_util_cache_list(const char *search, const char *what);
|
static Eina_List *efreet_util_cache_list(const char *search, const char *what);
|
||||||
static Eina_List *efreet_util_cache_glob_list(const char *search, const char *what);
|
static Eina_List *efreet_util_cache_glob_list(const char *search, const char *what);
|
||||||
|
|
||||||
|
static Eina_Bool cache_check(void);
|
||||||
|
|
||||||
static Eina_Hash *file_id_by_desktop_path = NULL;
|
static Eina_Hash *file_id_by_desktop_path = NULL;
|
||||||
static const char *cache_file = NULL;
|
static const char *cache_file = NULL;
|
||||||
static Eet_File *cache = NULL;
|
static Eet_File *cache = NULL;
|
||||||
|
@ -69,8 +71,6 @@ efreet_util_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Defer eet open until we actually need it open. */
|
|
||||||
cache = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ);
|
|
||||||
file_id_by_desktop_path = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
file_id_by_desktop_path = eina_hash_string_superfast_new(EINA_FREE_CB(eina_stringshare_del));
|
||||||
|
|
||||||
return init;
|
return init;
|
||||||
|
@ -238,7 +238,7 @@ efreet_util_desktop_exec_find(const char *exec)
|
||||||
int num, i;
|
int num, i;
|
||||||
Efreet_Desktop *ret = NULL;
|
Efreet_Desktop *ret = NULL;
|
||||||
|
|
||||||
if (!cache) return NULL;
|
if (!cache_check()) return NULL;
|
||||||
if (!exec) return NULL;
|
if (!exec) return NULL;
|
||||||
|
|
||||||
keys = eet_list(cache, "*::e", &num);
|
keys = eet_list(cache, "*::e", &num);
|
||||||
|
@ -331,7 +331,7 @@ efreet_util_desktop_exec_glob_list(const char *glob)
|
||||||
int num, i;
|
int num, i;
|
||||||
Eina_List *ret = NULL;
|
Eina_List *ret = NULL;
|
||||||
|
|
||||||
if (!cache) return NULL;
|
if (!cache_check()) return NULL;
|
||||||
if (!glob) return NULL;
|
if (!glob) return NULL;
|
||||||
|
|
||||||
keys = eet_list(cache, "*::e", &num);
|
keys = eet_list(cache, "*::e", &num);
|
||||||
|
@ -408,7 +408,7 @@ efreet_util_desktop_categories_list(void)
|
||||||
int num, i;
|
int num, i;
|
||||||
Eina_List *ret = NULL;
|
Eina_List *ret = NULL;
|
||||||
|
|
||||||
if (!cache) return NULL;
|
if (!cache_check()) return NULL;
|
||||||
keys = eet_list(cache, "*::ca", &num);
|
keys = eet_list(cache, "*::ca", &num);
|
||||||
if (!keys) return NULL;
|
if (!keys) return NULL;
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
|
@ -506,7 +506,7 @@ efreet_util_cache_find(const char *search, const char *what1, const char *what2)
|
||||||
int num, i;
|
int num, i;
|
||||||
Efreet_Desktop *ret = NULL;
|
Efreet_Desktop *ret = NULL;
|
||||||
|
|
||||||
if (!cache) return NULL;
|
if (!cache_check()) return NULL;
|
||||||
if ((!what1) && (!what2)) return NULL;
|
if ((!what1) && (!what2)) return NULL;
|
||||||
|
|
||||||
keys = eet_list(cache, search, &num);
|
keys = eet_list(cache, search, &num);
|
||||||
|
@ -540,7 +540,7 @@ efreet_util_cache_list(const char *search, const char *what)
|
||||||
int num, i;
|
int num, i;
|
||||||
Eina_List *ret = NULL;
|
Eina_List *ret = NULL;
|
||||||
|
|
||||||
if (!cache) return NULL;
|
if (!cache_check()) return NULL;
|
||||||
if (!what) return NULL;
|
if (!what) return NULL;
|
||||||
|
|
||||||
keys = eet_list(cache, search, &num);
|
keys = eet_list(cache, search, &num);
|
||||||
|
@ -575,7 +575,7 @@ efreet_util_cache_glob_list(const char *search, const char *what)
|
||||||
int num, i;
|
int num, i;
|
||||||
Eina_List *ret = NULL;
|
Eina_List *ret = NULL;
|
||||||
|
|
||||||
if (!cache) return NULL;
|
if (!cache_check()) return NULL;
|
||||||
if (!what) return NULL;
|
if (!what) return NULL;
|
||||||
|
|
||||||
keys = eet_list(cache, search, &num);
|
keys = eet_list(cache, search, &num);
|
||||||
|
@ -606,6 +606,20 @@ efreet_util_cache_glob_list(const char *search, const char *what)
|
||||||
void
|
void
|
||||||
efreet_util_desktop_cache_reload(void)
|
efreet_util_desktop_cache_reload(void)
|
||||||
{
|
{
|
||||||
if (cache) eet_close(cache);
|
if (cache && cache != NON_EXISTING) eet_close(cache);
|
||||||
cache = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ);
|
cache = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
cache_check(void)
|
||||||
|
{
|
||||||
|
if (cache == NON_EXISTING) return EINA_FALSE;
|
||||||
|
if (!cache)
|
||||||
|
cache = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ);
|
||||||
|
if (!cache)
|
||||||
|
{
|
||||||
|
cache = NON_EXISTING;
|
||||||
|
return EINA_FALSE;
|
||||||
|
}
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue