From bdb6cdffd0bedd3a1cb4f0aafd604a523fcbb93c Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Mon, 22 Nov 2010 20:50:46 +0000 Subject: [PATCH] read fallback icon from cache SVN revision: 54828 --- legacy/efreet/src/lib/efreet_cache.c | 20 +++++++++++++++++--- legacy/efreet/src/lib/efreet_icon.c | 7 ++----- legacy/efreet/src/lib/efreet_private.h | 1 + 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/legacy/efreet/src/lib/efreet_cache.c b/legacy/efreet/src/lib/efreet_cache.c index a21d806fff..99ae3801c8 100644 --- a/legacy/efreet/src/lib/efreet_cache.c +++ b/legacy/efreet/src/lib/efreet_cache.c @@ -4,9 +4,6 @@ #include -#include -#include - #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) { diff --git a/legacy/efreet/src/lib/efreet_icon.c b/legacy/efreet/src/lib/efreet_icon.c index 27c5265773..4f2224f975 100644 --- a/legacy/efreet/src/lib/efreet_icon.c +++ b/legacy/efreet/src/lib/efreet_icon.c @@ -10,9 +10,6 @@ #include #include -#include -#include - #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 diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h index 210aec5983..c490b80282 100644 --- a/legacy/efreet/src/lib/efreet_private.h +++ b/legacy/efreet/src/lib/efreet_private.h @@ -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