Page MenuHomePhabricator

elementary: allow Efl.Ui.Factory to have a chance to call constructor function.
ClosedPublic

Authored by cedric on Aug 16 2019, 5:28 PM.

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.Aug 16 2019, 5:28 PM
cedric requested review of this revision.Aug 16 2019, 5:28 PM
cedric updated this revision to Diff 24140.Aug 16 2019, 6:01 PM

phab!!!

cedric updated this revision to Diff 24147.Aug 16 2019, 6:05 PM

phab please!

bu5hm4n requested changes to this revision.Aug 18 2019, 6:26 AM
bu5hm4n added inline comments.
src/lib/efl/interfaces/efl_ui_factory.eo
25

Can you elaborate what it is going ? I do not understand whats the purpose of this function...

src/lib/elementary/efl_ui_widget_factory.c
101–102

Why not having a propery for that ?

This revision now requires changes to proceed.Aug 18 2019, 6:26 AM
cedric added inline comments.Aug 19 2019, 3:23 PM
src/lib/efl/interfaces/efl_ui_factory.eo
25

We do have constructor property that must be called during the construction of an object. The factory need a way to allow any inherited factory to do that without having to reimplement the efl_add in every layer that inherit from a factory. This function is what provide the ability of the factory to call itself with the newly created object before that object has been finalized allowing for constructor property to be called.

src/lib/elementary/efl_ui_widget_factory.c
101–102

Because in case it is NULL, we do not want to set it directly on the object I would think (If the class does define a style, setting it to NULL would override that).

cedric updated this revision to Diff 24219.Aug 19 2019, 3:40 PM

Rebase and take comment into account.

lauromoura accepted this revision.Aug 20 2019, 12:26 PM
bu5hm4n added inline comments.Aug 20 2019, 10:48 PM
src/lib/elementary/efl_ui_widget_factory.c
101–102

But having a API that requires you to use efl_key_data is kind of clumsy, can this not just be a parameter of the building API that defaults to NULL?

cedric added inline comments.Aug 20 2019, 11:00 PM
src/lib/elementary/efl_ui_widget_factory.c
101–102

The thing is that it would be illogical as every level of inheritance would want to have their own parameters. Basically the problem is how to do linear information transfer when doing a full vertical inheritance tree walk. I am not even sure this is the proper way. I have tried also to use an event on the factory to carry the information., but it doesn't really help.

bu5hm4n added inline comments.Aug 20 2019, 11:10 PM
src/lib/elementary/efl_ui_widget_factory.c
101–102

Mhm, what about this (just directly out of my mind):

  • You can pass a second object to the create method
  • This object is a simple key value storage, where every key is assosiated with 1 Eina_Value
  • Each Factory can decide which keys they apply, and can simply apply them via reflection.

Does that work ?

101–102

I can also implement that if you have other things to do ... :)

cedric planned changes to this revision.Aug 21 2019, 9:46 AM
cedric added inline comments.
src/lib/elementary/efl_ui_widget_factory.c
101–102

Why adding an object to store key/value when the object itself can do that?

Arguably, I should move this to rely on model and reorder setting up the model. Model being the object that the factory see before the item is created and can associate data with more easily.

bu5hm4n added inline comments.Aug 21 2019, 9:52 AM
src/lib/elementary/efl_ui_widget_factory.c
101–102

Because that stuff is not obviously to be used, and is not beeing able to be documented properly. Not starting with the fact that binded languages will suck with this, or just not provide it.
Additionally, a user could just use the same key and you run into issues. This is just very implicit, and not obvious at all to me.
Additionally² the keys used here will suck, or we are running into issues where the user might uses the same thing...

cedric updated this revision to Diff 24346.Aug 21 2019, 11:03 AM

rebase and avoid using key/data API to please @bu5hm4n :-)

This revision is now accepted and ready to land.Aug 21 2019, 11:04 AM
This revision was automatically updated to reflect the committed changes.