From fcaec29be7eda381ef11db1a01d1915e420fe7f0 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 16 Aug 2019 15:59:36 -0700 Subject: [PATCH] efl: use a @static function so that binding can pick it up. Reviewed-by: Lauro Neto > Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D9604 --- src/lib/efl/Efl.h | 17 +---------------- src/lib/efl/interfaces/efl_interfaces_main.c | 8 +++++--- src/lib/efl/interfaces/efl_ui_factory.eo | 5 ++++- src/lib/efl/interfaces/efl_ui_view_factory.eo | 16 ++++++++++++++++ src/lib/efl/interfaces/meson.build | 1 + 5 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 src/lib/efl/interfaces/efl_ui_view_factory.eo diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index e1cfe4156e..403750ac93 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -146,6 +146,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command; #include "interfaces/efl_ui_view.eo.h" #include "interfaces/efl_ui_property_bind.eo.h" #include "interfaces/efl_ui_factory.eo.h" +#include "interfaces/efl_ui_view_factory.eo.h" #include "interfaces/efl_ui_factory_bind.eo.h" #include "interfaces/efl_model_provider.eo.h" #include "interfaces/efl_cached_item.eo.h" @@ -203,22 +204,6 @@ EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple); */ EAPI Efl_Object *efl_part(const Eo *obj, const char *name); -/** - * @brief This triggers the create method of a factory and trigger the item created event. - * - * @param[in] factory The factory that will provide the item - * @param[in] model The model to use to fetch information from - * @param[in] parent The parent of the newly created item - * @return A future that will resolve with the newly created item. - * - * @since 1.23 - * @note This exists as we always want to trigger the event once all the logic - * of every factory in the chain has done what it planned to do. Basically we - * want the inverse of inheritance call like efl_super. So we do setup the future - * in this way. - */ -EAPI Eina_Future *efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent); - #else #ifndef EFL_NOLEGACY_API_SUPPORT diff --git a/src/lib/efl/interfaces/efl_interfaces_main.c b/src/lib/efl/interfaces/efl_interfaces_main.c index 4e85ab6bbc..b73900e55e 100644 --- a/src/lib/efl/interfaces/efl_interfaces_main.c +++ b/src/lib/efl/interfaces/efl_interfaces_main.c @@ -67,8 +67,8 @@ #include "interfaces/efl_ui_range_interactive.eo.c" #include "interfaces/efl_ui_autorepeat.eo.c" #include "interfaces/efl_ui_view.eo.c" -#include "interfaces/efl_ui_property_bind.eo.c" #include "interfaces/efl_ui_factory.eo.c" +#include "interfaces/efl_ui_property_bind.eo.c" #include "interfaces/efl_ui_factory_bind.eo.c" #include "interfaces/efl_ui_draggable.eo.c" @@ -131,10 +131,12 @@ _efl_ui_view_factory_item_created(Eo *factory, void *data EINA_UNUSED, const Ein return v; } -EAPI Eina_Future * -efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent) +static Eina_Future * +_efl_ui_view_factory_create_with_event(Efl_Ui_Factory *factory, Eina_Iterator *models, Efl_Gfx_Entity *parent) { return efl_future_then(factory, efl_ui_factory_create(factory, models, parent), .success_type = EINA_VALUE_TYPE_ARRAY, .success = _efl_ui_view_factory_item_created); } + +#include "efl_ui_view_factory.eo.c" diff --git a/src/lib/efl/interfaces/efl_ui_factory.eo b/src/lib/efl/interfaces/efl_ui_factory.eo index 9b98ece447..b238bec679 100644 --- a/src/lib/efl/interfaces/efl_ui_factory.eo +++ b/src/lib/efl/interfaces/efl_ui_factory.eo @@ -9,7 +9,10 @@ interface @beta Efl.Ui.Factory extends Efl.Ui.Property_Bind, Efl.Ui.Factory_Bind [[Efl UI factory interface]] methods { create { - [[Create a UI object from the necessary properties in the specified model.]] + [[Create a UI object from the necessary properties in the specified model. + + + Note: This is the function you need to implement for a custom factory, but if you want to use a factory, you should rely on @Efl.Ui.View_Factory.create_with_event.]] params { models: iterator; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] parent: Efl.Gfx.Entity; [[Efl canvas]] diff --git a/src/lib/efl/interfaces/efl_ui_view_factory.eo b/src/lib/efl/interfaces/efl_ui_view_factory.eo new file mode 100644 index 0000000000..a8a860c7ba --- /dev/null +++ b/src/lib/efl/interfaces/efl_ui_view_factory.eo @@ -0,0 +1,16 @@ +class @beta Efl.Ui.View_Factory +{ + [[This class provide a utility function that class that wish to use @Efl.Ui.Factory.create should use.]] + data: null; + methods { + create_with_event @static { + [[Create a UI object from the necessary properties in the specified model and generate the created event on the factory when the object is done building. This function must be use by all @Efl.Ui.View that need to create object. They should not use @Efl.Ui.Factory.create directly.]] + params { + factory: Efl.Ui.Factory; [[The factory to use for requesting the new object from and generating the created event onto.]] + models: iterator; [[Efl iterator providing the model to be associated to the new item. It should remain valid until the end of the function call.]] + parent: Efl.Gfx.Entity; [[Efl canvas]] + } + return: future; [[Created UI object]] + } + } +} diff --git a/src/lib/efl/interfaces/meson.build b/src/lib/efl/interfaces/meson.build index 992915c69e..58d90ebbe3 100644 --- a/src/lib/efl/interfaces/meson.build +++ b/src/lib/efl/interfaces/meson.build @@ -83,6 +83,7 @@ pub_eo_files = [ 'efl_ui_view.eo', 'efl_ui_property_bind.eo', 'efl_ui_factory.eo', + 'efl_ui_view_factory.eo', 'efl_ui_factory_bind.eo', 'efl_screen.eo', 'efl_io_closer.eo',