From 3f5d1dfb598ef257096caeb62e3e255e3d13006a Mon Sep 17 00:00:00 2001 From: cedric Date: Thu, 22 Sep 2011 13:51:22 +0000 Subject: [PATCH] elementary: fix trying to use the best available icon size. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63537 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_icon.c | 21 +++++++++++++++++---- src/lib/els_icon.c | 3 +++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c index a19f3c9..d49719b 100644 --- a/src/lib/elm_icon.c +++ b/src/lib/elm_icon.c @@ -397,14 +397,16 @@ _sizing_eval(Evas_Object *obj) _els_smart_icon_size_get(wd->img, &w, &h); #ifdef ELM_EFREET - if ((wd->freedesktop.use) && (!((w - wd->freedesktop.requested_size) % 16))) + if (wd->freedesktop.use && wd->stdicon) { + int size; /* This icon has been set to a freedesktop icon, and the requested appears to have a different size than the requested size, so try to request another, higher resolution, icon. FIXME: Find a better heuristic to determine if there should be an icon with a different resolution. */ - _icon_freedesktop_set(wd, obj, wd->stdicon, w); + size = ((w / 16) + 1) * 16; + _icon_freedesktop_set(wd, obj, wd->stdicon, size); } #endif _els_smart_icon_scale_up_set(wd->img, wd->scale_up); @@ -683,11 +685,22 @@ elm_icon_file_set(Evas_Object *obj, const char *file, const char *group) ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE; Widget_Data *wd = elm_widget_data_get(obj); Eina_Bool ret; + const char *tmp_file; + const char *tmp_group; if (!wd) return EINA_FALSE; EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); - if (wd->stdicon) eina_stringshare_del(wd->stdicon); - wd->stdicon = NULL; + + _els_smart_icon_file_get(wd->img, &tmp_file, &tmp_group); + if ((tmp_file == file || (file && tmp_file && !strcmp(tmp_file, file))) + && (group == tmp_group || (group && tmp_group && !strcmp(group, tmp_group)))) + return EINA_TRUE; + + if (!wd->freedesktop.use) + { + if (wd->stdicon) eina_stringshare_del(wd->stdicon); + wd->stdicon = NULL; + } if (eina_str_has_extension(file, ".edj")) ret = _els_smart_icon_file_edje_set(wd->img, file, group); else diff --git a/src/lib/els_icon.c b/src/lib/els_icon.c index 6119a37..ea55fb1 100644 --- a/src/lib/els_icon.c +++ b/src/lib/els_icon.c @@ -117,6 +117,7 @@ Eina_Bool _els_smart_icon_file_key_set(Evas_Object *obj, const char *file, const char *key) { Smart_Data *sd; + Evas_Coord w, h; sd = evas_object_smart_data_get(obj); if (!sd) return EINA_FALSE; @@ -126,6 +127,8 @@ _els_smart_icon_file_key_set(Evas_Object *obj, const char *file, const char *key sd->preloading = EINA_TRUE; sd->show = EINA_TRUE; evas_object_hide(sd->obj); + _els_smart_icon_size_get(obj, &w, &h); + evas_object_image_load_size_set(sd->obj, w, h); evas_object_image_preload(sd->obj, EINA_FALSE); if (evas_object_image_load_error_get(sd->obj) != EVAS_LOAD_ERROR_NONE) { -- 2.7.4