rimmed pushed a commit to branch master.

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

commit 96edb7885b4579ef7ccdb9e7b70bf218aedf1b22
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Tue Dec 22 18:15:31 2015 +0200

    workspace: fix part_state add logic
---
 src/bin/ui/group_navigator.c     | 27 +++++----------------------
 src/bin/ui/group_navigator.h     |  3 +++
 src/bin/ui/tabs.c                | 16 +++++++++++++++-
 src/bin/ui/workspace/workspace.c | 18 ++++++++++++++++++
 src/bin/ui/workspace/workspace.h | 15 +++++++++++++++
 5 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/src/bin/ui/group_navigator.c b/src/bin/ui/group_navigator.c
index 68a052e..f4208dd 100644
--- a/src/bin/ui/group_navigator.c
+++ b/src/bin/ui/group_navigator.c
@@ -709,33 +709,17 @@ _popup_add_state_ok_clicked(void *data,
    ecore_job_add(_job_popup_del, pl);
 }
 
-static void
-_editor_state_added_cb(void *data,
-                       Evas_Object *obj __UNUSED__,
-                       void *event_info)
+void
+group_navigator_part_state_add(Evas_Object *obj, Part_ *part, State *state)
 {
-   Part_List *pl = data;
-   const Editor_State *editor_state = event_info;
-   Part_ *part;
-   State *state;
+   Part_List *pl = evas_object_data_get(obj, GROUP_NAVIGATOR_DATA);
    Eina_Bool items_expanded = false;
    Elm_Object_Item *glit;
    const Eina_List *l;
 
    assert(pl != NULL);
-   assert(editor_state != NULL);
-
-   part = elm_object_item_data_get(pl->selected_part_item);
-   if (strcmp(editor_state->part_name, part->name))
-     {
-        part = pm_resource_unsorted_get(part->group->parts, 
editor_state->part_name);
-        group_navigator_part_select(pl->layout, part);
-     }
-   state = gm_state_add(ap.project, part, editor_state->state_name);
-
-   TODO("Check this signal")
-   /* callback should be called before selection to allow some additional 
loading */
-   evas_object_smart_callback_call(ap.win, SIGNAL_STATE_ADDED, (void *)state);
+   assert(part != NULL);
+   assert(state != NULL);
 
    if ((part->type == EDJE_PART_TYPE_TABLE) ||
        (part->type == EDJE_PART_TYPE_BOX))
@@ -1553,7 +1537,6 @@ group_navigator_add(Group *group)
    TODO("Fix multi-tab logic");
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_RESTACKED, 
_editor_part_restacked_cb, pl);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_RESTACKED, 
_editor_part_item_restacked_cb, pl);
-   evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_STATE_ADDED, 
_editor_state_added_cb, pl);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_STATE_DELETED, 
_editor_state_deleted_cb, pl);
 
    TODO("Add deletion callback and free resources");
diff --git a/src/bin/ui/group_navigator.h b/src/bin/ui/group_navigator.h
index 19cefc2..f9d2124 100644
--- a/src/bin/ui/group_navigator.h
+++ b/src/bin/ui/group_navigator.h
@@ -100,4 +100,7 @@ group_navigator_part_item_add(Evas_Object *obj, Part_ 
*part, Eina_Stringshare *
 
 void
 group_navigator_part_item_del(Evas_Object *obj, Part_ *part, Eina_Stringshare 
* item_name);
+
+void
+group_navigator_part_state_add(Evas_Object *obj, Part_ *part, State *state);
 #endif /* GROUP_NAVIGATOR_H */
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index 7d8faad..9428f02 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -354,6 +354,20 @@ _editor_part_item_deleted_cb(void *data __UNUSED__,
    workspace_part_item_del(tabs.current_workspace, editor_item->part_name, 
editor_item->item_name);
 }
 
+static void
+_editor_state_added_cb(void *data __UNUSED__,
+                       Evas_Object *obj __UNUSED__,
+                       void *event_info)
+{
+   const Editor_State *editor_state = event_info;
+
+   assert(editor_state != NULL);
+   assert(tabs.current_group != NULL);
+   assert(tabs.current_workspace != NULL);
+
+   workspace_part_state_add(tabs.current_workspace, editor_state->part_name, 
editor_state->state_name);
+}
+
 Evas_Object *
 tabs_add(void)
 {
@@ -449,7 +463,7 @@ tabs_add(void)
    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_ADDED, 
_editor_state_added_cb, NULL);
    //evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_STATE_DELETED, 
_editor_state_deleted_cb, NULL);
 
    return tabs.layout;
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index ec24843..900da08 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -1939,3 +1939,21 @@ workspace_part_item_del(Evas_Object *obj,
    gm_part_item_del(ap.project, part, item_name);
    group_navigator_part_item_del(sd->group_navigator, part, item_name);
 }
+
+void
+workspace_part_state_add(Evas_Object *obj,
+                         Eina_Stringshare *part_name,
+                         Eina_Stringshare *state_name)
+{
+   Part_ *part;
+   State *state;
+   WS_DATA_GET(obj, sd);
+   assert(part_name != NULL);
+   assert(state_name != NULL);
+
+   part = pm_resource_unsorted_get(sd->group->parts, part_name);
+
+   group_navigator_part_select(sd->group_navigator, part);
+   state = gm_state_add(ap.project, part, state_name);
+   group_navigator_part_state_add(sd->group_navigator, part, state);
+}
diff --git a/src/bin/ui/workspace/workspace.h b/src/bin/ui/workspace/workspace.h
index 4113697..8cf8233 100644
--- a/src/bin/ui/workspace/workspace.h
+++ b/src/bin/ui/workspace/workspace.h
@@ -123,6 +123,21 @@ workspace_part_item_add(Evas_Object *obj,
                         Eina_Stringshare *item_name);
 
 /**
+ * Add new part state to group_edit and group_navigator.
+ * Part should be already added to edit_object.
+ *
+ * @param obj The workspace object.
+ * @param part_name name of part
+ * @param state_name name of added part_state
+ *
+ * @ingroup Workspace
+ */
+void
+workspace_part_state_add(Evas_Object *obj,
+                         Eina_Stringshare *part_name,
+                         Eina_Stringshare *state_name);
+
+/**
  * Add new part item to group_edit and group_navigator.
  * Part should be already deleted from edit_object.
  *

-- 


Reply via email to