rimmed pushed a commit to branch master.

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

commit 9bfbb2954d23442d903e57e411051df28ba3d35f
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Tue Sep 20 12:46:28 2016 +0300

    resource_manager_react: use correct signals for part renaming
    
    First - rename parts in structures and UI
    Then - rename part itself as a resource
    
    @fix
---
 src/bin/editor/editor_part.c                      | 11 +++++++++--
 src/bin/resource_manager/resource_manager_react.c | 22 +++++-----------------
 2 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/src/bin/editor/editor_part.c b/src/bin/editor/editor_part.c
index 530a476..d0fa7a7 100644
--- a/src/bin/editor/editor_part.c
+++ b/src/bin/editor/editor_part.c
@@ -165,6 +165,8 @@ editor_part_name_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merge,
    Rename ren;
    Editor_Attribute_Change send;
    send.attribute = RM_ATTRIBUTE_PART_NAME;
+   send.old_value = eina_stringshare_add(name);
+   send.value = eina_stringshare_add(new_val);
    assert(edit_object != NULL);
    assert(name != NULL);
    assert(new_val != NULL);
@@ -191,9 +193,14 @@ editor_part_name_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merge,
         ren.old_name = name;
         ren.new_name = new_val;
         TODO("Maybe think about merging those two signals? I dunno")
-        if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_PART_RENAMED, &ren);
-        if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_RM_ATTRIBUTE_CHANGED, &send);
+        if (!_editor_signals_blocked)
+          {
+             evas_object_smart_callback_call(ap.win, SIGNAL_PART_RENAMED, 
&ren);
+             evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_RM_ATTRIBUTE_CHANGED, &send);
+          }
      }
+   eina_stringshare_del(send.old_value);
+   eina_stringshare_del(send.value);
    return true;
 }
 
diff --git a/src/bin/resource_manager/resource_manager_react.c 
b/src/bin/resource_manager/resource_manager_react.c
index 9e4b60e..fcec450 100644
--- a/src/bin/resource_manager/resource_manager_react.c
+++ b/src/bin/resource_manager/resource_manager_react.c
@@ -479,6 +479,11 @@ _property_attribute_changed(void *data,
               _resource_usage_resource_add(part, source);
            }
          break;
+      case RM_ATTRIBUTE_PART_NAME:
+         part = resource_manager_find(group->parts, change->old_value);
+         eina_stringshare_del(part->common.name);
+         part->common.name = eina_stringshare_add(change->value);
+         break;
       default:
          break;
      }
@@ -677,21 +682,6 @@ _style_changed(void *data,
 }
 
 static void
-_part_renamed(void *data __UNUSED__,
-              Evas_Object *obj __UNUSED__,
-              void *ei)
-{
-   Rename *ren = ei;
-   Part2 *current_part;
-
-   Group2 *group = tabs_current_group_get();
-
-   current_part = (Part2 *)resource_manager_find(group->parts, ren->old_name);
-   eina_stringshare_del(current_part->common.name);
-   current_part->common.name = eina_stringshare_add(ren->new_name);
-}
-
-static void
 _group_data_renamed(void *data __UNUSED__,
               Evas_Object *obj __UNUSED__,
               void *ei)
@@ -941,7 +931,6 @@ _resource_callbacks_register(Project *project)
    evas_object_smart_callback_add(ap.win,  SIGNAL_EDITOR_STYLE_TAG_CHANGED, 
_style_changed, project);
 
    /* already implemented stack of editor changes */
-   evas_object_smart_callback_add(ap.win, SIGNAL_PART_RENAMED, _part_renamed, 
project);
    evas_object_smart_callback_add(ap.win, SIGNAL_GROUP_DATA_RENAMED, 
_group_data_renamed, project);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ADDED, 
_editor_part_added_cb, project);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_DELETED, 
_editor_part_deleted_cb, project);
@@ -978,7 +967,6 @@ _resource_callbacks_unregister(Project *project)
    evas_object_smart_callback_del_full(ap.win,  
SIGNAL_EDITOR_STYLE_TAG_CHANGED, _style_changed, project);
 
    /* already implemented stack of editor changes */
-   evas_object_smart_callback_del_full(ap.win, SIGNAL_PART_RENAMED, 
_part_renamed, project);
    evas_object_smart_callback_del_full(ap.win, SIGNAL_GROUP_DATA_RENAMED, 
_group_data_renamed, project);
    evas_object_smart_callback_del_full(ap.win, SIGNAL_EDITOR_PART_ADDED, 
_editor_part_added_cb, project);
    evas_object_smart_callback_del_full(ap.win, SIGNAL_EDITOR_PART_DELETED, 
_editor_part_deleted_cb, project);

-- 


Reply via email to