From af3f1b070f1ef4480694fe4ab954b83fdae43f09 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 23 Aug 2019 14:48:14 -0700 Subject: [PATCH] elementary: Efl.Ui.Image_Factory bind property also during widget creation. In the same vain as previous patch this will initialize more of the widget during its creation and reduce unecessary recalc. Reviewed-by: Marcel Hollerbach Reviewed-by: SangHyeon Jade Lee Differential Revision: https://phab.enlightenment.org/D9950 --- src/lib/elementary/efl_ui_image_factory.c | 22 +++++----------------- src/lib/elementary/efl_ui_image_factory.eo | 1 + 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/lib/elementary/efl_ui_image_factory.c b/src/lib/elementary/efl_ui_image_factory.c index 4d0c139e8b..0010570baa 100644 --- a/src/lib/elementary/efl_ui_image_factory.c +++ b/src/lib/elementary/efl_ui_image_factory.c @@ -35,34 +35,22 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa efl_destructor(efl_super(obj, MY_CLASS)); } -static Eina_Value -_efl_ui_image_factory_bind(Eo *obj EINA_UNUSED, void *data, const Eina_Value value) +EOLIAN static void +_efl_ui_image_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd, Efl_Gfx_Entity *ui_view) { - Efl_Ui_Image_Factory_Data *pd = data; - Efl_Gfx_Entity *entity; - int len, i; + efl_ui_property_bind(ui_view, "filename", pd->property); - EINA_VALUE_ARRAY_FOREACH(&value, len, i, entity) - efl_ui_property_bind(entity, "filename", pd->property); - - return value; + efl_ui_factory_building(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), ui_view); } EOLIAN static Eina_Future * _efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Eina_Iterator *models, Efl_Gfx_Entity *parent) { - Eina_Future *f; - if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED); - f = efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); - - return efl_future_then(obj, f, - .success_type = EINA_VALUE_TYPE_ARRAY, - .success = _efl_ui_image_factory_bind, - .data = pd); + return efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), models, parent); } EOLIAN static Eina_Error diff --git a/src/lib/elementary/efl_ui_image_factory.eo b/src/lib/elementary/efl_ui_image_factory.eo index 5ebcc1cd32..57acc7ea12 100644 --- a/src/lib/elementary/efl_ui_image_factory.eo +++ b/src/lib/elementary/efl_ui_image_factory.eo @@ -5,6 +5,7 @@ class @beta Efl.Ui.Image_Factory extends Efl.Ui.Caching_Factory Efl.Object.constructor; Efl.Object.destructor; Efl.Ui.Factory.create; + Efl.Ui.Factory.building; Efl.Ui.Property_Bind.property_bind; } }