ummmm revert. crash crash crash.

SVN revision: 50789
This commit is contained in:
Carsten Haitzler 2010-08-03 21:32:45 +00:00
parent eba0c34bf9
commit 1837b63b38
1 changed files with 49 additions and 42 deletions

View File

@ -94,6 +94,8 @@ static void efreet_icon_cache_free(Efreet_Icon_Cache *value);
static char *efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int size);
static void efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int size, const char *value);
static Efreet_Icon_Theme *fake_null = NULL;
static void
_efreet_icon_cache_list_destroy(Eina_List *list)
{
@ -151,6 +153,12 @@ efreet_icon_shutdown(void)
IF_FREE_HASH(efreet_icon_cache);
if (fake_null)
{
efreet_icon_theme_free(fake_null);
fake_null = NULL;
}
ecore_shutdown();
}
@ -283,7 +291,7 @@ efreet_icon_theme_find(const char *theme_name)
{
Efreet_Icon_Theme *theme;
if (!theme_name) return NULL;
if (!theme_name) return fake_null;
theme = eina_hash_find(efreet_icon_themes, theme_name);
if (!theme)
@ -342,15 +350,23 @@ static Efreet_Icon_Theme *
efreet_icon_find_theme_check(const char *theme_name)
{
Efreet_Icon_Theme *theme = NULL;
if (!theme_name) return NULL;
theme = efreet_icon_theme_find(theme_name);
if (theme_name) theme = efreet_icon_theme_find(theme_name);
if (!theme)
{
if ((fake_null) && (!theme_name)) return fake_null;
theme = efreet_icon_theme_new();
if (!theme) return NULL;
theme->fake = 1;
theme->name.internal = eina_stringshare_add(theme_name);
eina_hash_add(efreet_icon_themes, (void *)theme->name.internal, theme);
if (theme_name)
{
theme->name.internal = eina_stringshare_add(theme_name);
eina_hash_add(efreet_icon_themes, (void *)theme->name.internal, theme);
}
else
{
theme->name.internal = NULL;
fake_null = theme;
}
}
return theme;
@ -371,21 +387,18 @@ efreet_icon_path_find(const char *theme_name, const char *icon, unsigned int siz
theme = efreet_icon_find_theme_check(theme_name);
if (theme)
{
#ifdef SLOPPY_SPEC
{
char *tmp;
{
char *tmp;
tmp = efreet_icon_remove_extension(icon);
if (!tmp) return NULL;
value = efreet_icon_find_helper(theme, tmp, size);
FREE(tmp);
}
#else
value = efreet_icon_find_helper(theme, icon, size);
#endif
tmp = efreet_icon_remove_extension(icon);
if (!tmp) return NULL;
value = efreet_icon_find_helper(theme, tmp, size);
FREE(tmp);
}
#else
value = efreet_icon_find_helper(theme, icon, size);
#endif
/* we didn't find the icon in the theme or in the inherited directories
* then just look for a non theme icon
@ -419,27 +432,24 @@ efreet_icon_list_find(const char *theme_name, Eina_List *icons,
theme = efreet_icon_find_theme_check(theme_name);
if (theme)
{
#ifdef SLOPPY_SPEC
{
Eina_List *tmps = NULL;
EINA_LIST_FOREACH(icons, l, icon)
{
Eina_List *tmps = NULL;
EINA_LIST_FOREACH(icons, l, icon)
{
data = efreet_icon_remove_extension(icon);
if (!data) return NULL;
tmps = eina_list_append(tmps, data);
}
value = efreet_icon_list_find_helper(theme, tmps, size);
EINA_LIST_FREE(tmps, data)
free(data);
data = efreet_icon_remove_extension(icon);
if (!data) return NULL;
tmps = eina_list_append(tmps, data);
}
#else
value = efreet_icon_list_find_helper(theme, icons, size);
#endif
value = efreet_icon_list_find_helper(theme, tmps, size);
EINA_LIST_FREE(tmps, data)
free(data);
}
#else
value = efreet_icon_list_find_helper(theme, icons, size);
#endif
/* we didn't find the icons in the theme or in the inherited directories
* then just look for a non theme icon
@ -812,7 +822,7 @@ efreet_icon_fallback_icon(const char *icon_name)
char *icon;
if (!icon_name) return NULL;
icon = efreet_icon_cache_check(NULL, icon_name, 0);
icon = efreet_icon_cache_check(efreet_icon_find_theme_check(NULL), icon_name, 0);
if (icon) return icon;
icon = efreet_icon_fallback_dir_scan(efreet_icon_deprecated_user_dir_get(), icon_name);
@ -829,7 +839,7 @@ efreet_icon_fallback_icon(const char *icon_name)
icon = efreet_icon_fallback_dir_scan(dir, icon_name);
if (icon)
{
efreet_icon_cache_add(NULL, icon_name, 0, icon);
efreet_icon_cache_add(efreet_icon_find_theme_check(NULL), icon_name, 0, icon);
return icon;
}
}
@ -842,7 +852,7 @@ efreet_icon_fallback_icon(const char *icon_name)
icon = efreet_icon_fallback_dir_scan(path, icon_name);
if (icon)
{
efreet_icon_cache_add(NULL, icon_name, 0, icon);
efreet_icon_cache_add(efreet_icon_find_theme_check(NULL), icon_name, 0, icon);
return icon;
}
}
@ -853,7 +863,7 @@ efreet_icon_fallback_icon(const char *icon_name)
icon = efreet_icon_fallback_dir_scan(path, icon_name);
if (icon)
{
efreet_icon_cache_add(NULL, icon_name, 0, icon);
efreet_icon_cache_add(efreet_icon_find_theme_check(NULL), icon_name, 0, icon);
return icon;
}
}
@ -861,7 +871,7 @@ efreet_icon_fallback_icon(const char *icon_name)
icon = efreet_icon_fallback_dir_scan("/usr/share/pixmaps", icon_name);
}
efreet_icon_cache_add(NULL, icon_name, 0, icon);
efreet_icon_cache_add(efreet_icon_find_theme_check(NULL), icon_name, 0, icon);
return icon;
}
@ -1607,8 +1617,6 @@ efreet_icon_cache_check(Efreet_Icon_Theme *theme, const char *icon, unsigned int
char key[4096];
struct stat st;
if (!theme) theme = NON_EXISTING;
list = eina_hash_find(efreet_icon_cache, theme);
if (!list) return NULL;
@ -1656,7 +1664,6 @@ efreet_icon_cache_add(Efreet_Icon_Theme *theme, const char *icon, unsigned int s
else
cache->lasttime = ecore_time_get();
if (!theme) theme = NON_EXISTING;
list = eina_hash_find(efreet_icon_cache, theme);
list = eina_list_prepend(list, cache);