read fallback icon from cache

SVN revision: 54828
This commit is contained in:
Sebastian Dransfeld 2010-11-22 20:50:46 +00:00
parent c36317f77c
commit bdb6cdffd0
3 changed files with 20 additions and 8 deletions

View File

@ -4,9 +4,6 @@
#include <unistd.h>
#include <Ecore.h>
#include <Ecore_File.h>
#include "Efreet.h"
#include "efreet_private.h"
@ -23,6 +20,7 @@ static Eet_Data_Descriptor *cache_icon_fallback_edd = NULL;
static Eet_File *icon_cache = NULL;
static const char *icon_cache_name = NULL;
static const char *icon_cache_file = NULL;
static Eet_File *icon_fallback_cache = NULL;
static Ecore_File_Monitor *icon_cache_monitor = NULL;
@ -88,6 +86,7 @@ void
efreet_cache_shutdown(void)
{
if (icon_cache) eet_close(icon_cache);
if (icon_fallback_cache) eet_close(icon_fallback_cache);
IF_RELEASE(icon_cache_name);
IF_RELEASE(icon_cache_file);
@ -271,6 +270,21 @@ efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon)
return NULL;
}
const char *
efreet_cache_icon_fallback_find(const char *icon)
{
if (!icon_fallback_cache)
{
const char *path;
path = efreet_icon_cache_file("_fallback");
icon_fallback_cache = eet_open(path, EET_FILE_MODE_READ);
}
if (icon_fallback_cache)
return eet_data_read(icon_fallback_cache, cache_icon_fallback_edd, icon);
return NULL;
}
static Eina_Bool
icon_cache_exe_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
{

View File

@ -10,9 +10,6 @@
#include <dirent.h>
#include <limits.h>
#include <Ecore.h>
#include <Ecore_File.h>
#include "Efreet.h"
#include "efreet_private.h"
@ -411,8 +408,8 @@ efreet_icon_path_find(const char *theme_name, const char *icon, unsigned int siz
* then just look for a non theme icon
*/
if (!value || (value == NON_EXISTING))
#if 0//def ICON_CACHE
value = efreet_cache_icon_fallback_icon(icon);
#ifdef ICON_CACHE
value = efreet_cache_icon_fallback_find(icon);
#else
value = efreet_icon_fallback_icon(icon);
#endif

View File

@ -216,6 +216,7 @@ EAPI Eet_Data_Descriptor *efreet_icon_edd_init(void);
EAPI Eet_Data_Descriptor *efreet_icon_fallback_edd_init(void);
EAPI void efreet_cache_icon_free(Efreet_Cache_Icon *icon);
Efreet_Cache_Icon *efreet_cache_icon_find(Efreet_Icon_Theme *theme, const char *icon);
const char *efreet_cache_icon_fallback_find(const char *icon);
#endif
#define NON_EXISTING (void *)-1