forked from enlightenment/enlightenment
- remove deprecated e_util_menu_item_edje_icon_set
- change default icon lookup order from user theme > default theme > fdo theme to user theme > fdo theme > default theme SVN revision: 57105
This commit is contained in:
parent
ec46398a71
commit
c4401dec20
|
@ -165,8 +165,8 @@ e_theme_edje_object_set(Evas_Object *o, const char *category, const char *group)
|
|||
return e_theme_edje_object_set(o, buf, group);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_theme_edje_file_get(const char *category, const char *group)
|
||||
const char *
|
||||
_e_theme_edje_file_get(const char *category, const char *group, Eina_Bool fallback_icon)
|
||||
{
|
||||
E_Theme_Result *res;
|
||||
char buf[4096];
|
||||
|
@ -176,6 +176,13 @@ e_theme_edje_file_get(const char *category, const char *group)
|
|||
/* find category -> edje mapping */
|
||||
_e_theme_category_register(category);
|
||||
res = eina_hash_find(mappings, category);
|
||||
|
||||
if (e_config->icon_theme &&
|
||||
(!fallback_icon) &&
|
||||
(!strcmp(category, "base")) &&
|
||||
(!strncmp(group, "e/icons", 7)))
|
||||
return "";
|
||||
|
||||
if (res)
|
||||
{
|
||||
const char *str;
|
||||
|
@ -208,8 +215,9 @@ e_theme_edje_file_get(const char *category, const char *group)
|
|||
const char *col;
|
||||
|
||||
res->quickfind = eina_hash_string_superfast_new(NULL);
|
||||
/* great a quick find hash of all group entires */
|
||||
/* create a quick find hash of all group entries */
|
||||
coll = edje_file_collection_list(str);
|
||||
|
||||
EINA_LIST_FOREACH(coll, l, col)
|
||||
{
|
||||
q = eina_stringshare_add(col);
|
||||
|
@ -247,6 +255,18 @@ e_theme_edje_file_get(const char *category, const char *group)
|
|||
return e_theme_edje_file_get(buf, group);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_theme_edje_file_get(const char *category, const char *group)
|
||||
{
|
||||
return _e_theme_edje_file_get(category, group, EINA_FALSE);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_theme_edje_icon_fallback_file_get(const char *group)
|
||||
{
|
||||
return _e_theme_edje_file_get("base", group, EINA_TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
* this is used to set the theme for a CATEGORY of E17. "base" is always set
|
||||
* to the default theme - because if a selected theme wants "base/theme", but
|
||||
|
|
|
@ -8,6 +8,7 @@ EINTERN int e_theme_shutdown(void);
|
|||
|
||||
EAPI int e_theme_edje_object_set(Evas_Object *o, const char *category, const char *group);
|
||||
EAPI const char *e_theme_edje_file_get(const char *category, const char *group);
|
||||
EAPI const char *e_theme_edje_icon_fallback_file_get(const char *group);
|
||||
EAPI void e_theme_file_set(const char *category, const char *file);
|
||||
|
||||
EAPI int e_theme_config_set(const char *category, const char *file);
|
||||
|
|
|
@ -418,19 +418,25 @@ e_util_edje_icon_set(Evas_Object *obj, const char *name)
|
|||
}
|
||||
|
||||
static int
|
||||
_e_util_icon_theme_set(Evas_Object *obj, const char *icon)
|
||||
_e_util_icon_theme_set(Evas_Object *obj, const char *icon, Eina_Bool fallback)
|
||||
{
|
||||
const char *file;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if ((!icon) || (!icon[0])) return 0;
|
||||
snprintf(buf, sizeof(buf), "e/icons/%s", icon);
|
||||
|
||||
if (fallback)
|
||||
file = e_theme_edje_icon_fallback_file_get(buf);
|
||||
else
|
||||
file = e_theme_edje_file_get("base/theme/icons", buf);
|
||||
|
||||
if (file[0])
|
||||
{
|
||||
e_icon_file_edje_set(obj, file, buf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -455,33 +461,40 @@ e_util_icon_theme_set(Evas_Object *obj, const char *icon)
|
|||
{
|
||||
if (_e_util_icon_fdo_set(obj, icon))
|
||||
return 1;
|
||||
return _e_util_icon_theme_set(obj, icon);
|
||||
if (_e_util_icon_theme_set(obj, icon, EINA_FALSE))
|
||||
return 1;
|
||||
return _e_util_icon_theme_set(obj, icon, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_e_util_icon_theme_set(obj, icon))
|
||||
if (_e_util_icon_theme_set(obj, icon, EINA_FALSE))
|
||||
return 1;
|
||||
return _e_util_icon_fdo_set(obj, icon);
|
||||
if (_e_util_icon_fdo_set(obj, icon))
|
||||
return 1;
|
||||
return _e_util_icon_theme_set(obj, icon, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* WARNING This function is deprecated, You should
|
||||
* use e_util_menu_item_theme_icon_set() instead.
|
||||
* It provide fallback (e theme <-> fdo theme) in both direction */
|
||||
EAPI int
|
||||
e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name)
|
||||
int
|
||||
_e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name, Eina_Bool fallback)
|
||||
{
|
||||
const char *file;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
if ((!name) || (!name[0])) return 0;
|
||||
if (name[0]=='/' && ecore_file_exists(name))
|
||||
|
||||
if ((!fallback) && (name[0]=='/') && ecore_file_exists(name))
|
||||
{
|
||||
e_menu_item_icon_edje_set(mi, name, "icon");
|
||||
return 1;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "e/icons/%s", name);
|
||||
|
||||
if (fallback)
|
||||
file = e_theme_edje_icon_fallback_file_get(buf);
|
||||
else
|
||||
file = e_theme_edje_file_get("base/theme/icons", buf);
|
||||
|
||||
if (file[0])
|
||||
{
|
||||
e_menu_item_icon_edje_set(mi, file, buf);
|
||||
|
@ -526,13 +539,17 @@ e_util_menu_item_theme_icon_set(E_Menu_Item *mi, const char *icon)
|
|||
{
|
||||
if (_e_util_menu_item_fdo_icon_set(mi, icon))
|
||||
return 1;
|
||||
return e_util_menu_item_edje_icon_set(mi, icon);
|
||||
if (_e_util_menu_item_edje_icon_set(mi, icon, EINA_FALSE))
|
||||
return 1;
|
||||
return _e_util_menu_item_edje_icon_set(mi, icon, EINA_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e_util_menu_item_edje_icon_set(mi, icon))
|
||||
if (_e_util_menu_item_edje_icon_set(mi, icon, EINA_FALSE))
|
||||
return 1;
|
||||
return _e_util_menu_item_fdo_icon_set(mi, icon);
|
||||
if (_e_util_menu_item_fdo_icon_set(mi, icon))
|
||||
return 1;
|
||||
return _e_util_menu_item_edje_icon_set(mi, icon, EINA_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ EAPI int e_util_menu_item_edje_icon_list_set(E_Menu_Item *mi, const cha
|
|||
EAPI int e_util_edje_icon_check(const char *name);
|
||||
EAPI int e_util_edje_icon_set(Evas_Object *obj, const char *name);
|
||||
EAPI int e_util_icon_theme_set(Evas_Object *obj, const char *icon);
|
||||
EAPI int e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name);
|
||||
EAPI unsigned int e_util_icon_size_normalize(unsigned int desired);
|
||||
EAPI int e_util_menu_item_theme_icon_set(E_Menu_Item *mi, const char *icon);
|
||||
EAPI E_Container *e_util_container_window_find(Ecore_X_Window win);
|
||||
|
|
Loading…
Reference in New Issue