rimmed pushed a commit to branch master.

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

commit f52657fd136353dcf1b13c3b28757bf322eb6d2f
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Mon Sep 19 19:20:09 2016 +0300

    signals: add signal to cleanup structures before deleting state or part
    
    First -> cleanup and delete from navigator, groupedit, workspace (by using 
new
    PREDEL signals)
    Then -> delete resource and use editor for part/state deletion
    
    @fix
---
 src/bin/common/signals.h         |  2 ++
 src/bin/editor/editor_part.c     | 10 +++++++++-
 src/bin/editor/editor_states.c   | 10 +++++++++-
 src/bin/ui/tabs.c                |  4 ++--
 src/bin/ui/workspace/workspace.c |  2 +-
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index f831e05..cb54893 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -384,6 +384,7 @@ typedef struct {
  *
  * @ingroup Window
  */
+#define SIGNAL_EDITOR_STATE_PREDELETED "SIGNAL_EDITOR_STATE_PREDELETED"
 #define SIGNAL_EDITOR_STATE_DELETED "SIGNAL_EDITOR_STATE_DELETED"
 
 typedef struct {
@@ -425,6 +426,7 @@ typedef struct {
    const char *part_name;
    Change *change;
 } Editor_Part;
+#define SIGNAL_EDITOR_PART_PREDELETED "SIGNAL_EDITOR_PART_PREDELETED"
 #define SIGNAL_EDITOR_PART_DELETED "SIGNAL_EDITOR_PART_DELETED"
 
 /**
diff --git a/src/bin/editor/editor_part.c b/src/bin/editor/editor_part.c
index cd9a5dd..530a476 100644
--- a/src/bin/editor/editor_part.c
+++ b/src/bin/editor/editor_part.c
@@ -927,7 +927,15 @@ _editor_part_del(Evas_Object *edit_object, Change *change, 
Eina_Bool merge __UNU
 
    event_info.part_name = eina_stringshare_add(part_name);
    event_info.change = change;
-   if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_PART_DELETED, (void *)&event_info);
+   if (!_editor_signals_blocked)
+     {
+        /* so in here we need to delete part from workspace, groupedit,
+           all kind of UI part lists since they use original Resource 
structure,
+           and only after that we can finally delete it,
+           so keep those signals in this order please */
+        evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_PART_PREDELETED, 
(void *)&event_info);
+        evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_PART_DELETED, 
(void *)&event_info);
+     }
    eina_stringshare_del(part_name);
 
    TODO("Remake this");
diff --git a/src/bin/editor/editor_states.c b/src/bin/editor/editor_states.c
index cc61d81..18e0339 100644
--- a/src/bin/editor/editor_states.c
+++ b/src/bin/editor/editor_states.c
@@ -883,7 +883,15 @@ editor_state_del(Evas_Object *edit_object, Change *change, 
Eina_Bool merge __UNU
    event_info.state_name = eina_stringshare_add(state_name);
    event_info.state_value = state_val;
    event_info.change = change;
-   if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_STATE_DELETED, (void *)&event_info);
+   if (!_editor_signals_blocked)
+     {
+        /* so in here we need to delete part from workspace, groupedit,
+           all kind of UI part lists since they use original Resource 
structure,
+           and only after that we can finally delete it,
+           so keep those signals in this order please */
+        evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_STATE_PREDELETED, (void *)&event_info);
+        evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_STATE_DELETED, 
(void *)&event_info);
+     }
    if (change)
      {
         if (!editor_state_reset(edit_object, change, apply, part_name, 
state_name, state_val))
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index 00c6a14..bbb8495 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -1019,13 +1019,13 @@ tabs_add(void)
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, 
_property_attribute_changed, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_STATE_SELECTED, 
_editor_part_state_selected_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ADDED, 
_editor_part_added_cb, NULL);
-   evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_DELETED, 
_editor_part_deleted_cb, NULL);
+   evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_PREDELETED, 
_editor_part_deleted_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_ADDED, 
_editor_part_item_added_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_DELETED, 
_editor_part_item_deleted_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_RESTACKED, 
_editor_part_restacked_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_RESTACKED, 
_editor_part_item_restacked_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_STATE_ADDED, 
_editor_state_added_cb, NULL);
-   evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_STATE_DELETED, 
_editor_state_deleted_cb, NULL);
+   evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_STATE_PREDELETED, 
_editor_state_deleted_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PROGRAM_ADDED, 
_editor_program_added_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PROGRAM_DELETED, 
_editor_program_deleted_cb, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_GROUP_DATA_ADDED, 
_editor_group_data_added_cb, NULL);
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index 3ec3c96..ada7a48 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -1834,7 +1834,7 @@ workspace_part_state_add(Evas_Object *obj,
 
    part = (Part2 *)resource_manager_find(wd->group->parts, part_name);
    group_navigator_select(wd->group_navi, (Resource2 *)part);
-   state = (State2 *)resource_manager_v_find(wd->group->parts, state_name, 
state_val);
+   state = (State2 *)resource_manager_v_find(part->states, state_name, 
state_val);
    group_navigator_part_state_add(wd->group_navi, part, state);
 }
 

-- 


Reply via email to