yakov pushed a commit to branch master. http://git.enlightenment.org/tools/erigo.git/commit/?id=2081557688ab7719d3d602d462964076670bd995
commit 2081557688ab7719d3d602d462964076670bd995 Author: Yakov Goldberg <yako...@samsung.com> Date: Tue Nov 24 17:19:36 2015 +0200 Fix behavior widget packing behavior When adding widget into container, need to check if it was previously packed. If so need to unpack it from previous container and add memento. --- src/bin/gui/editor.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/bin/gui/editor.c b/src/bin/gui/editor.c index 0bc4f73..aaf5f52 100644 --- a/src/bin/gui/editor.c +++ b/src/bin/gui/editor.c @@ -3523,6 +3523,35 @@ _field_update_from_itemview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Desc if (type == GUI_TYPE_OBJECT) { Gui_Widget *w = wdg_get(name_id); + /* Check if new_widget was packed previously: take it's parent and check + * if widget is packed into it's parent. + * If so, we need to unpack widget and delete from contents*/ + + Eid *prev_parent_cont_eid = wdg_parent_container_eid_get(wdg); + Gui_Widget *prev_wdg_container = prev_parent_cont_eid ? wdg_get(prev_parent_cont_eid) : NULL; + if (prev_wdg_container && wdg_obj_container_get(prev_wdg_container)) + { + Object_Container *_old_prev_container, *_new_prev_container; + _old_prev_container = (Object_Container *) wdg_obj_container_get((Gui_Widget *) prev_wdg_container); + _new_prev_container = obj_container_copy(_old_prev_container); + + memento_command_add(wdg_eid_get(prev_wdg_container), + MEMENTO_OBJ_CONTAINER, + _old_prev_container, _new_prev_container); + wdg_obj_container_unset((Gui_Widget *) prev_wdg_container); + wdg_obj_container_set((Gui_Widget *) prev_wdg_container, _new_prev_container); + + /* Take old container's class name from content-property. */ + Object_Container_Item *_ci = wdg_obj_container_item_get(prev_wdg_container, -1, new_value); + Gui_Widget_Property *old_prop = obj_container_item_prop_get(_ci); + + const Op_Desc *old_op_desc = prop_op_desc_get(old_prop); + const char *old_container_name = db_op_desc_class_name_get(old_op_desc); + + Gui_Session *session = (Gui_Session *) gui_context_editor_session_get(_active_context_get()); + manager_widget_content_unset(session, prev_wdg_container, old_container_name, old_prop, NULL); + wdg_obj_container_item_remove(prev_wdg_container, _ci); + } wdg_parent_set(w, wdg_name_get(wdg)); wdg_parent_container_eid_set(w, wdg_eid_get(wdg)); } --