From 069d2f5c1135bea5bb1ee7d4349a8442aedc609a Mon Sep 17 00:00:00 2001 From: discomfitor Date: Mon, 7 Nov 2011 04:25:16 +0000 Subject: [PATCH] add new function to disable icon preloading git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@64850 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 8 ++++++++ src/lib/elm_icon.c | 10 ++++++++++ src/lib/els_icon.c | 11 +++++++++++ src/lib/els_icon.h | 2 +- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index 13869c3..5ad2a4d 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -4989,6 +4989,14 @@ extern "C" { */ EAPI Elm_Icon_Lookup_Order elm_icon_order_lookup_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); /** + * Enable or disable preloading of the icon + * + * @param obj The icon object + * @param disable If EINA_TRUE, preloading will be disabled + * @ingroup Icon + */ + EAPI void elm_icon_preload_set(Evas_Object *obj, Eina_Bool disable) EINA_ARG_NONNULL(1); + /** * Get if the icon supports animation or not. * * @param obj The icon object diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c index c65d085..72abbb8 100644 --- a/src/lib/elm_icon.c +++ b/src/lib/elm_icon.c @@ -987,3 +987,13 @@ elm_icon_object_get(Evas_Object *obj) if (!wd) return NULL; return wd->img; } + +EAPI void +elm_icon_preload_set(Evas_Object *obj, Eina_Bool disable) +{ + ELM_CHECK_WIDTYPE(obj, widtype); + Widget_Data *wd = elm_widget_data_get(obj); + + if (!wd) return; + _els_smart_icon_preload_set(wd->img, disable); +} diff --git a/src/lib/els_icon.c b/src/lib/els_icon.c index 0d3dd0b..2c9d5f3 100755 --- a/src/lib/els_icon.c +++ b/src/lib/els_icon.c @@ -116,6 +116,17 @@ _els_smart_icon_file_key_set(Evas_Object *obj, const char *file, const char *key return EINA_TRUE; } +void +_els_smart_icon_preload_set(Evas_Object *obj, Eina_Bool disable) +{ + Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if ((!sd) || sd->edje) return; + evas_object_image_preload(sd->obj, disable); + sd->preloading = !disable; +} + Eina_Bool _els_smart_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part) { diff --git a/src/lib/els_icon.h b/src/lib/els_icon.h index bd49bb2..dccbccd 100644 --- a/src/lib/els_icon.h +++ b/src/lib/els_icon.h @@ -23,4 +23,4 @@ Eina_Bool _els_smart_icon_edit_get (const Evas_Object *obj); Evas_Object *_els_smart_icon_edje_get(Evas_Object *obj); void _els_smart_icon_aspect_ratio_retained_set(Evas_Object *obj, Eina_Bool retained); Eina_Bool _els_smart_icon_aspect_ratio_retained_get(const Evas_Object *obj); - +void _els_smart_icon_preload_set(Evas_Object *obj, Eina_Bool disable); -- 2.7.4