efreet: correct desktop cache update on lang reset

As we only build the cache for the current language, we need to trigger
cache rebuild on language change, as the cache might not exist or it is
old.

SVN revision: 72832
This commit is contained in:
Sebastian Dransfeld 2012-06-25 20:54:46 +00:00
parent da8b023295
commit 77d44f84d3
3 changed files with 29 additions and 46 deletions

View File

@ -175,7 +175,7 @@ efreet_lang_reset(void)
efreet_parsed_locale = 0; /* reset this in case they init efreet again */
efreet_dirs_reset();
efreet_cache_desktop_reset();
efreet_cache_desktop_update();
}
/**

View File

@ -941,49 +941,6 @@ efreet_cache_desktop_dirs(void)
return eet_data_read(desktop_cache, efreet_array_string_edd(), EFREET_CACHE_DESKTOP_DIRS);
}
void
efreet_cache_desktop_reset(void)
{
Eina_List *l = NULL;
Efreet_Event_Cache_Update *ev = NULL;
Efreet_Old_Cache *d = NULL;
IF_RELEASE(util_cache_names_key);
IF_RELEASE(util_cache_hash_key);
if ((desktop_cache) && (desktop_cache != NON_EXISTING))
{
d = NEW(Efreet_Old_Cache, 1);
if (!d) goto error;
d->hash = desktops;
d->ef = desktop_cache;
old_desktop_caches = eina_list_append(old_desktop_caches, d);
desktops = eina_hash_string_superfast_new(NULL);
}
desktop_cache = NULL;
efreet_cache_array_string_free(util_cache_names);
util_cache_names = NULL;
if (util_cache_hash)
{
eina_hash_free(util_cache_hash->hash);
free(util_cache_hash);
util_cache_hash = NULL;
}
util_cache = efreet_cache_close(util_cache);
ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, desktop_cache_update_free, d);
return;
error:
IF_FREE(ev);
IF_FREE(d);
EINA_LIST_FREE(l, d)
free(d);
}
void
efreet_cache_desktop_update(void)
{
@ -1160,7 +1117,34 @@ cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
if (!ev) goto error;
if (cache_check_change(path))
{
efreet_cache_desktop_reset();
IF_RELEASE(util_cache_names_key);
IF_RELEASE(util_cache_hash_key);
if ((desktop_cache) && (desktop_cache != NON_EXISTING))
{
d = NEW(Efreet_Old_Cache, 1);
if (!d) goto error;
d->hash = desktops;
d->ef = desktop_cache;
old_desktop_caches = eina_list_append(old_desktop_caches, d);
desktops = eina_hash_string_superfast_new(NULL);
}
desktop_cache = NULL;
efreet_cache_array_string_free(util_cache_names);
util_cache_names = NULL;
if (util_cache_hash)
{
eina_hash_free(util_cache_hash->hash);
free(util_cache_hash);
util_cache_hash = NULL;
}
util_cache = efreet_cache_close(util_cache);
ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, desktop_cache_update_free, d);
}
ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, NULL, NULL, NULL);
/* TODO: Check if desktop_dirs_add exists, and rebuild cache if */

View File

@ -203,7 +203,6 @@ Efreet_Desktop *efreet_cache_desktop_find(const char *file);
void efreet_cache_desktop_free(Efreet_Desktop *desktop);
void efreet_cache_desktop_add(Efreet_Desktop *desktop);
Efreet_Cache_Array_String *efreet_cache_desktop_dirs(void);
void efreet_cache_desktop_reset(void);
Efreet_Cache_Icon *efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon);
Efreet_Cache_Fallback_Icon *efreet_cache_icon_fallback_find(const char *icon);