Page MenuHomePhabricator

efl.container
Closed, ResolvedPublic

Description

|interface Efl.Container
|├ (M) content_remove
|├ (M) content_iterate
|├ (M) content_count
|├ (E) content,added
|├ (E) content,removed

Related Objects

StatusAssignedTask
Resolvedzmike
Resolvedzmike
zmike created this task.Jan 8 2019, 11:41 AM
zmike triaged this task as TODO priority.
zmike moved this task from Backlog to Evaluating on the efl: api board.Jan 31 2019, 5:18 AM

It's a bit weird that it has a method to remove an element but not to add one.
I understand the method to add elements is provided by the different implementations of this interface (like Efl.Pack for example), so maybe element removal could do the same?
In the case of Efl.Ui.Box, for instance, element removal can be accomplished either with Efl.Pack.unpack or with Efl.Container.content_remove which share the same implementation so there would be no harm in removing content_remove.

There are also the part containers like efl.ui.layout, where you can set the content to a part. Removing it from the part would be setting the content of a part to NULL which seems to be a bit annoying, since you still have to remember the exact part.
However, content_remove can just be used as a general purpose "Hey container, please release this object" shortcut, which sounds sensible and fine to me :)

Then, a general purpose content_add would also make sense, no?
I am afraid asymmetrical APIs raise questions I won't know how to answer in the docs :/

okay, but how do you want to realize content_add in a general manner ? In a layout you have x,y,w,h in a box you have n, in a layout you have a string. You cannot add in a general manner. However, a *add* adds a relation from the widget to the new content, you can use this relation to terminate the relation, you don't need a special termination for that ... :)

Ok, I have been talking in general terms because I am not familiar with the details, but now I'll need them.
Can you give me examples of add and remove methods? I am interested in knowing where in the container things are added, and where are they removed from when using the generic content_remove.

zmike moved this task from Evaluating to needs patch on the efl: api board.Feb 11 2019, 10:58 AM

I just saw that this content_remove method accepts the object to remove, so it is general and independent of the implementation of the addition.
No objections to stabilize this then.

Currentrly, Efl.Pack extends Efl.Container.
And Efl.Pack includes "unpack" which seems almost similar with "content_remove".

All the classes implements Efl.Pack needs to write the code for the both of "unpack" and "content_remove".
In my opinion, this looks not that good idea.
(As you can see in edje_part_box.c, "content_remove" is just calling "unpack" directly)

So, I think that "content_remove" can be removed -
and it can be a method only for "Efl.Canvas.Layout" and "Efl.Ui.Layout" which don't implement "Efl.Pack".

I like that idea!

Efl.Container then will only have the content_iterate and content_count methods and the content,added and content_removed events.

YOhoho added a subscriber: YOhoho.Feb 12 2019, 3:53 AM

I agree with @woohyun. here is patch woohyun saying. D7913

zmike moved this task from needs patch to Stabilized on the efl: api board.Feb 15 2019, 6:43 AM
bu5hm4n raised the priority of this task from TODO to Normal.Feb 22 2019, 1:19 AM
zmike closed this task as Resolved.Mar 11 2019, 10:47 AM
zmike claimed this task.