elm_ctxpopup: Implemented elm_widget_item_del_pre for elm_ctxpopup_item 75/143475/1
authorJeonghyun Yun <jh0506.yun@samsung.com>
Thu, 10 Aug 2017 05:22:48 +0000 (14:22 +0900)
committerJeonghyun Yun <jh0506.yun@samsung.com>
Thu, 10 Aug 2017 05:28:29 +0000 (14:28 +0900)
ctxpopup item have elm_list item internally.
But when elm_ctxpopup item was deleted, elm_list item was not deleted.
elm_list item in elm_ctxpopup item should be deleted in del_pre
when elm_ctxpopup item is deleted by elm_wdg_item_del()

Test Plan:
1. launch elementary_test - ctxpopup
2. click Ctxpopup with label only
3. "Never Show" item should not shown in ctxpopup

Reviewers: jpeg

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D5044

Change-Id: I2264a3efbb3050017b89cbbd087042d35eb8830d
Signed-off-by: Jeonghyun Yun <jh0506.yun@samsung.com>
src/bin/test_ctxpopup.c
src/lib/elc_ctxpopup.c
src/lib/elm_ctxpopup_item.eo

index 3cbea699c191eaeca964b2242cbdf39caa2bfc3e..292805ac85ef716a673800eaae28b5891011ec15 100644 (file)
@@ -145,6 +145,8 @@ _list_item_cb3(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U
    elm_object_item_disabled_set(it, EINA_TRUE);
    _ctxpopup_item_new(ctxpopup, "Embryo", NULL);
    _ctxpopup_item_new(ctxpopup, "Edje", NULL);
+   it = _ctxpopup_item_new(ctxpopup, "Never Show", NULL);
+   elm_object_item_del(it);
 
    evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
    evas_object_move(ctxpopup, x, y);
index 729426e4aef9449a062a7761e50c62b3b8cfee1a..3fa019735932072242dc5985920976a254fa3e50 100644 (file)
@@ -994,6 +994,22 @@ _elm_ctxpopup_item_elm_widget_item_signal_emit(Eo *eo_ctxpopup_it EINA_UNUSED,
    elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source);
 }
 
+EOLIAN static Eina_Bool
+_elm_ctxpopup_item_elm_widget_item_del_pre(Eo *eo_ctxpopup_it EINA_UNUSED, Elm_Ctxpopup_Item_Data *ctxpopup_it)
+{
+   ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
+   if (!sd) return EINA_FALSE;
+
+   if (ctxpopup_it->list_item)
+     {
+        eo_unref(ctxpopup_it->list_item);
+        eo_do(ctxpopup_it->list_item, elm_wdg_item_del());
+        ctxpopup_it->list_item = NULL;
+     }
+
+   return EINA_TRUE;
+}
+
 // TIZEN_ONLY(20170116): merge eo & header files for different profiles
 EOLIAN static void
 _elm_ctxpopup_item_elm_widget_item_style_set(Eo *eo_item EINA_UNUSED,
@@ -1003,13 +1019,6 @@ _elm_ctxpopup_item_elm_widget_item_style_set(Eo *eo_item EINA_UNUSED,
    // mobile & wearable only feature
 }
 
-EOLIAN static Eina_Bool
-_elm_ctxpopup_item_elm_widget_item_del_pre(Eo *eo_item EINA_UNUSED, Elm_Ctxpopup_Item_Data *item EINA_UNUSED)
-{
-   // mobile & wearable only feature
-   return EINA_TRUE;
-}
-
 EOLIAN static Elm_Atspi_State_Set
 _elm_ctxpopup_item_elm_interface_atspi_accessible_state_set_get(Eo *obj EINA_UNUSED, Elm_Ctxpopup_Item_Data *it EINA_UNUSED)
 {
index 0f2702b5e336c3c6fce0d00e818e5df18fb14681..87286d1d11a2ea723d8e154b21f67ee4cd347ae4 100644 (file)
@@ -42,13 +42,13 @@ class Elm.Ctxpopup_Item(Elm.Widget_Item, Elm_Interface_Atspi_Widget_Action)
         Eo.Base.destructor;
         Elm.Widget_Item.disable;
         Elm.Widget_Item.signal_emit;
+        Elm.Widget_Item.del_pre;
         Elm.Widget_Item.style.set; // TIZEN_ONLY(20170116): merge eo & header files for different profiles
         Elm.Widget_Item.part_text.get;
         Elm.Widget_Item.part_text.set;
         Elm.Widget_Item.part_content.get;
         Elm.Widget_Item.part_content.set;
         Elm.Widget_Item.part_content_unset;
-        Elm.Widget_Item.del_pre; // TIZEN_ONLY(20170116): merge eo & header files for different profiles
         Elm.Widget_Item.focus.set;
         Elm.Widget_Item.focus.get;
         // TIZEN_ONLY(20170116): merge eo & header files for different profiles