forked from enlightenment/efl
sync cache reload between desktop and util
SVN revision: 47513
This commit is contained in:
parent
45f4c540d5
commit
053190d2f4
|
@ -2211,6 +2211,7 @@ efreet_desktop_cache_update(void *data __UNUSED__, Ecore_File_Monitor *em __UNUS
|
|||
efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
|
||||
cache = tmp;
|
||||
|
||||
efreet_util_desktop_cache_reload();
|
||||
ecore_event_add(EFREET_EVENT_CACHE_UPDATE, ev, efreet_desktop_cache_update_free, d);
|
||||
return;
|
||||
error:
|
||||
|
|
|
@ -205,6 +205,7 @@ const char *efreet_desktop_environment_get(void);
|
|||
EAPI Eet_Data_Descriptor *efreet_desktop_edd_init(void);
|
||||
EAPI void efreet_desktop_edd_shutdown(Eet_Data_Descriptor *edd);
|
||||
|
||||
void efreet_util_desktop_cache_reload(void);
|
||||
EAPI const char *efreet_desktop_util_cache_file(void);
|
||||
EAPI const char *efreet_desktop_cache_file(void);
|
||||
EAPI const char *efreet_desktop_cache_dirs(void);
|
||||
|
|
|
@ -35,21 +35,15 @@ 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_glob_list(const char *search, const char *what);
|
||||
|
||||
static void efreet_util_cache_update(void *data, Ecore_File_Monitor *em,
|
||||
Ecore_File_Event event, const char *path);
|
||||
|
||||
static Eina_Hash *file_id_by_desktop_path = NULL;
|
||||
static const char *cache_file = NULL;
|
||||
static Eet_File *cache = NULL;
|
||||
static Ecore_File_Monitor *cache_monitor = NULL;
|
||||
|
||||
static int init = 0;
|
||||
|
||||
int
|
||||
efreet_util_init(void)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if (init++) return init;
|
||||
_efreet_utils_log_dom = eina_log_domain_register("Efreet_util", EFREET_DEFAULT_LOG_COLOR);
|
||||
if (_efreet_utils_log_dom < 0)
|
||||
|
@ -58,20 +52,10 @@ efreet_util_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.efreet", efreet_home_dir_get());
|
||||
if (!ecore_file_mkpath(buf)) goto log_error;
|
||||
cache_monitor = ecore_file_monitor_add(buf,
|
||||
efreet_util_cache_update,
|
||||
NULL);
|
||||
|
||||
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));
|
||||
|
||||
return init;
|
||||
|
||||
log_error:
|
||||
eina_log_domain_unregister(_efreet_utils_log_dom);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -81,7 +65,6 @@ efreet_util_shutdown(void)
|
|||
|
||||
eina_log_domain_unregister(_efreet_utils_log_dom);
|
||||
IF_FREE_HASH(file_id_by_desktop_path);
|
||||
if (cache_monitor) ecore_file_monitor_del(cache_monitor);
|
||||
if (cache) eet_close(cache);
|
||||
IF_RELEASE(cache_file);
|
||||
return init;
|
||||
|
@ -602,14 +585,9 @@ efreet_util_cache_glob_list(const char *search, const char *what)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
efreet_util_cache_update(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
|
||||
Ecore_File_Event event, const char *path)
|
||||
void
|
||||
efreet_desktop_util_cache_reload(void)
|
||||
{
|
||||
if (strcmp(path, efreet_desktop_util_cache_file())) return;
|
||||
if (event != ECORE_FILE_EVENT_CREATED_FILE &&
|
||||
event != ECORE_FILE_EVENT_MODIFIED) return;
|
||||
|
||||
if (cache) eet_close(cache);
|
||||
cache = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue