summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_panel.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-19 10:46:16 +0100
committerCedric BAIL <cedric.bail@free.fr>2019-12-19 11:46:23 -0800
commit3e7424c86d1deca8baa37af147ff44cc08e976b7 (patch)
treeea203c18bcc20b567a7cf019e2866846eb87b06e /src/lib/elementary/efl_ui_panel.c
parent0a399b3ca37dcd9f8c4d722f091b783302f37c47 (diff)
efl_ui_panel: fix Efl.Content implementation
It appears that content has been deleted, even if it has been unset before. This also fixes event emission on content_unset. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10919
Diffstat (limited to 'src/lib/elementary/efl_ui_panel.c')
-rw-r--r--src/lib/elementary/efl_ui_panel.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_panel.c b/src/lib/elementary/efl_ui_panel.c
index ea6f8bd..c173224 100644
--- a/src/lib/elementary/efl_ui_panel.c
+++ b/src/lib/elementary/efl_ui_panel.c
@@ -699,10 +699,26 @@ _efl_ui_panel_efl_ui_widget_widget_input_event_handler(Eo *obj, Efl_Ui_Panel_Dat
699 return _panel_efl_ui_widget_widget_input_event_handler(obj, pd, eo_event, src); 699 return _panel_efl_ui_widget_widget_input_event_handler(obj, pd, eo_event, src);
700} 700}
701 701
702
702static void 703static void
703_invalidate_cb(void *data, const Efl_Event *ev EINA_UNUSED) 704_invalidate_cb(void *data, const Efl_Event *ev EINA_UNUSED)
704{ 705{
705 efl_content_set(data, NULL); 706 efl_content_unset(data);
707}
708
709static void
710_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *sd EINA_UNUSED)
711{
712 if (sd->content)
713 {
714 efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
715 evas_object_box_remove(sd->bx, sd->content);
716 if (!sd->scrollable)
717 efl_ui_widget_sub_object_del(obj, sd->content);
718 else
719 efl_ui_widget_sub_object_del(sd->scr_ly, sd->content);
720 sd->content = NULL;
721 }
706} 722}
707 723
708static Eina_Bool 724static Eina_Bool
@@ -712,10 +728,10 @@ _efl_ui_panel_efl_content_content_set(Eo *obj, Efl_Ui_Panel_Data *sd, Efl_Gfx_En
712 728
713 if (sd->content) 729 if (sd->content)
714 { 730 {
715 efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj); 731 Eo *c = sd->content;
716 if (!efl_invalidated_get(sd->content) && !efl_invalidating_get(sd->content)) 732 _content_unset(obj, sd);
717 efl_del(sd->content); 733 if (efl_alive_get(obj))
718 sd->content = NULL; 734 efl_del(c);
719 } 735 }
720 if (content && !elm_widget_sub_object_add(obj, content)) return EINA_FALSE; 736 if (content && !elm_widget_sub_object_add(obj, content)) return EINA_FALSE;
721 sd->content = content; 737 sd->content = content;
@@ -740,11 +756,12 @@ _efl_ui_panel_efl_content_content_get(const Eo *obj EINA_UNUSED, Efl_Ui_Panel_Da
740} 756}
741 757
742static Efl_Gfx_Entity* 758static Efl_Gfx_Entity*
743_efl_ui_panel_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *sd EINA_UNUSED) 759_efl_ui_panel_efl_content_content_unset(Eo *obj, Efl_Ui_Panel_Data *sd EINA_UNUSED)
744{ 760{
745 Efl_Gfx_Entity *ret = efl_content_get(obj); 761 Eo *o = sd->content;
746 efl_content_set(obj, NULL); 762 _content_unset(obj, sd);
747 return ret; 763 efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
764 return o;
748} 765}
749 766
750static void 767static void