efreet: Fix language change

Need to release generated file name, else we will use same filename
again when opening cache.

Also need to close cache, as a cache rebuild might not trigger cache
close if the cache in another language already exists.

SVN revision: 75020
This commit is contained in:
Sebastian Dransfeld 2012-08-08 19:39:55 +00:00
parent 3bcdd78bca
commit 7fa09b763b
3 changed files with 39 additions and 26 deletions

View File

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

View File

@ -952,6 +952,42 @@ efreet_cache_desktop_update(void)
desktop_cache_timer = ecore_timer_add(0.2, desktop_cache_update_cache_cb, NULL);
}
void
efreet_cache_desktop_close(void)
{
IF_RELEASE(util_cache_names_key);
IF_RELEASE(util_cache_hash_key);
if ((desktop_cache) && (desktop_cache != NON_EXISTING))
{
Efreet_Old_Cache *d = NEW(Efreet_Old_Cache, 1);
if (d)
{
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);
IF_RELEASE(desktop_cache_file);
IF_RELEASE(util_cache_file);
}
void
efreet_cache_icon_update(void)
{
@ -1118,32 +1154,7 @@ cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
ev = NEW(Efreet_Event_Cache_Update, 1);
if (!ev) goto error;
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);
efreet_cache_desktop_close();
ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, desktop_cache_update_free, d);
}

View File

@ -195,6 +195,7 @@ const char *efreet_lang_modifier_get(void);
size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]);
void efreet_cache_desktop_update(void);
void efreet_cache_desktop_close(void);
void efreet_cache_icon_update(void);
Efreet_Desktop *efreet_cache_desktop_find(const char *file);