efl: Remove @owned tag from pack/content APIs

Refer to the previous commits for more context.

When an evas object is given to a container, be it with a variant of
efl_pack() or efl_content_set(), its "ownership" is given to the new
parent container. But ownership here means that the new container may
delete the child when it sees fit (i.e. when the container itself dies,
for instance). This does not mean that a reference was passed from the
calling context to the container. The actual EO owner of the child is
always the canvas or another canvas object, even if it the object is
unpacked.

Note: This means that invalid calls to efl_pack or efl_content_set will
not automatically delete the child object. This is the same as legacy,
and results in floating objects. Just check the return value! :)

Hopefully this is correct for bindings.
This commit is contained in:
Jean-Philippe Andre 2017-09-28 17:11:15 +09:00
parent ce84604068
commit 76ab8e3f54
7 changed files with 48 additions and 20 deletions

View File

@ -19,7 +19,7 @@ interface Efl.Pack (Efl.Container)
unpack {
[[Removes an existing item from the container, without deleting it.]]
params {
subobj: Efl.Gfx @owned; [[Unpacked object]]
subobj: Efl.Gfx; [[The unpacked object.]]
}
return: bool; [[$false if $subobj wasn't a child or can't be removed]]
}
@ -30,11 +30,12 @@ interface Efl.Pack (Efl.Container)
spot, replacing any already existing element or append to the end
of the container if there is no default part.
The container takes ownership of this object. This means if packing
failed, the object will be unrefed.
When this container is deleted, it will request deletion on the
given $subobj. Use @.unpack to remove $subobj from this container
without deleting it.
]]
params {
subobj: Efl.Gfx @owned; [[Packed object]]
subobj: Efl.Gfx; [[An object to pack.]]
}
return: bool; [[$false if $subobj could not be packed.]]
}

View File

@ -6,9 +6,14 @@ interface Efl.Pack.Grid (Efl.Pack.Linear)
eo_prefix: efl_pack;
methods {
pack_grid {
[[Pack object on the grid]]
[[Pack object at a given location in the grid.
When this container is deleted, it will request deletion on the
given $subobj. Use @Efl.Pack.unpack to remove $subobj from this
container without deleting it.
]]
params {
subobj: Efl.Gfx @owned; [[Object]]
subobj: Efl.Gfx; [[A child object to pack in this grid.]]
col: int; [[Column number]]
row: int; [[Row number]]
colspan: int @optional; [[0 means 1, -1 means @.grid_columns]]

View File

@ -7,9 +7,13 @@ interface Efl.Pack.Linear (Efl.Pack)
[[Prepend an object at the beginning of this container.
This is the same as @.pack_at($subobj, 0).
When this container is deleted, it will request deletion on the
given $subobj. Use @Efl.Pack.unpack to remove $subobj from this
container without deleting it.
]]
params {
@in subobj: Efl.Gfx @owned; [[Item to pack.]]
@in subobj: Efl.Gfx; [[Item to pack.]]
}
return: bool; [[$false if $subobj could not be packed]]
}
@ -17,41 +21,59 @@ interface Efl.Pack.Linear (Efl.Pack)
[[Append object at the end of this container.
This is the same as @.pack_at($subobj, -1).
When this container is deleted, it will request deletion on the
given $subobj. Use @Efl.Pack.unpack to remove $subobj from this
container without deleting it.
]]
params {
@in subobj: Efl.Gfx @owned; [[Item to pack.]]
@in subobj: Efl.Gfx; [[Item to pack at the end.]]
}
return: bool; [[$false if $subobj could not be packed]]
}
pack_before {
[[Prepend item before other sub object.]]
[[Prepend item before other sub object.
When this container is deleted, it will request deletion on the
given $subobj. Use @Efl.Pack.unpack to remove $subobj from this
container without deleting it.
]]
params {
@in subobj: Efl.Gfx @owned; [[Item to pack.]]
@in subobj: Efl.Gfx; [[Item to pack before $existing.]]
@in existing: const(Efl.Gfx); [[Item to refer to.]]
}
return: bool; [[$false if $existing could not be found or $subobj
could not be packed]]
could not be packed.]]
}
pack_after {
[[Append item after other sub object.]]
[[Append item after other sub object.
When this container is deleted, it will request deletion on the
given $subobj. Use @Efl.Pack.unpack to remove $subobj from this
container without deleting it.
]]
params {
@in subobj: Efl.Gfx @owned; [[Item to pack.]]
@in subobj: Efl.Gfx; [[Item to pack after $existing.]]
@in existing: const(Efl.Gfx); [[Item to refer to.]]
}
return: bool; [[$false if $existing could not be found or $subobj
could not be packed]]
could not be packed.]]
}
pack_at {
[[Inserts $subobj at the specified $index.
Valid range: -$count to +$count. -1 refers to the last element.
Out of range indices will trigger an append.
When this container is deleted, it will request deletion on the
given $subobj. Use @Efl.Pack.unpack to remove $subobj from this
container without deleting it.
]]
params {
@in subobj: Efl.Gfx @owned; [[Item to pack.]]
@in subobj: Efl.Gfx; [[Item to pack at given index.]]
@in index: int; [[A position.]]
}
return: bool; [[$false if $subobj could not be packed]]
return: bool; [[$false if $subobj could not be packed.]]
}
pack_content_get {
[[Content at a given index in this container.

View File

@ -368,7 +368,7 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Access.Window,
type @Efl.Canvas.Image or @Efl.Ui.Image are allowed.
]]
values {
icon: Efl.Canvas.Object @owned @nullable;
icon: Efl.Canvas.Object @nullable;
[[The image object to use for an icon.]]
}
}

View File

@ -234,7 +234,7 @@ class Elm.Gengrid.Item(Elm.Widget.Item)
@since 1.18
]]
params {
@out l: list<Efl.Canvas.Object @owned> @owned; [[The contents list to return.]]
@out l: list<Efl.Canvas.Object> @owned; [[The contents list to return.]]
}
}
}

View File

@ -334,7 +334,7 @@ class Elm.Genlist.Item(Elm.Widget.Item)
elsewhere if the user wants to.
]]
params {
@out l: list<Efl.Canvas.Object @owned> @owned; [[The contents list to return.]]
@out l: list<Efl.Canvas.Object> @owned; [[The contents list to return.]]
}
}
update {

View File

@ -81,7 +81,7 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
See also @.group_member_is.
]]
params {
@in sub_obj: Efl.Canvas.Object @owned @nonull; [[The member object.]]
@in sub_obj: Efl.Canvas.Object @nonull; [[The member object.]]
}
legacy: null;
}