Always use icon cache, remove old code

SVN revision: 56590
This commit is contained in:
Sebastian Dransfeld 2011-01-31 11:43:31 +00:00
parent fbcff4288f
commit e3e3b2a204
8 changed files with 11 additions and 1206 deletions

View File

@ -21,3 +21,8 @@
2011-01-31 Sebastian Dransfeld
* Add temporary memory cache of eet file data
2011-01-31 Sebastian Dransfeld
* Always use icon cache, remove old code

View File

@ -95,22 +95,6 @@ if test "x${enable_sloppy_spec}" = "xyes" ; then
AC_DEFINE([SLOPPY_SPEC], [1], [Sloppy Spec Compliance])
fi
AC_ARG_ENABLE([icon-cache],
[AC_HELP_STRING([--enable-icon-cache], [Enable icon cache compliance @<:@default=disabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
enable_icon_cache="yes"
else
enable_icon_cache="no"
fi
],
[enable_icon_cache="no"])
if test "x${enable_icon_cache}" = "xyes" ; then
AC_DEFINE([ICON_CACHE], [1], [Icon Cache])
fi
AM_CONDITIONAL(ICON_CACHE, test "x$enable_icon_cache" = "xyes")
#AC_ARG_ENABLE(hidden-visibility,
# [AC_HELP_STRING([--enable-hidden-visibility],[Enable hidden visibility])],
@ -266,8 +250,6 @@ echo " Specification compliance:"
echo " Strict.............: ${enable_strict_spec}"
echo " Sloppy.............: ${enable_sloppy_spec}"
echo
echo " Icon cache...........: ${enable_icon_cache}"
echo
echo " Tests................: ${enable_tests}"
echo " Coverage.............: ${enable_coverage}"
echo

View File

@ -11,12 +11,8 @@ AM_CPPFLAGS = \
internal_bindir=$(libdir)/efreet
internal_bin_PROGRAMS = \
efreet_desktop_cache_create
if ICON_CACHE
internal_bin_PROGRAMS += \
efreet_desktop_cache_create \
efreet_icon_cache_create
endif
efreet_desktop_cache_create_LDADD = \
$(top_builddir)/src/lib/libefreet.la \
@ -25,13 +21,9 @@ $(top_builddir)/src/lib/libefreet.la \
efreet_desktop_cache_create_SOURCES = \
efreet_desktop_cache_create.c
if ICON_CACHE
efreet_icon_cache_create_LDADD = \
$(top_builddir)/src/lib/libefreet.la \
@EFREET_LIBS@
efreet_icon_cache_create_SOURCES = \
efreet_icon_cache_create.c
endif

View File

@ -32,7 +32,6 @@ static int _efreet_cache_log_dom = -1;
/**
* Data for cache files
*/
#ifdef ICON_CACHE
static Eet_Data_Descriptor *directory_edd = NULL;
static Eet_Data_Descriptor *icon_theme_edd = NULL;
static Eet_Data_Descriptor *icon_theme_directory_edd = NULL;
@ -52,7 +51,6 @@ static const char *icon_theme_cache_file = NULL;
static const char *theme_name = NULL;
static Efreet_Cache_Icons *theme_cache = NULL;
static Efreet_Cache_Icons *fallback_cache = NULL;
#endif
static Eet_Data_Descriptor *version_edd = NULL;
static Eet_Data_Descriptor *desktop_edd = NULL;
@ -67,21 +65,17 @@ static const char *desktop_cache_file = NULL;
static Ecore_File_Monitor *cache_monitor = NULL;
static Ecore_Event_Handler *cache_exe_handler = NULL;
#ifdef ICON_CACHE
static Ecore_Job *icon_cache_job = NULL;
static Ecore_Exe *icon_cache_exe = NULL;
static int icon_cache_exe_lock = -1;
#endif
static Ecore_Job *desktop_cache_job = NULL;
static Ecore_Exe *desktop_cache_exe = NULL;
static int desktop_cache_exe_lock = -1;
static Eina_List *old_desktop_caches = NULL;
#ifdef ICON_CACHE
static Efreet_Cache_Icons *_efreet_cache_free(Efreet_Cache_Icons *cache);
static Efreet_Cache_Icons *_efreet_cache_fallback_free(Efreet_Cache_Icons *cache);
#endif
static void efreet_cache_edd_shutdown(void);
static Eina_Bool cache_exe_cb(void *data, int type, void *event);
@ -89,13 +83,9 @@ static void cache_update_cb(void *data, Ecore_File_Monitor *em,
Ecore_File_Event event, const char *path);
static void desktop_cache_update_cache_job(void *data);
#ifdef ICON_CACHE
static void icon_cache_update_cache_job(void *data);
#endif
static void desktop_cache_update_free(void *data, void *ev);
#ifdef ICON_CACHE
static void icon_cache_update_free(void *data, void *ev);
#endif
EAPI int EFREET_EVENT_ICON_CACHE_UPDATE = 0;
EAPI int EFREET_EVENT_DESKTOP_CACHE_UPDATE = 0;
@ -109,9 +99,7 @@ efreet_cache_init(void)
if (_efreet_cache_log_dom < 0)
return 0;
#ifdef ICON_CACHE
EFREET_EVENT_ICON_CACHE_UPDATE = ecore_event_type_new();
#endif
EFREET_EVENT_DESKTOP_CACHE_UPDATE = ecore_event_type_new();
snprintf(buf, sizeof(buf), "%s/efreet", efreet_cache_home_get());
@ -128,9 +116,7 @@ efreet_cache_init(void)
NULL);
if (!cache_monitor) goto error;
#ifdef ICON_CACHE
efreet_cache_icon_update();
#endif
efreet_cache_desktop_update();
}
@ -149,7 +135,6 @@ efreet_cache_shutdown(void)
{
Efreet_Old_Cache *d;
#ifdef ICON_CACHE
theme_cache = _efreet_cache_free(theme_cache);
fallback_cache = _efreet_cache_fallback_free(fallback_cache);
@ -157,7 +142,6 @@ efreet_cache_shutdown(void)
icon_cache = efreet_cache_close(icon_cache);
icon_theme_cache = efreet_cache_close(icon_theme_cache);
#endif
desktop_cache = efreet_cache_close(desktop_cache);
IF_RELEASE(desktop_cache_file);
@ -174,14 +158,12 @@ efreet_cache_shutdown(void)
ecore_job_del(desktop_cache_job);
desktop_cache_job = NULL;
}
#ifdef ICON_CACHE
IF_RELEASE(icon_theme_cache_file);
if (icon_cache_exe_lock > 0)
{
close(icon_cache_exe_lock);
icon_cache_exe_lock = -1;
}
#endif
if (desktop_cache_exe_lock > 0)
{
@ -198,7 +180,6 @@ efreet_cache_shutdown(void)
eina_log_domain_unregister(_efreet_cache_log_dom);
}
#ifdef ICON_CACHE
/*
* Needs EAPI because of helper binaries
*/
@ -231,7 +212,6 @@ efreet_icon_theme_cache_file(void)
return icon_theme_cache_file;
}
#endif
/*
* Needs EAPI because of helper binaries
@ -373,7 +353,6 @@ efreet_cache_edd_shutdown(void)
EDD_SHUTDOWN(hash_array_string_edd);
EDD_SHUTDOWN(array_string_edd);
EDD_SHUTDOWN(hash_string_edd);
#ifdef ICON_CACHE
EDD_SHUTDOWN(fallback_edd);
EDD_SHUTDOWN(icon_theme_edd);
EDD_SHUTDOWN(icon_theme_directory_edd);
@ -383,11 +362,8 @@ efreet_cache_edd_shutdown(void)
EDD_SHUTDOWN(icon_element_pointer_edd);
EDD_SHUTDOWN(icon_element_edd);
EDD_SHUTDOWN(icon_edd);
#endif
}
#ifdef ICON_CACHE
#define EFREET_POINTER_TYPE(Edd_Dest, Edd_Source, Type) \
{ \
typedef struct _Efreet_##Type##_Pointer Efreet_##Type##_Pointer; \
@ -580,7 +556,6 @@ efreet_icons_fallback_edd(Eina_Bool include_dirs)
return fallback_edd;
}
#endif
/*
* Needs EAPI because of helper binaries
@ -622,7 +597,6 @@ efreet_desktop_edd(void)
return desktop_edd;
}
#ifdef ICON_CACHE
/*
* Needs EAPI because of helper binaries
*/
@ -740,8 +714,6 @@ efreet_cache_icon_theme_name_list(int *num)
return keys;
}
#endif
EAPI void
efreet_cache_array_string_free(Efreet_Cache_Array_String *array)
{
@ -776,7 +748,6 @@ efreet_cache_desktop_update(void)
desktop_cache_job = ecore_job_add(desktop_cache_update_cache_job, NULL);
}
#ifdef ICON_CACHE
void
efreet_cache_icon_update(void)
{
@ -786,7 +757,6 @@ efreet_cache_icon_update(void)
if (icon_cache_job) ecore_job_del(icon_cache_job);
icon_cache_job = ecore_job_add(icon_cache_update_cache_job, NULL);
}
#endif
void
efreet_cache_desktop_free(Efreet_Desktop *desktop)
@ -863,7 +833,6 @@ cache_exe_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
}
desktop_cache_exe = NULL;
}
#ifdef ICON_CACHE
else if (ev->exe == icon_cache_exe)
{
if (icon_cache_exe_lock > 0)
@ -873,7 +842,6 @@ cache_exe_cb(void *data __UNUSED__, int type __UNUSED__, void *event)
}
icon_cache_exe = NULL;
}
#endif
return ECORE_CALLBACK_RENEW;
}
@ -907,7 +875,6 @@ cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
efreet_util_desktop_cache_reload();
ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, desktop_cache_update_free, d);
}
#ifdef ICON_CACHE
else if (!strcmp(file, "icon_data.update"))
{
ev = NEW(Efreet_Event_Cache_Update, 1);
@ -939,7 +906,6 @@ cache_update_cb(void *data __UNUSED__, Ecore_File_Monitor *em __UNUSED__,
ecore_event_add(EFREET_EVENT_ICON_CACHE_UPDATE, ev, icon_cache_update_free, d);
}
#endif
return;
error:
IF_FREE(ev);
@ -984,7 +950,6 @@ error:
}
}
#ifdef ICON_CACHE
static void
icon_cache_update_cache_job(void *data __UNUSED__)
{
@ -1020,7 +985,6 @@ error:
icon_cache_exe_lock = -1;
}
}
#endif
static void
desktop_cache_update_free(void *data, void *ev)
@ -1071,7 +1035,6 @@ desktop_cache_update_free(void *data, void *ev)
free(ev);
}
#ifdef ICON_CACHE
static void
icon_cache_update_free(void *data, void *ev)
{
@ -1084,4 +1047,3 @@ icon_cache_update_free(void *data, void *ev)
free(d);
free(ev);
}
#endif

