Make a new function:

e_util_icon_theme_set(Evas_Object *obj, const char *icon)
to use in place of e_util_edje_icon_set.
The new function (as it works for menu) search the icon in E theme and FDO themes
according to the config option.

SVN revision: 39371
This commit is contained in:
Davide Andreoli 2009-03-04 22:29:23 +00:00
parent 3d669d1177
commit f64a04ec46
5 changed files with 61 additions and 5 deletions

View File

@ -22701,7 +22701,7 @@ ICON("enlightenment/background","icon_wallpaper.png",64)
ICON("enlightenment/picture","icon_wallpaper.png",64)
ICON("enlightenment/gradient","icon_gradient.png",64)
ICON("enlightenment/e","logo_white_128.png",64)
ICON("enlightenment/about","logo_black_128.png",64)
//ICON("enlightenment/about","logo_black_128.png",64)
ICON("enlightenment/reset","icon_reset.png",128)
ICON("enlightenment/exit","icon_logout.png",64)
ICON("enlightenment/logout","icon_logout.png",128)

View File

@ -98,5 +98,5 @@ EAPI void
e_about_show(E_About *about)
{
e_obj_dialog_show((E_Obj_Dialog *)about);
e_obj_dialog_icon_set((E_Obj_Dialog *)about, "enlightenment/about");
e_obj_dialog_icon_set((E_Obj_Dialog *)about, "help-about");
}

View File

@ -3120,10 +3120,12 @@ e_border_icon_add(E_Border *bd, Evas *evas)
o = e_icon_add(evas);
e_icon_file_set(o, bd->internal_icon);
}
else
else
{
if (!e_util_edje_icon_set(o, bd->internal_icon))
e_util_edje_icon_set(o, "enlightenment/e");
evas_object_del(o);
o = e_icon_add(evas);
if (!e_util_icon_theme_set(o, bd->internal_icon))
e_util_icon_theme_set(o, "enlightenment/e");
}
}
else

View File

@ -363,6 +363,10 @@ e_util_edje_icon_check(const char *name)
return 0;
}
/* WARNING This function is deprecated,. must be made static.
* You should use e_util_theme_icon_set instead
*/
EAPI int
e_util_edje_icon_set(Evas_Object *obj, const char *name)
{
@ -380,6 +384,55 @@ e_util_edje_icon_set(Evas_Object *obj, const char *name)
return 0;
}
static int
_e_util_icon_theme_set(Evas_Object *obj, const char *icon)
{
const char *file;
char buf[4096];
if ((!icon) || (!icon[0])) return 0;
snprintf(buf, sizeof(buf), "e/icons/%s", icon);
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;
}
static int
_e_util_icon_fdo_set(Evas_Object *obj, const char *icon)
{
char *path = NULL;
unsigned int size;
if ((!icon) || (!icon[0])) return 0;
size = e_util_icon_size_normalize(16 * e_scale);
path = efreet_icon_path_find(e_config->icon_theme, icon, 48);
if (!path) return 0;
e_icon_file_set(obj, path);
E_FREE(path);
return 1;
}
EAPI int
e_util_icon_theme_set(Evas_Object *obj, const char *icon)
{
if (e_config->icon_theme_overrides)
{
if (_e_util_icon_fdo_set(obj, icon))
return 1;
return _e_util_icon_theme_set(obj, icon);
}
else
{
if (_e_util_icon_theme_set(obj, icon))
return 1;
return _e_util_icon_fdo_set(obj, icon);
}
}
/* 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 */

View File

@ -32,6 +32,7 @@ EAPI int e_util_edje_icon_list_set(Evas_Object *obj, const char *list);
EAPI int e_util_menu_item_edje_icon_list_set(E_Menu_Item *mi, const char *list);
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);