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);
|
efreet_desktop_cache = eina_hash_string_superfast_new(NULL);
|
||||||
cache = tmp;
|
cache = tmp;
|
||||||
|
|
||||||
|
efreet_util_desktop_cache_reload();
|
||||||
ecore_event_add(EFREET_EVENT_CACHE_UPDATE, ev, efreet_desktop_cache_update_free, d);
|
ecore_event_add(EFREET_EVENT_CACHE_UPDATE, ev, efreet_desktop_cache_update_free, d);
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
|
|
|
@ -205,6 +205,7 @@ const char *efreet_desktop_environment_get(void);
|
||||||
EAPI Eet_Data_Descriptor *efreet_desktop_edd_init(void);
|
EAPI Eet_Data_Descriptor *efreet_desktop_edd_init(void);
|
||||||
EAPI void efreet_desktop_edd_shutdown(Eet_Data_Descriptor *edd);
|
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_util_cache_file(void);
|
||||||
EAPI const char *efreet_desktop_cache_file(void);
|
EAPI const char *efreet_desktop_cache_file(void);
|
||||||
EAPI const char *efreet_desktop_cache_dirs(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_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 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 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;
|
||||||
static Ecore_File_Monitor *cache_monitor = NULL;
|
|
||||||
|
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
|
|
||||||
int
|
int
|
||||||
efreet_util_init(void)
|
efreet_util_init(void)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
if (init++) return init;
|
if (init++) return init;
|
||||||
_efreet_utils_log_dom = eina_log_domain_register("Efreet_util", EFREET_DEFAULT_LOG_COLOR);
|
_efreet_utils_log_dom = eina_log_domain_register("Efreet_util", EFREET_DEFAULT_LOG_COLOR);
|
||||||
if (_efreet_utils_log_dom < 0)
|
if (_efreet_utils_log_dom < 0)
|
||||||
|
@ -58,20 +52,10 @@ efreet_util_init(void)
|
||||||
return 0;
|
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);
|
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;
|
||||||
|
|
||||||
log_error:
|
|
||||||
eina_log_domain_unregister(_efreet_utils_log_dom);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -81,7 +65,6 @@ efreet_util_shutdown(void)
|
||||||
|
|
||||||
eina_log_domain_unregister(_efreet_utils_log_dom);
|
eina_log_domain_unregister(_efreet_utils_log_dom);
|
||||||
IF_FREE_HASH(file_id_by_desktop_path);
|
IF_FREE_HASH(file_id_by_desktop_path);
|
||||||
if (cache_monitor) ecore_file_monitor_del(cache_monitor);
|
|
||||||
if (cache) eet_close(cache);
|
if (cache) eet_close(cache);
|
||||||
IF_RELEASE(cache_file);
|
IF_RELEASE(cache_file);
|
||||||
return init;
|
return init;
|
||||||
|
@ -602,14 +585,9 @@ efreet_util_cache_glob_list(const char *search, const char *what)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
efreet_util_cache_update(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
|
efreet_desktop_util_cache_reload(void)
|
||||||
Ecore_File_Event event, const char *path)
|
|
||||||
{
|
{
|
||||||
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);
|
if (cache) eet_close(cache);
|
||||||
cache = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ);
|
cache = eet_open(efreet_desktop_util_cache_file(), EET_FILE_MODE_READ);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue