Page MenuHomePhabricator

efl: add a Efl.Model_Provider that every widget will look up for in their parent tree.
ClosedPublic

Authored by cedric on Thu, Jul 11, 4:07 PM.

Details

Summary

This is done to simplify code as you only need to set the model on the
provider and all the widget that are using it as a provider will automatically be
updated. The child will find a provider during at the time the first property binding
is set on the widget by checking if the parent have an Efl.Model_Provider set. It is
not necessary to set a model to have a valid lookup on a Efl.Model_Provider. To disable
a widget lookup, you can just force set a model on it (even NULL) and it will disable
the lookup.

Depends on D9289

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cedric created this revision.Thu, Jul 11, 4:07 PM
cedric requested review of this revision.Thu, Jul 11, 4:07 PM
cedric updated this revision to Diff 23278.Thu, Jul 11, 4:12 PM
cedric edited the summary of this revision. (Show Details)
bu5hm4n requested changes to this revision.Fri, Jul 12, 4:06 AM
bu5hm4n added inline comments.
src/lib/efl/interfaces/efl_model_provider.eo
4

Can you elaborate why i should use this ?

src/lib/elementary/efl_ui_widget.c
5853

I think this is now calling twice the event (other called in _efl_ui_widget_efl_ui_view_model_set)

This revision now requires changes to proceed.Fri, Jul 12, 4:06 AM
cedric planned changes to this revision.Fri, Jul 12, 9:11 AM
cedric added inline comments.
src/lib/efl/interfaces/efl_model_provider.eo
4

Will try to.

src/lib/elementary/efl_ui_widget.c
5853

This is an event triggered when it get the model from a provider. The user is not setting the model on the widget, but on the provider in that scenario (The provider being attached to a parent of the widget). Still all user of the model in the widget code need to be notified of it as they would not know otherwise that there is a model available.

bu5hm4n requested changes to this revision.Mon, Jul 15, 12:35 PM
bu5hm4n added inline comments.
src/lib/elementary/efl_ui_widget.c
5853

Sure, but when _efl_ui_widget_efl_ui_view_model_set is executed, this function is first executed (line 5916). After that the event is again emitted in _efl_ui_widget_efl_ui_view_model_set. which means, its emitted twice, first with (pd->properties.model, NULL) then with the correct parameters.

This revision now requires changes to proceed.Mon, Jul 15, 12:35 PM
cedric planned changes to this revision.Mon, Jul 15, 12:59 PM
cedric added inline comments.
src/lib/elementary/efl_ui_widget.c
5853

There is one case where a double event would be emitted. It is if the efl_ui_view_model_set is called with NULL as a new model, but a provider is found. In which case we have two event emitted with one having incorrect data. Will address that case.

cedric updated this revision to Diff 23458.Wed, Jul 17, 12:02 PM

Rebase and take comment into account.

bu5hm4n accepted this revision.Wed, Jul 17, 12:13 PM
This revision is now accepted and ready to land.Wed, Jul 17, 12:13 PM
Closed by commit rEFL2d481d859354: efl: add a Efl.Model_Provider that every widget will look up for in their… (authored by cedric, committed by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhyWed, Jul 17, 12:59 PM
This revision was automatically updated to reflect the committed changes.