Fetch theme on first call to _icon_freedesktop_set

SVN revision: 55009
This commit is contained in:
Sebastian Dransfeld 2010-11-26 11:37:45 +00:00
parent 08c6d71a87
commit cd773d178b
3 changed files with 27 additions and 19 deletions

View File

@ -1,6 +1,11 @@
#include <Elementary.h>
#include "elm_priv.h"
#ifdef ELM_EFREET
#define NON_EXISTING (void *)-1
static Efreet_Icon_Theme *icon_theme = NULL;
#endif
/**
* @defgroup Icon Icon
*
@ -293,7 +298,28 @@ _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int s
const char *path;
elm_need_efreet();
if (!icon_theme) return EINA_FALSE;
if (icon_theme == NON_EXISTING) return EINA_FALSE;
if (!icon_theme)
{
icon_theme = efreet_icon_theme_find(getenv("E_ICON_THEME"));
if (!icon_theme)
{
const char **itr;
static const char *themes[] = {
"gnome", "Human", "oxygen", "hicolor", NULL
};
for (itr = themes; *itr; itr++)
{
icon_theme = efreet_icon_theme_find(*itr);
if (icon_theme) break;
}
}
}
if (!icon_theme)
{
icon_theme = NON_EXISTING;
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,7 +390,6 @@ _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)
@ -400,19 +399,6 @@ 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[] = {
"gnome", "Human", "oxygen", "hicolor", NULL
};
for (itr = themes; *itr; itr++)
{
icon_theme = efreet_icon_theme_find(*itr);
if (icon_theme) break;
}
}
/*
{
Eina_List **list;
@ -439,7 +425,6 @@ _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,8 +196,5 @@ 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