hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=6f47ad19e0252bc27f9fa54167558af23bd5408e

commit 6f47ad19e0252bc27f9fa54167558af23bd5408e
Author: Hermet Park <[email protected]>
Date:   Tue Aug 9 01:39:56 2016 +0900

    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.
---
 src/lib/edj_viewer.c       | 7 +++++++
 src/lib/enventor_private.h | 1 +
 src/lib/enventor_smart.c   | 9 ++++++++-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/lib/edj_viewer.c b/src/lib/edj_viewer.c
index d8be3fa..52a7442 100644
--- a/src/lib/edj_viewer.c
+++ b/src/lib/edj_viewer.c
@@ -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;
+}
diff --git a/src/lib/enventor_private.h b/src/lib/enventor_private.h
index f7e6b09..4dca175 100644
--- a/src/lib/enventor_private.h
+++ b/src/lib/enventor_private.h
@@ -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,
diff --git a/src/lib/enventor_smart.c b/src/lib/enventor_smart.c
index b8500a8..5dd5f6b 100644
--- a/src/lib/enventor_smart.c
+++ b/src/lib/enventor_smart.c
@@ -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));

-- 


Reply via email to