Search for icon theme in elm_need_efreet

When searching for an icon in a theme, efreet needs to load the specific
cache for the theme. So if an icon doesn't exist, this will be a huge
overhead. So it is better to find a theme on init, and then stick with
it.

SVN revision: 55004
This commit is contained in:
Sebastian Dransfeld 2010-11-26 09:05:12 +00:00
parent cffdcb4efa
commit 6a42df9f9a
3 changed files with 21 additions and 14 deletions

View File

@ -292,19 +292,8 @@ _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int s
const char *path;
elm_need_efreet();
path = efreet_icon_path_find(getenv("E_ICON_THEME"), name, size);
if (!path)
{
const char **itr;
static const char *themes[] = {
"default", "highcolor", "hicolor", "gnome", "Human", "oxygen", NULL
};
for (itr = themes; (!path) && (*itr); itr++)
{
path = efreet_icon_path_find(*itr, name, size);
if (path) break;
}
}
if (!icon_theme) return EINA_FALSE;
path = efreet_icon_path_find(icon_theme->name.internal, name, size);
wd->freedesktop.use = !!path;
if (wd->freedesktop.use)
{

View File

@ -390,6 +390,7 @@ _elm_unneed_e_dbus(void)
#ifdef ELM_EFREET
static int _elm_need_efreet = 0;
Efreet_Icon_Theme *icon_theme = NULL;
#endif
EAPI Eina_Bool
elm_need_efreet(void)
@ -399,7 +400,20 @@ elm_need_efreet(void)
efreet_init();
efreet_mime_init();
efreet_trash_init();
/*
icon_theme = efreet_icon_theme_find(getenv("E_ICON_THEME"));
if (!icon_theme)
{
const char **itr;
static const char *themes[] = {
"default", "highcolor", "hicolor", "gnome", "Human", "oxygen", NULL
};
for (itr = themes; *itr; itr++)
{
icon_theme = efreet_icon_theme_find(*itr);
if (icon_theme) break;
}
}
/*
{
Eina_List **list;
@ -425,6 +439,7 @@ _elm_unneed_efreet(void)
#ifdef ELM_EFREET
if (--_elm_need_efreet) return;
icon_theme = NULL;
_elm_need_efreet = 0;
efreet_trash_shutdown();
efreet_mime_shutdown();

View File

@ -196,5 +196,8 @@ extern const char *_elm_data_dir;
extern const char *_elm_lib_dir;
extern int _elm_log_dom;
extern Eina_List *_elm_win_list;
#ifdef ELM_EFREET
extern Efreet_Icon_Theme *icon_theme;
#endif
#endif