View File

@ -2,9 +2,7 @@
#define EFREET_CACHE_PRIVATE_H
#define EFREET_CACHE_VERSION "efreet//version"
#ifdef ICON_CACHE
#define EFREET_CACHE_ICON_FALLBACK "efreet//fallback"
#endif
Eina_Bool efreet_cache_check(Eet_File **ef, const char *path, int major);
void *efreet_cache_close(Eet_File *ef);
@ -14,10 +12,8 @@ EAPI Eet_Data_Descriptor *efreet_desktop_edd(void);
EAPI Eet_Data_Descriptor *efreet_hash_array_string_edd(void);
EAPI Eet_Data_Descriptor *efreet_hash_string_edd(void);
EAPI Eet_Data_Descriptor *efreet_array_string_edd(void);
#ifdef ICON_CACHE
EAPI Eet_Data_Descriptor *efreet_icon_theme_edd(void);
EAPI Eet_Data_Descriptor *efreet_icons_edd(Eina_Bool include_dirs);
EAPI Eet_Data_Descriptor *efreet_icons_fallback_edd(Eina_Bool include_dirs);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -114,16 +114,13 @@ extern int _efreet_log_dom_global;
#define WRN(...) EINA_LOG_DOM_WARN(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
extern Eina_Hash *efreet_desktop_cache;
#ifdef ICON_CACHE
extern Eina_Hash *efreet_icon_themes;
#endif
#define EFREET_DESKTOP_CACHE_MAJOR 1
#define EFREET_DESKTOP_CACHE_MINOR 0
#define EFREET_DESKTOP_UTILS_CACHE_MAJOR 1
#define EFREET_DESKTOP_UTILS_CACHE_MINOR 0
#ifdef ICON_CACHE
#define EFREET_ICON_CACHE_MAJOR 0
#define EFREET_ICON_CACHE_MINOR 4
@ -177,7 +174,6 @@ struct _Efreet_Cache_Fallback_Icon
const char **icons;
unsigned int icons_count;
};
#endif
typedef struct _Efreet_Cache_Version Efreet_Cache_Version;
struct _Efreet_Cache_Version
@ -240,13 +236,10 @@ EAPI const char *efreet_desktop_cache_dirs(void);
int efreet_desktop_write_cache_dirs_file(void);
void efreet_cache_desktop_update(void);
#ifdef ICON_CACHE
void efreet_cache_icon_update(void);
#endif
void efreet_cache_desktop_free(Efreet_Desktop *desktop);
Efreet_Desktop *efreet_cache_desktop_find(const char *file);
#ifdef ICON_CACHE
EAPI const char *efreet_icon_cache_file(void);
EAPI const char *efreet_icon_theme_cache_file(void);
@ -257,7 +250,6 @@ Efreet_Cache_Fallback_Icon *efreet_cache_icon_fallback_find(const char *icon);
Efreet_Icon_Theme *efreet_cache_icon_theme_find(const char *theme);
void efreet_cache_icon_theme_free(Efreet_Icon_Theme *theme);
char **efreet_cache_icon_theme_name_list(int *num);
#endif
EAPI void efreet_cache_array_string_free(Efreet_Cache_Array_String *array);
EAPI void efreet_hash_free(Eina_Hash *hash, Eina_Free_Cb free_cb);

View File

@ -11,11 +11,11 @@ AM_CPPFLAGS = \
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
@EFREET_CFLAGS@
bin_PROGRAMS = efreet_test efreet_spec_test efreet_cache_test
if ICON_CACHE
bin_PROGRAMS += efreet_icon_cache_dump
endif
bin_PROGRAMS = \
efreet_test \
efreet_spec_test \
efreet_cache_test \
efreet_icon_cache_dump
efreet_test_LDADD = $(top_builddir)/src/lib/libefreet.la \
$(top_builddir)/src/lib/libefreet_mime.la \
@ -57,13 +57,9 @@ efreet_suite_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libefreet.la
endif
if ICON_CACHE
efreet_icon_cache_dump_LDADD = \
$(top_builddir)/src/lib/libefreet.la \
@EFREET_LIBS@
efreet_icon_cache_dump_SOURCES = \
efreet_icon_cache_dump.c
endif