From: Yeongjong Lee Date: Tue, 12 Feb 2019 11:55:11 +0000 (+0000) Subject: efl_container: remove content_remove X-Git-Tag: submit/tizen/20190308.115227~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=122e981bc06f3b30d7f3b1d25d5a28375e3f9261;p=platform%2Fupstream%2Fefl.git efl_container: remove content_remove Most of classes implements Efl.Container.content_remove are just calling "unpack" except of "Efl.Canvas.Layout" and "Efl.Ui.Layout". This patch remove the asymmetrical API and add content_remove API of "Efl.Canvas.Layout" and "Efl.Ui.Layout" that child can be remove without efl_part APIs. ref T7576 Reviewed-by: Marcel Hollerbach Reviewed-by: Mike Blumenkrantz Differential Revision: https://phab.enlightenment.org/D7913 --- diff --git a/src/lib/edje/edje_part_box.c b/src/lib/edje/edje_part_box.c index f737159..db158d6 100644 --- a/src/lib/edje/edje_part_box.c +++ b/src/lib/edje/edje_part_box.c @@ -99,12 +99,6 @@ _efl_canvas_layout_part_box_efl_pack_linear_pack_content_get(Eo *obj, void *_pd return _edje_part_box_content_at(pd->ed, pd->part, index); } -EOLIAN static Eina_Bool -_efl_canvas_layout_part_box_efl_container_content_remove(Eo *obj, void *_pd EINA_UNUSED, Efl_Gfx_Entity *subobj) -{ - return efl_pack_unpack(obj, subobj); -} - EOLIAN static int _efl_canvas_layout_part_box_efl_pack_linear_pack_index_get(Eo *obj, void *_pd EINA_UNUSED, const Efl_Gfx_Entity * subobj) { diff --git a/src/lib/edje/edje_part_invalid.c b/src/lib/edje/edje_part_invalid.c index 3e508b3..d36491d 100644 --- a/src/lib/edje/edje_part_invalid.c +++ b/src/lib/edje/edje_part_invalid.c @@ -74,7 +74,6 @@ EDJE_PART_INVALID_CONST(Eina_Bool, 0, efl_text_cursor_geometry_get, _efl_canvas_ EDJE_PART_INVALID_VOID(efl_text_markup_interactive_cursor_markup_insert, _efl_canvas_layout_part_invalid_efl_text_markup_interactive_cursor_markup_insert, Efl_Text_Cursor_Cursor *cur, const char *markup) EDJE_PART_INVALID(Eina_Iterator *, 0, efl_content_iterate, _efl_canvas_layout_part_invalid_efl_container_content_iterate) EDJE_PART_INVALID(int, 0, efl_content_count, _efl_canvas_layout_part_invalid_efl_container_content_count) -EDJE_PART_INVALID(Eina_Bool, 0, efl_content_remove, _efl_canvas_layout_part_invalid_efl_container_content_remove, Efl_Gfx_Entity *content) EDJE_PART_INVALID(Eina_Bool, 0, efl_pack_clear, _efl_canvas_layout_part_invalid_efl_pack_pack_clear) EDJE_PART_INVALID(Eina_Bool, 0, efl_pack_unpack_all, _efl_canvas_layout_part_invalid_efl_pack_unpack_all) EDJE_PART_INVALID(Eina_Bool, 0, efl_pack_unpack, _efl_canvas_layout_part_invalid_efl_pack_unpack, Efl_Gfx_Entity *subobj) diff --git a/src/lib/edje/edje_part_swallow.c b/src/lib/edje/edje_part_swallow.c index bf4c2b5..e0c0aec 100644 --- a/src/lib/edje/edje_part_swallow.c +++ b/src/lib/edje/edje_part_swallow.c @@ -27,7 +27,7 @@ _efl_canvas_layout_part_swallow_efl_content_content_unset(Eo *obj, void *_pd EIN PROXY_DATA_GET(obj, pd); Efl_Gfx_Entity *content = _edje_efl_content_content_get(pd->ed, pd->part); if (!content) return NULL; - efl_content_remove(obj, content); + efl_canvas_layout_content_remove(obj, content); return content; } diff --git a/src/lib/edje/edje_part_table.c b/src/lib/edje/edje_part_table.c index cc2439d..87709ed 100644 --- a/src/lib/edje/edje_part_table.c +++ b/src/lib/edje/edje_part_table.c @@ -30,12 +30,6 @@ _efl_canvas_layout_part_table_efl_container_content_count(Eo *obj, void *_pd EIN } EOLIAN static Eina_Bool -_efl_canvas_layout_part_table_efl_container_content_remove(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED EINA_UNUSED, Efl_Gfx_Entity *content) -{ - return efl_pack_unpack(obj, content); -} - -EOLIAN static Eina_Bool _efl_canvas_layout_part_table_efl_pack_pack_clear(Eo *obj, void *_pd EINA_UNUSED) { PROXY_DATA_GET(obj, pd); diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index f45b986..2bf0923 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -3585,7 +3585,7 @@ _swallow_real_part_get(Evas_Object *obj_swallow) } EOLIAN Eina_Bool -_efl_canvas_layout_efl_container_content_remove(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *obj_swallow) +_efl_canvas_layout_content_remove(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *obj_swallow) { Edje_Real_Part *rp; Edje_User_Defined *eud; @@ -6861,7 +6861,7 @@ edje_object_part_swallow(Edje_Object *obj, const char *part, Evas_Object *obj_sw EAPI void edje_object_part_unswallow(Edje_Object *obj, Evas_Object *obj_swallow) { - efl_content_remove(obj, obj_swallow); + efl_canvas_layout_content_remove(obj, obj_swallow); } EAPI Evas_Object * diff --git a/src/lib/edje/efl_canvas_layout.eo b/src/lib/edje/efl_canvas_layout.eo index e93ee82..c427657 100644 --- a/src/lib/edje/efl_canvas_layout.eo +++ b/src/lib/edje/efl_canvas_layout.eo @@ -82,6 +82,13 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. error: Efl.Gfx.Image_Load_Error(Efl.Gfx.Image_Load_Error.none); [[The load error code.]] } } + content_remove { + [[Unswallow an object from this Edje.]] + params { + @in content: Efl.Gfx.Entity; [[To be removed content.]] + } + return: bool; [[$false if $content was not a child or can not be removed.]] + } /*********************************************************************************** * TIZEN_ONLY_FEATURE: API for handling text properties of Edje * @@ -384,7 +391,6 @@ class @beta Efl.Canvas.Layout extends Efl.Canvas.Group implements Efl.File, Efl. Efl.Ui.I18n.language { set; get; } Efl.Gfx.Entity.scale { set; get; } Efl.File.load; - Efl.Container.content_remove; Efl.Container.content_iterate; Efl.Container.content_count; Efl.Part.part_get; [[Returns @Efl.Canvas.Layout_Part]] diff --git a/src/lib/edje/efl_canvas_layout_part_box.eo b/src/lib/edje/efl_canvas_layout_part_box.eo index 0fa1e39..38c568c 100644 --- a/src/lib/edje/efl_canvas_layout_part_box.eo +++ b/src/lib/edje/efl_canvas_layout_part_box.eo @@ -10,7 +10,6 @@ class @beta Efl.Canvas.Layout_Part_Box extends Efl.Canvas.Layout_Part implements implements { Efl.Container.content_iterate; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Pack.pack_clear; Efl.Pack.unpack_all; Efl.Pack.unpack; diff --git a/src/lib/edje/efl_canvas_layout_part_invalid.eo b/src/lib/edje/efl_canvas_layout_part_invalid.eo index d048657..6268f2a 100644 --- a/src/lib/edje/efl_canvas_layout_part_invalid.eo +++ b/src/lib/edje/efl_canvas_layout_part_invalid.eo @@ -48,7 +48,6 @@ class @beta Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implem // Efl.Canvas.Layout_Part_Box Efl.Container.content_iterate; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Pack.pack_clear; Efl.Pack.unpack_all; Efl.Pack.unpack; diff --git a/src/lib/edje/efl_canvas_layout_part_table.eo b/src/lib/edje/efl_canvas_layout_part_table.eo index 4abd546..2b9854c 100644 --- a/src/lib/edje/efl_canvas_layout_part_table.eo +++ b/src/lib/edje/efl_canvas_layout_part_table.eo @@ -9,7 +9,6 @@ class @beta Efl.Canvas.Layout_Part_Table extends Efl.Canvas.Layout_Part implemen implements { Efl.Container.content_iterate; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Pack.pack_clear; Efl.Pack.unpack_all; Efl.Pack.unpack; diff --git a/src/lib/efl/interfaces/efl_container.eo b/src/lib/efl/interfaces/efl_container.eo index c2f90d4..42e4d6a 100644 --- a/src/lib/efl/interfaces/efl_container.eo +++ b/src/lib/efl/interfaces/efl_container.eo @@ -8,13 +8,6 @@ interface @beta Efl.Container eo_prefix: efl_content; event_prefix: efl_container; methods { - content_remove { - [[Unswallow an object from this container.]] - params { - @in content: Efl.Gfx.Entity; [[To be removed content]] - } - return: bool; [[$false if $content was not a child or can not be removed.]] - } content_iterate { [[Begin iterating over this object's contents.]] return: iterator @owned @warn_unused; [[Iterator to object content]] diff --git a/src/lib/elementary/efl_ui_box.c b/src/lib/elementary/efl_ui_box.c index e6c2216..e2a4c90 100644 --- a/src/lib/elementary/efl_ui_box.c +++ b/src/lib/elementary/efl_ui_box.c @@ -193,14 +193,6 @@ _efl_ui_box_efl_container_content_count(Eo *obj, Efl_Ui_Box_Data *pd EINA_UNUSED } EOLIAN static Eina_Bool -_efl_ui_box_efl_container_content_remove(Eo *obj EINA_UNUSED, Efl_Ui_Box_Data *pd EINA_UNUSED, Efl_Gfx_Entity *content) -{ - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, 0); - - return evas_object_box_remove(wd->resize_obj, content); -} - -EOLIAN static Eina_Bool _efl_ui_box_efl_pack_pack_clear(Eo *obj, Efl_Ui_Box_Data *pd) { Eina_Bool ret; diff --git a/src/lib/elementary/efl_ui_box.eo b/src/lib/elementary/efl_ui_box.eo index 164bdb8..6ec2da2 100644 --- a/src/lib/elementary/efl_ui_box.eo +++ b/src/lib/elementary/efl_ui_box.eo @@ -30,7 +30,6 @@ class @beta Efl.Ui.Box extends Efl.Ui.Widget implements Efl.Pack_Linear, Efl.Pac implements { Efl.Object.constructor; Efl.Canvas.Group.group_calculate; - Efl.Container.content_remove; Efl.Container.content_iterate; Efl.Container.content_count; Efl.Ui.Direction.direction { get; set; } diff --git a/src/lib/elementary/efl_ui_flip.c b/src/lib/elementary/efl_ui_flip.c index 7f3238e..7461505 100644 --- a/src/lib/elementary/efl_ui_flip.c +++ b/src/lib/elementary/efl_ui_flip.c @@ -2210,15 +2210,6 @@ _efl_ui_flip_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Flip_Data * } EOLIAN static Eina_Bool -_efl_ui_flip_efl_container_content_remove(Eo *obj, Efl_Ui_Flip_Data *pd, Efl_Gfx_Entity *content) -{ - pd->content_list = eina_list_remove(pd->content_list, content); - pd->content_list = eina_list_remove(pd->content_list, content); - _content_removed(obj, pd, content); - return EINA_TRUE; -} - -EOLIAN static Eina_Bool _efl_ui_flip_efl_pack_unpack(Eo *obj, Efl_Ui_Flip_Data *pd, Efl_Gfx_Entity *subobj) { pd->content_list = eina_list_remove(pd->content_list, subobj); diff --git a/src/lib/elementary/efl_ui_flip.eo b/src/lib/elementary/efl_ui_flip.eo index ac233a1..d45e787 100644 --- a/src/lib/elementary/efl_ui_flip.eo +++ b/src/lib/elementary/efl_ui_flip.eo @@ -235,7 +235,6 @@ class @beta Efl.Ui.Flip extends Efl.Ui.Widget implements Efl.Pack_Linear Efl.Ui.Widget.widget_sub_object_del; Efl.Container.content_iterate; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Part.part_get; Efl.Pack.unpack; Efl.Pack.pack; diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c index 0dbd36c..b221c32 100644 --- a/src/lib/elementary/efl_ui_layout.c +++ b/src/lib/elementary/efl_ui_layout.c @@ -1320,23 +1320,6 @@ _efl_ui_layout_content_unset(Eo *obj, Efl_Ui_Layout_Data *sd, const char *part) return NULL; } -EOLIAN static Eina_Bool -_efl_ui_layout_base_efl_container_content_remove(Eo *obj, Efl_Ui_Layout_Data *sd EINA_UNUSED, - Efl_Gfx_Entity *content) -{ - ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE); - - if (!_elm_widget_sub_object_redirect_to_top(obj, content)) - { - ERR("could not remove sub object %p from %p", content, obj); - return EINA_FALSE; - } - edje_object_part_unswallow(wd->resize_obj, content); - _eo_unparent_helper(content, obj); - - return EINA_TRUE; -} - /* legacy only - eo is iterator */ EAPI Eina_List * elm_layout_content_swallow_list_get(const Evas_Object *obj) diff --git a/src/lib/elementary/efl_ui_layout_base.eo b/src/lib/elementary/efl_ui_layout_base.eo index 85a5103..ad40a7c 100644 --- a/src/lib/elementary/efl_ui_layout_base.eo +++ b/src/lib/elementary/efl_ui_layout_base.eo @@ -72,7 +72,6 @@ abstract @beta Efl.Ui.Layout_Base extends Efl.Ui.Widget implements Efl.Container Efl.Ui.Widget.widget_sub_object_del; Efl.Ui.Focus.Object.on_focus_update; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Container.content_iterate; Efl.Part.part_get; Efl.Ui.View.model { get; set; } diff --git a/src/lib/elementary/efl_ui_layout_pack.c b/src/lib/elementary/efl_ui_layout_pack.c index 4f3e6d0..501dcb0 100644 --- a/src/lib/elementary/efl_ui_layout_pack.c +++ b/src/lib/elementary/efl_ui_layout_pack.c @@ -118,13 +118,6 @@ _efl_ui_layout_part_box_efl_pack_unpack(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Box_D } EOLIAN static Eina_Bool -_efl_ui_layout_part_box_efl_container_content_remove(Eo *obj, Efl_Ui_Layout_Box_Data *pd, Efl_Gfx_Entity *content) -{ - // alias for efl_pack_unpack - return _efl_ui_layout_part_box_efl_pack_unpack(obj, pd, content); -} - -EOLIAN static Eina_Bool _efl_ui_layout_part_box_efl_pack_pack(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Box_Data *pd, Efl_Gfx_Entity *subobj) { return _efl_ui_layout_box_append(pd->obj, pd->sd, pd->part, subobj); @@ -288,13 +281,6 @@ _efl_ui_layout_part_table_efl_pack_unpack(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Tab } EOLIAN static Eina_Bool -_efl_ui_layout_part_table_efl_container_content_remove(Eo *obj, Efl_Ui_Layout_Table_Data *pd, Efl_Gfx_Entity *content) -{ - // alias for efl_pack_unpack - return _efl_ui_layout_part_table_efl_pack_unpack(obj, pd, content); -} - -EOLIAN static Eina_Bool _efl_ui_layout_part_table_efl_pack_table_pack_table(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Table_Data *pd, Efl_Gfx_Entity *subobj, int col, int row, int colspan, int rowspan) { return _efl_ui_layout_table_pack(pd->obj, pd->sd, pd->part, subobj, col, row, colspan, rowspan); diff --git a/src/lib/elementary/efl_ui_layout_part_box.eo b/src/lib/elementary/efl_ui_layout_part_box.eo index 9cc2ffa..9dbd674 100644 --- a/src/lib/elementary/efl_ui_layout_part_box.eo +++ b/src/lib/elementary/efl_ui_layout_part_box.eo @@ -27,7 +27,6 @@ class @beta Efl.Ui.Layout_Part_Box extends Efl.Ui.Layout_Part implements Efl.Pac Efl.Object.destructor; Efl.Container.content_iterate; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Ui.Direction.direction { get; } Efl.Pack.pack_clear; Efl.Pack.unpack_all; diff --git a/src/lib/elementary/efl_ui_layout_part_table.eo b/src/lib/elementary/efl_ui_layout_part_table.eo index 0423c91..6a54bd6 100644 --- a/src/lib/elementary/efl_ui_layout_part_table.eo +++ b/src/lib/elementary/efl_ui_layout_part_table.eo @@ -25,7 +25,6 @@ class @beta Efl.Ui.Layout_Part_Table extends Efl.Ui.Layout_Part implements Efl.P Efl.Object.destructor; Efl.Container.content_iterate; Efl.Container.content_count; - Efl.Container.content_remove; Efl.Pack.pack_clear; Efl.Pack.unpack_all; Efl.Pack.unpack; diff --git a/src/lib/elementary/efl_ui_table.c b/src/lib/elementary/efl_ui_table.c index ff7de54..541fb7f 100644 --- a/src/lib/elementary/efl_ui_table.c +++ b/src/lib/elementary/efl_ui_table.c @@ -572,13 +572,6 @@ _efl_ui_table_efl_container_content_count(Eo *obj EINA_UNUSED, Efl_Ui_Table_Data return pd->count; } -EOLIAN static Eina_Bool -_efl_ui_table_efl_container_content_remove(Eo *obj, Efl_Ui_Table_Data *pd EINA_UNUSED, Efl_Gfx_Entity *content) -{ - return efl_pack_unpack(obj, content); -} - - EOLIAN static Eina_Iterator * _efl_ui_table_efl_pack_table_table_contents_get(Eo *obj, Efl_Ui_Table_Data *pd EINA_UNUSED, int col, int row, Eina_Bool below) diff --git a/src/lib/elementary/efl_ui_table.eo b/src/lib/elementary/efl_ui_table.eo index 7ccc7d1..3e3753a9 100644 --- a/src/lib/elementary/efl_ui_table.eo +++ b/src/lib/elementary/efl_ui_table.eo @@ -21,7 +21,6 @@ class @beta Efl.Ui.Table extends Efl.Ui.Widget implements Efl.Pack_Table, Efl.Pa Efl.Object.constructor; Efl.Canvas.Group.group_calculate; Efl.Ui.Widget.theme_apply; - Efl.Container.content_remove; Efl.Container.content_iterate; Efl.Container.content_count; Efl.Ui.Direction.direction { get; set; } diff --git a/src/tests/edje/edje_test_container.c b/src/tests/edje/edje_test_container.c index 018de4d..11fc195 100644 --- a/src/tests/edje/edje_test_container.c +++ b/src/tests/edje/edje_test_container.c @@ -102,7 +102,7 @@ EFL_START_TEST(edje_test_box_eoapi) fail_if(i != 3); eina_iterator_free(it); - fail_if(!efl_content_remove(efl_part(obj, "box"), sobjs[0])); + fail_if(!efl_pack_unpack(efl_part(obj, "box"), sobjs[0])); fail_if(efl_content_count(efl_part(obj, "box")) != 2); fail_if(!efl_pack_unpack_at(efl_part(obj, "box"), 1)); fail_if(efl_content_count(efl_part(obj, "box")) != 1); diff --git a/src/tests/edje/edje_test_swallow.c b/src/tests/edje/edje_test_swallow.c index 0d08951..b8f13cf 100644 --- a/src/tests/edje/edje_test_swallow.c +++ b/src/tests/edje/edje_test_swallow.c @@ -107,7 +107,7 @@ EFL_START_TEST(edje_test_swallows_eoapi) fail_if(!efl_content_set(efl_part(ly, "swallow"), o1)); ck_assert_ptr_eq(efl_parent_get(o1), ly); - efl_content_remove(ly, o1); + efl_canvas_layout_content_remove(ly, o1); ck_assert_ptr_eq(efl_parent_get(o1), evas_object_evas_get(o1)); fail_if(!efl_content_set(efl_part(ly, "swallow"), o1));