rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=282088920fff7261127d4f6575db8b4444e426bb

commit 282088920fff7261127d4f6575db8b4444e426bb
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Tue Sep 13 19:45:29 2016 +0300

    resource_manager2: light fixes with group reload and editor uses on res 
deletion
    
    @fix
---
 src/bin/resource_manager/resource_manager_free.c   | 60 +++++++++++++++++++---
 .../resource_manager/resource_manager_private.h    |  6 +--
 src/bin/resource_manager/resource_manager_react.c  |  8 +--
 3 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/src/bin/resource_manager/resource_manager_free.c 
b/src/bin/resource_manager/resource_manager_free.c
index 9584d3f..0a65bdc 100644
--- a/src/bin/resource_manager/resource_manager_free.c
+++ b/src/bin/resource_manager/resource_manager_free.c
@@ -51,6 +51,9 @@ _resource_image_del(Project *pro, Image2 *res_image)
              state = (State2 *)res;
              if (res_image->common.name == state->normal)
                {
+                  _resource_group_edit_object_load(pro,
+                                                   state->part->group,
+                                                   
evas_object_evas_get(ap.win));
                   
CRIT_ON_FAIL(editor_state_image_set(state->part->group->edit_object,
                                                       NULL,
                                                       false,
@@ -59,6 +62,7 @@ _resource_image_del(Project *pro, Image2 *res_image)
                                                       state->common.name,
                                                       state->val,
                                                       
EFLETE_DUMMY_IMAGE_NAME));
+                  _resource_group_edit_object_unload(state->part->group);
                   eina_stringshare_del(state->normal);
                   state->normal = 
eina_stringshare_add(EFLETE_DUMMY_IMAGE_NAME);
                }
@@ -117,12 +121,16 @@ _resource_tone_del(Project *pro, Tone2 *res_tone)
         if (res->common.type == RESOURCE2_TYPE_PROGRAM)
           {
              program = (Program2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              program->group,
+                                              evas_object_evas_get(ap.win));
              
CRIT_ON_FAIL(editor_program_tone_name_set(program->group->edit_object,
                                                        NULL,
                                                        false,
                                                        true,
                                                        program->common.name,
                                                        ""));
+             _resource_group_edit_object_unload(program->group);
           }
      }
 
@@ -153,12 +161,16 @@ _resource_sound_del(Project *pro, Sound2 *res_sound)
         if (res->common.type == RESOURCE2_TYPE_PROGRAM)
           {
              program = (Program2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              program->group,
+                                              evas_object_evas_get(ap.win));
              
CRIT_ON_FAIL(editor_program_sample_name_set(program->group->edit_object,
                                                          NULL,
                                                          false,
                                                          true,
                                                          program->common.name,
                                                          
EFLETE_DUMMY_SAMPLE_NAME));
+             _resource_group_edit_object_unload(program->group);
           }
      }
 
@@ -188,6 +200,9 @@ _resource_colorclass_del(Project *pro, Colorclass2 
*res_colorclass)
         if (res->common.type == RESOURCE2_TYPE_STATE)
           {
              state = (State2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              state->part->group,
+                                              evas_object_evas_get(ap.win));
              
CRIT_ON_FAIL(editor_state_color_class_set(state->part->group->edit_object,
                                                        NULL,
                                                        false,
@@ -196,6 +211,7 @@ _resource_colorclass_del(Project *pro, Colorclass2 
*res_colorclass)
                                                        state->common.name,
                                                        state->val,
                                                        NULL));
+             _resource_group_edit_object_unload(state->part->group);
           }
      }
    _resource_colorclass_free(pro, res_colorclass);
@@ -244,6 +260,9 @@ _resource_style_del(Project *pro, Style2 *res_style)
         if (res->common.type == RESOURCE2_TYPE_STATE)
           {
              state = (State2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              state->part->group,
+                                              evas_object_evas_get(ap.win));
              
CRIT_ON_FAIL(editor_state_text_style_set(state->part->group->edit_object,
                                                       NULL,
                                                       false,
@@ -252,6 +271,7 @@ _resource_style_del(Project *pro, Style2 *res_style)
                                                       state->common.name,
                                                       state->val,
                                                       NULL));
+             _resource_group_edit_object_unload(state->part->group);
           }
      }
 
@@ -315,7 +335,7 @@ _resource_state_free(Part2 *part, State2 *state)
 }
 
 void
-_resource_state_del(Part2 *part, State2 *state, Change *change)
+_resource_state_del(Project *pro, Part2 *part, State2 *state, Change *change)
 {
    Eina_List *l;
    Resource2 *res;
@@ -326,12 +346,16 @@ _resource_state_del(Part2 *part, State2 *state, Change 
*change)
         if (res->common.type == RESOURCE2_TYPE_PROGRAM)
           {
              program = (Program2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              program->group,
+                                              evas_object_evas_get(ap.win));
              
CRIT_ON_FAIL(editor_program_filter_state_set(program->group->edit_object,
                                                           change,
                                                           false,
                                                           true,
                                                           res->common.name,
                                                           NULL));
+             _resource_group_edit_object_unload(program->group);
           }
      }
    _resource_state_free(part, state);
