forked from enlightenment/efl
efreet: write once cache to disk and notify only when needed.
NOTE: eet_sync just force the write of the eet file to the disk. That's exactly what eet_close will do also. eet_sync is just to be used when you are planning to still use it and don't want to close it soon. SVN revision: 57233
This commit is contained in:
parent
74a5463b36
commit
94a1ea33fa
|
@ -460,9 +460,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
eet_sync(util_ef);
|
|
||||||
eet_close(util_ef);
|
eet_close(util_ef);
|
||||||
eet_sync(ef);
|
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
|
|
||||||
/* unlink old cache files */
|
/* unlink old cache files */
|
||||||
|
@ -489,15 +487,18 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* touch update file */
|
/* touch update file */
|
||||||
/* TODO: We need to signal whether the cache was updated or not */
|
if (changed)
|
||||||
snprintf(file, sizeof(file), "%s/efreet/desktop_data.update", efreet_cache_home_get());
|
{
|
||||||
tmpfd = open(file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
snprintf(file, sizeof(file), "%s/efreet/desktop_data.update", efreet_cache_home_get());
|
||||||
if (tmpfd >= 0)
|
tmpfd = open(file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
||||||
{
|
if (tmpfd >= 0)
|
||||||
efreet_fsetowner(tmpfd);
|
{
|
||||||
if (write(tmpfd, "a", 1) != 1) perror("write");
|
efreet_fsetowner(tmpfd);
|
||||||
close(tmpfd);
|
if (write(tmpfd, "a", 1) != 1) perror("write");
|
||||||
}
|
close(tmpfd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(scanned, dir)
|
EINA_LIST_FREE(scanned, dir)
|
||||||
eina_stringshare_del(dir);
|
eina_stringshare_del(dir);
|
||||||
eina_list_free(extra_dirs);
|
eina_list_free(extra_dirs);
|
||||||
|
|
|
@ -968,7 +968,6 @@ main(int argc, char **argv)
|
||||||
icon_theme_free(theme);
|
icon_theme_free(theme);
|
||||||
|
|
||||||
eet_data_write(icon_ef, efreet_version_edd(), EFREET_CACHE_VERSION, icon_version, 1);
|
eet_data_write(icon_ef, efreet_version_edd(), EFREET_CACHE_VERSION, icon_version, 1);
|
||||||
eet_sync(icon_ef);
|
|
||||||
eet_close(icon_ef);
|
eet_close(icon_ef);
|
||||||
efreet_setowner(efreet_icon_cache_file(EFREET_CACHE_ICON_FALLBACK));
|
efreet_setowner(efreet_icon_cache_file(EFREET_CACHE_ICON_FALLBACK));
|
||||||
free(icon_version);
|
free(icon_version);
|
||||||
|
@ -977,20 +976,22 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
/* save data */
|
/* save data */
|
||||||
eet_data_write(theme_ef, efreet_version_edd(), EFREET_CACHE_VERSION, theme_version, 1);
|
eet_data_write(theme_ef, efreet_version_edd(), EFREET_CACHE_VERSION, theme_version, 1);
|
||||||
eet_sync(theme_ef);
|
|
||||||
eet_close(theme_ef);
|
eet_close(theme_ef);
|
||||||
efreet_setowner(efreet_icon_theme_cache_file());
|
efreet_setowner(efreet_icon_theme_cache_file());
|
||||||
free(theme_version);
|
free(theme_version);
|
||||||
|
|
||||||
/* touch update file */
|
/* touch update file */
|
||||||
snprintf(file, sizeof(file), "%s/efreet/icon_data.update", efreet_cache_home_get());
|
if (changed)
|
||||||
tmpfd = open(file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
{
|
||||||
if (tmpfd >= 0)
|
snprintf(file, sizeof(file), "%s/efreet/icon_data.update", efreet_cache_home_get());
|
||||||
{
|
tmpfd = open(file, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
||||||
efreet_fsetowner(tmpfd);
|
if (tmpfd >= 0)
|
||||||
write(tmpfd, "a", 1);
|
{
|
||||||
close(tmpfd);
|
efreet_fsetowner(tmpfd);
|
||||||
}
|
write(tmpfd, "a", 1);
|
||||||
|
close(tmpfd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
on_error_efreet:
|
on_error_efreet:
|
||||||
efreet_shutdown();
|
efreet_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue