forked from enlightenment/efl
elementary: enable caching for Efl.Ui.ImageFactory.
Differential Revision: https://phab.enlightenment.org/D7444
This commit is contained in:
parent
4fe4f76b8c
commit
78ca66fb76
|
@ -17,6 +17,7 @@ EOLIAN static Eo *
|
||||||
_efl_ui_image_factory_efl_object_constructor(Eo *obj, Efl_Ui_Image_Factory_Data *pd)
|
_efl_ui_image_factory_efl_object_constructor(Eo *obj, Efl_Ui_Image_Factory_Data *pd)
|
||||||
{
|
{
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
efl_ui_caching_factory_item_class_set(obj, EFL_UI_IMAGE_CLASS);
|
||||||
|
|
||||||
pd->property = NULL;
|
pd->property = NULL;
|
||||||
|
|
||||||
|
@ -32,27 +33,33 @@ _efl_ui_image_factory_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Image_Fa
|
||||||
efl_destructor(efl_super(obj, MY_CLASS));
|
efl_destructor(efl_super(obj, MY_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Value
|
||||||
|
_efl_ui_image_factory_connect(Eo *obj, void *data, const Eina_Value value)
|
||||||
|
{
|
||||||
|
Efl_Gfx_Entity *entity = NULL;
|
||||||
|
Efl_Ui_Image_Factory_Data *pd = data;
|
||||||
|
|
||||||
|
eina_value_pget(&value, &entity);
|
||||||
|
|
||||||
|
efl_ui_model_connect(entity, "filename", pd->property);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Future *
|
EOLIAN static Eina_Future *
|
||||||
_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Efl_Model *model, Efl_Gfx_Entity *parent)
|
_efl_ui_image_factory_efl_ui_factory_create(Eo *obj, Efl_Ui_Image_Factory_Data *pd, Efl_Model *model, Efl_Gfx_Entity *parent)
|
||||||
{
|
{
|
||||||
Efl_Gfx_Entity *ui_view;
|
Eina_Future *f;
|
||||||
Eina_Value r;
|
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(pd->property, NULL);
|
if (!parent) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
if (!pd->property) return efl_loop_future_rejected(obj, EFL_FACTORY_ERROR_NOT_SUPPORTED);
|
||||||
ui_view = efl_add(EFL_UI_IMAGE_CLASS, parent);
|
|
||||||
efl_ui_view_model_set(ui_view, model);
|
|
||||||
efl_ui_model_connect(ui_view, "filename", pd->property);
|
|
||||||
|
|
||||||
r = eina_value_object_init(ui_view);
|
f = efl_ui_factory_create(efl_super(obj, EFL_UI_IMAGE_FACTORY_CLASS), model, parent);
|
||||||
|
|
||||||
return eina_future_resolved(efl_loop_future_scheduler_get(obj), r);
|
return efl_future_then(obj, f,
|
||||||
}
|
.success_type = EINA_VALUE_TYPE_OBJECT,
|
||||||
|
.success = _efl_ui_image_factory_connect,
|
||||||
EOLIAN static void
|
.data = pd);
|
||||||
_efl_ui_image_factory_efl_ui_factory_release(Eo *obj EINA_UNUSED, Efl_Ui_Image_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view)
|
|
||||||
{
|
|
||||||
efl_parent_set(ui_view, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
class Efl.Ui.Image_Factory (Efl.Object, Efl.Ui.Factory)
|
class Efl.Ui.Image_Factory (Efl.Ui.Caching_Factory)
|
||||||
{
|
{
|
||||||
[[Efl UI image factory class]]
|
[[Efl UI image factory class]]
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Ui.Factory.create;
|
Efl.Ui.Factory.create;
|
||||||
Efl.Ui.Factory.release;
|
|
||||||
Efl.Ui.Model.Connect.connect;
|
Efl.Ui.Model.Connect.connect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue