multi-file: clear edj views if main item is changed.

If the main item is changed, previous edj views won't be valid anymore.
We need to clear them.
This commit is contained in:
Hermet Park 2016-08-09 01:39:56 +09:00
parent 64b88b4147
commit 6f47ad19e0
3 changed files with 16 additions and 1 deletions

View File

@ -932,3 +932,10 @@ view_mirror_mode_update(view_data *vd)
dummy_obj_update(vd->layout);
part_obj_geom_cb(vd, evas_object_evas_get(vd->layout), vd->part_obj, NULL);
}
Enventor_Item *
view_item_get(view_data *vd)
{
if (!vd) return NULL;
return vd->it;
}

View File

@ -218,6 +218,7 @@ void view_string_list_free(Eina_List *list);
void view_part_state_set(view_data *vd, const char *part, const char *description, const double state);
void view_obj_need_reload_set(view_data *vd);
Edje_Part_Type view_part_type_get(view_data *vd, const char *part);
Enventor_Item *view_item_get(view_data *vd);
/* template */
Eina_Bool template_part_insert(edit_data *ed, Edje_Part_Type part_type, Enventor_Template_Insert_Type insert_type, Eina_Bool fixed_w, Eina_Bool fixed_h, char *rel1_x_to, char *rel1_y_to, char *rel2_x_to, char *rel2_y_to, float align_x, float align_y, int min_w, int min_h,

View File

@ -144,7 +144,13 @@ edit_view_sync_cb(void *data, Eina_Stringshare *state_name, double state_value,
if (pd->group_name != group_name)
{
view_data *vd = edj_mgr_view_get(group_name);
if (vd) edj_mgr_view_switch_to(vd);
if (vd)
{
//If a group name equals to an other item's,
//Probably, Enventor switches multiple collections.
if (view_item_get(vd) == it) edj_mgr_view_switch_to(vd);
else edj_mgr_view_switch_to(NULL);
}
else
{
vd = edj_mgr_view_new(it, group_name);
@ -870,6 +876,7 @@ enventor_object_main_item_set(Enventor_Object *obj, const char *file)
{
Enventor_Object_Data *pd = eo_data_scope_get(obj, ENVENTOR_OBJECT_CLASS);
edj_mgr_clear();
_enventor_main_item_free(pd);
Enventor_Item_Data *it = calloc(1, sizeof(Enventor_Item_Data));