summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-22 21:52:45 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-04-23 12:40:51 -0700
commit7ee0a3e05546489ea2444aaddef414bb8ee137d0 (patch)
tree666444b6228c65ebf43001a5f16f6437f4eb7cd5
parentf9143ec63457bedf08c2bbd237066374341e165b (diff)
efl_ui_tab_page: implement content_set / unset correctly
This patchset ensures that the following features are supported: - content-widget deletion on set content - content-widget validation on set calls - invalid cases return false - event emission Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D8681
-rw-r--r--src/lib/elementary/efl_ui_tab_page.c22
-rwxr-xr-xsrc/tests/elementary/spec/generator.py2
2 files changed, 22 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_tab_page.c b/src/lib/elementary/efl_ui_tab_page.c
index a0bd26ef70..cb17b98bcf 100644
--- a/src/lib/elementary/efl_ui_tab_page.c
+++ b/src/lib/elementary/efl_ui_tab_page.c
@@ -11,24 +11,44 @@
11 11
12#define MY_CLASS EFL_UI_TAB_PAGE_CLASS 12#define MY_CLASS EFL_UI_TAB_PAGE_CLASS
13 13
14static void
15_invalidate_cb(void *data, const Efl_Event *ev EINA_UNUSED)
16{
17 efl_content_unset(data);
18}
19
14EOLIAN static Eina_Bool 20EOLIAN static Eina_Bool
15_efl_ui_tab_page_efl_content_content_set(Eo *obj, Efl_Ui_Tab_Page_Data *sd, Eo *content) 21_efl_ui_tab_page_efl_content_content_set(Eo *obj, Efl_Ui_Tab_Page_Data *sd, Eo *content)
16{ 22{
17 if (sd->content) 23 if (sd->content)
18 { 24 {
19 efl_content_unset(efl_part(obj, "efl.content")); 25 efl_content_unset(efl_part(obj, "efl.content"));
26 efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
20 efl_del(sd->content); 27 efl_del(sd->content);
28 sd->content = NULL;
29 }
30
31 if (content && !efl_ui_widget_sub_object_add(obj, content))
32 {
33 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
34 return EINA_FALSE;
21 } 35 }
22 36
23 sd->content = content; 37 sd->content = content;
38 efl_event_callback_add(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
39 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, content);
40
24 efl_content_set(efl_part(obj, "efl.content"), sd->content); 41 efl_content_set(efl_part(obj, "efl.content"), sd->content);
25 42
26 return EINA_TRUE; 43 return EINA_TRUE;
27} 44}
28 45
29EOLIAN static Efl_Gfx_Entity* 46EOLIAN static Efl_Gfx_Entity*
30_efl_ui_tab_page_efl_content_content_unset(Eo *obj, Efl_Ui_Tab_Page_Data *pd EINA_UNUSED) 47_efl_ui_tab_page_efl_content_content_unset(Eo *obj, Efl_Ui_Tab_Page_Data *pd)
31{ 48{
49 efl_event_callback_del(pd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
50 pd->content = NULL;
51 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
32 return efl_content_unset(efl_part(obj, "efl.content")); 52 return efl_content_unset(efl_part(obj, "efl.content"));
33} 53}
34 54
diff --git a/src/tests/elementary/spec/generator.py b/src/tests/elementary/spec/generator.py
index 72af7017fa..79652a32a5 100755
--- a/src/tests/elementary/spec/generator.py
+++ b/src/tests/elementary/spec/generator.py
@@ -6,7 +6,7 @@ tests = [
6 ["Efl.Content" , "Efl.Ui.Button", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item", 6 ["Efl.Content" , "Efl.Ui.Button", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item",
7 "Efl.Ui.List_Default_Item", "Efl.Ui.List_Empty_Item", 7 "Efl.Ui.List_Default_Item", "Efl.Ui.List_Empty_Item",
8 "Efl.Ui.Navigation_Layout", "Efl.Ui.Panel", "Efl.Ui.Progressbar", 8 "Efl.Ui.Navigation_Layout", "Efl.Ui.Panel", "Efl.Ui.Progressbar",
9 "Efl.Ui.Radio", "Efl.Ui.Popup"] 9 "Efl.Ui.Radio", "Efl.Ui.Popup", "Efl.Ui.Tab_Page"]
10] 10]
11 11
12fixture_gen_template = """ 12fixture_gen_template = """