[Elementary] Elm_Icon cleanups.

SVN revision: 53675
This commit is contained in:
Leandro Pereira 2010-10-20 15:35:45 +00:00
parent 35e9272f4d
commit ed008d269c
2 changed files with 14 additions and 9 deletions

View File

@ -490,7 +490,6 @@ extern "C" {
EAPI Evas_Object *elm_icon_add(Evas_Object *parent);
EAPI Eina_Bool elm_icon_file_set(Evas_Object *obj, const char *file, const char *group);
EAPI Eina_Bool elm_icon_standard_set(Evas_Object *obj, const char *name);
EAPI Eina_Bool elm_icon_freedesktop_set(Evas_Object *obj, const char *name, int size);
EAPI void elm_icon_smooth_set(Evas_Object *obj, Eina_Bool smooth);
EAPI void elm_icon_no_scale_set(Evas_Object *obj, Eina_Bool no_scale);
EAPI void elm_icon_scale_set(Evas_Object *obj, Eina_Bool scale_up, Eina_Bool scale_down);

View File

@ -218,7 +218,8 @@ _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int s
for (itr = themes; !path && *itr; itr++)
path = efreet_icon_path_find(*itr, name, size);
}
if ((wd->freedesktop.use = !!path))
wd->freedesktop.use = !!path;
if (wd->freedesktop.use)
{
wd->freedesktop.requested_size = size;
elm_icon_file_set(obj, path, NULL);
@ -229,6 +230,14 @@ _icon_freedesktop_set(Widget_Data *wd, Evas_Object *obj, const char *name, int s
return EINA_FALSE;
}
static inline int
_icon_size_min_get(Evas_Object *icon)
{
int size;
_els_smart_icon_size_get(icon, &size, NULL);
return (size < 32) ? 32 : size;
}
/**
* Set the theme, as standard, for a icon
*
@ -245,7 +254,7 @@ elm_icon_standard_set(Evas_Object *obj, const char *name)
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
Widget_Data *wd = elm_widget_data_get(obj);
char *tmp;
Eina_Bool ret = EINA_FALSE;
Eina_Bool ret;
if ((!wd) || (!name)) return EINA_FALSE;
@ -253,21 +262,18 @@ elm_icon_standard_set(Evas_Object *obj, const char *name)
switch (wd->lookup_order)
{
case ELM_ICON_LOOKUP_FDO:
ret = _icon_freedesktop_set(wd, obj, name, 48) ||
_icon_freedesktop_set(wd, obj, name, 32);
ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
break;
case ELM_ICON_LOOKUP_THEME:
ret = _icon_standard_set(wd, obj, name);
break;
case ELM_ICON_LOOKUP_THEME_FDO:
ret = _icon_standard_set(wd, obj, name) ||
_icon_freedesktop_set(wd, obj, name, 48) ||
_icon_freedesktop_set(wd, obj, name, 32);
_icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img));
break;
case ELM_ICON_LOOKUP_FDO_THEME:
default:
ret = _icon_freedesktop_set(wd, obj, name, 48) ||
_icon_freedesktop_set(wd, obj, name, 32) ||
ret = _icon_freedesktop_set(wd, obj, name, _icon_size_min_get(wd->img)) ||
_icon_standard_set(wd, obj, name);
break;
}