@@ -380,7 +404,7 @@ _resource_part_free(Group2 *group, Part2 *part)
 TODO("Apply more complex work (with warning and error maybe?)"
      "with parts which are used by other resources later")
 void
-_resource_part_del(Group2 *group, Part2 *part, Change *change)
+_resource_part_del(Project *pro, Group2 *group, Part2 *part, Change *change)
 {
    Eina_List *l;
    Resource2 *res;
@@ -393,6 +417,9 @@ _resource_part_del(Group2 *group, Part2 *part, Change 
*change)
         if (res->common.type == RESOURCE2_TYPE_STATE)
           {
              state = (State2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              state->part->group,
+                                              evas_object_evas_get(ap.win));
              if (state->part->type == EDJE_PART_TYPE_PROXY)
                
CRIT_ON_FAIL(editor_state_proxy_source_set(state->part->group->edit_object,
                                                           change,
@@ -421,10 +448,14 @@ _resource_part_del(Group2 *group, Part2 *part, Change 
*change)
                                                             state->val,
                                                             NULL));
                }
+             _resource_group_edit_object_unload(state->part->group);
           }
         else if (res->common.type == RESOURCE2_TYPE_PROGRAM)
           {
              program = (Program2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              program->group,
+                                              evas_object_evas_get(ap.win));
              /* if it is actually filter */
              if (program->filter_part == part->common.name)
                {
@@ -448,6 +479,7 @@ _resource_part_del(Group2 *group, Part2 *part, Change 
*change)
                                                          part->common.name));
                   program->targets = eina_list_remove(program->targets, part);
                }
+             _resource_group_edit_object_unload(program->group);
           }
      }
 
@@ -455,7 +487,7 @@ _resource_part_del(Group2 *group, Part2 *part, Change 
*change)
       since they will be deleted together with part */
    EINA_LIST_FOREACH(part->states, l, state)
      {
-        _resource_state_del(part, state, change);
+        _resource_state_del(pro, part, state, change);
      }
    EINA_LIST_FOREACH(part->items, l, item)
      {
@@ -485,7 +517,7 @@ _resource_program_free(Group2 *group, Program2 *program)
 }
 
 void
-_resource_program_del(Group2 *group, Program2 *program, Change *change)
+_resource_program_del(Project *pro, Group2 *group, Program2 *program, Change 
*change)
 {
    Eina_List *l;
    Resource2 *res;
@@ -501,24 +533,32 @@ _resource_program_del(Group2 *group, Program2 *program, 
Change *change)
              while (eina_list_data_find_list(res_program->targets, program))
                {
                   /* if not its probably target part */
+                  _resource_group_edit_object_load(pro,
+                                                   program->group,
+                                                   
evas_object_evas_get(ap.win));
                   
CRIT_ON_FAIL(editor_program_target_del(program->group->edit_object,
                                                          change,
                                                          false,
                                                          true,
                                                          res->common.name,
                                                          
program->common.name));
+                  _resource_group_edit_object_unload(program->group);
                   res_program->targets = 
eina_list_remove(res_program->targets, program);
                }
              /* if its inside of afters */
              while (eina_list_data_find_list(res_program->afters, program))
                {
                   /* if not its probably target part */
+                  _resource_group_edit_object_load(pro,
+                                                   program->group,
+                                                   
evas_object_evas_get(ap.win));
                   
CRIT_ON_FAIL(editor_program_after_del(program->group->edit_object,
                                                         change,
                                                         false,
                                                         true,
                                                         res->common.name,
                                                         program->common.name));
+                  _resource_group_edit_object_unload(program->group);
                   res_program->afters = eina_list_remove(res_program->afters, 
program);
                }
           }
@@ -605,6 +645,9 @@ _resource_group_del(Project *pro, Group2 *group)
         if (res->common.type == RESOURCE2_TYPE_PART)
           {
              part = (Part2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              part->group,
+                                              evas_object_evas_get(ap.win));
 
              if (part->type == EDJE_PART_TYPE_GROUP)
                
CRIT_ON_FAIL(editor_part_group_source_set(part->group->edit_object,
@@ -622,10 +665,14 @@ _resource_group_del(Project *pro, Group2 *group)
                   CRIT_ON_FAIL(editor_part_textblock_anchors_under_set(  
part->group->edit_object, NULL, false, true, part->common.name, NULL));
                   CRIT_ON_FAIL(editor_part_textblock_anchors_over_set(   
part->group->edit_object, NULL, false, true, part->common.name, NULL));
                }
+             _resource_group_edit_object_unload(part->group);
           }
         else if (res->common.type == RESOURCE2_TYPE_ITEM)
           {
              item = (Part_Item2 *)res;
+             _resource_group_edit_object_load(pro,
+                                              item->part->group,
+                                              evas_object_evas_get(ap.win));
              
CRIT_ON_FAIL(editor_part_item_source_set(item->part->group->edit_object,
                                                       NULL,
                                                       false,
@@ -633,12 +680,13 @@ _resource_group_del(Project *pro, Group2 *group)
                                                       item->part->common.name,
                                                       item->common.name,
                                                       
EFLETE_INTERNAL_GROUP_NAME));
+             _resource_group_edit_object_unload(item->part->group);
           }
      }
 
    EINA_LIST_FOREACH(group->programs, l, program)
      {
-        _resource_program_del(group, program, NULL);
+        _resource_program_del(pro, group, program, NULL);
      }
    EINA_LIST_FOREACH(group->data_items, l, data)
      {
@@ -646,7 +694,7 @@ _resource_group_del(Project *pro, Group2 *group)
      }
    EINA_LIST_FOREACH(group->parts, l, part)
      {
-        _resource_part_del(group, part, NULL);
+        _resource_part_del(pro, group, part, NULL);
      }
 
    _resource_group_free(pro, group);
diff --git a/src/bin/resource_manager/resource_manager_private.h 
b/src/bin/resource_manager/resource_manager_private.h
index 9dae289..ba97855 100644
--- a/src/bin/resource_manager/resource_manager_private.h
+++ b/src/bin/resource_manager/resource_manager_private.h
@@ -137,7 +137,7 @@ void
 _resource_state_free(Part2 *part, State2 *state);
 
 void
-_resource_state_del(Part2 *part, State2 *state, Change *change);
+_resource_state_del(Project *pro, Part2 *part, State2 *state, Change *change);
 
 void
 _resource_part_item_free(Part2 *part, Part_Item2 *item);
@@ -149,13 +149,13 @@ void
 _resource_part_free(Group2 *group, Part2 *part);
 
 void
-_resource_part_del(Group2 *group, Part2 *part, Change *change);
+_resource_part_del(Project *pro, Group2 *group, Part2 *part, Change *change);
 
 void
 _resource_program_free(Group2 *group, Program2 *program);
 
 void
-_resource_program_del(Group2 *group, Program2 *program, Change *change);
+_resource_program_del(Project *pro, Group2 *group, Program2 *program, Change 
*change);
 
 void
 _resource_group_data_free(Group2 *group, Group_Data2 *data);
diff --git a/src/bin/resource_manager/resource_manager_react.c 
b/src/bin/resource_manager/resource_manager_react.c
index 56a701a..21d47cf 100644
--- a/src/bin/resource_manager/resource_manager_react.c
+++ b/src/bin/resource_manager/resource_manager_react.c
@@ -35,6 +35,7 @@ _get_current_group2(Project *pro)
    /******* AND EFLETE DOESN'T WORK WITH IT YET ***********/
    /*******************************************************/
    Group *group = tabs_current_group_get();
+   if (!group) return NULL;
    return (Group2 *)resource_manager_find(pro->RM.groups, group->name);
    /*******************************************************/
    /*******************************************************/
@@ -135,6 +136,7 @@ _property_attribute_changed(void *data,
    Attribute editor_resource = (int)change->attribute;
    Project *pro = (Project *)data;
    Group2 *group = _get_current_group2(pro);
+   if (!group) return;
 
    switch ((int)change->attribute)
      {
@@ -733,7 +735,7 @@ _editor_part_deleted_cb(void *data,
    Group2 *group = _get_current_group2(pro);
    Part2 *part = (Part2 *)resource_manager_find(group->parts, 
editor_part->part_name);
 
-   _resource_part_del(group, part, editor_part->change);
+   _resource_part_del(pro, group, part, editor_part->change);
 }
 
 static void
@@ -760,7 +762,7 @@ _editor_program_deleted_cb(void *data,
    Program2 *program = (Program2 *)resource_manager_find(group->programs,
                                                          
editor_part->program_name);
 
-   _resource_program_del(group, program, editor_part->change);
+   _resource_program_del(pro, group, program, editor_part->change);
 }
 
 static void
@@ -849,7 +851,7 @@ _editor_state_deleted_cb(void *data,
    Part2 *part = (Part2 *)resource_manager_find(group->parts, 
editor_state->part_name);
    State2 *state = (State2 *)resource_manager_v_find(part->states, 
editor_state->state_name, editor_state->state_value);
 
-   _resource_state_del(part, state, editor_state->change);
+   _resource_state_del(pro, part, state, editor_state->change);
 }
 
 static void

-- 


Reply via email to