rimmed pushed a commit to branch master.

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

commit 4b7793e65664cd1ac035120398c6a2173f5af876
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Wed Dec 23 18:13:36 2015 +0200

    workspace: fix part_item restack logic
---
 src/bin/project_manager/group_manager.c | 15 +++++++++++++
 src/bin/project_manager/group_manager.h |  3 +++
 src/bin/ui/group_navigator.c            | 39 ++++++++-------------------------
 src/bin/ui/group_navigator.h            | 16 ++++++--------
 src/bin/ui/tabs.c                       | 19 +++++++++++++++-
 src/bin/ui/workspace/workspace.c        | 33 ++++++++++++++++------------
 src/bin/ui/workspace/workspace.h        |  9 ++++++++
 7 files changed, 80 insertions(+), 54 deletions(-)

diff --git a/src/bin/project_manager/group_manager.c 
b/src/bin/project_manager/group_manager.c
index 2115801..529cd3e 100644
--- a/src/bin/project_manager/group_manager.c
+++ b/src/bin/project_manager/group_manager.c
@@ -664,3 +664,18 @@ gm_part_restack(Part_ *part, Part_ *rel_part)
    else
      part->group->parts = eina_list_append(part->group->parts, part);
 }
+
+void
+gm_part_item_restack(Part_ *part, Eina_Stringshare *part_item, 
Eina_Stringshare *relative_part_item)
+{
+   assert(part != NULL);
+   assert(part_item != NULL);
+
+   part->items = eina_list_remove(part->items, part_item);
+   if (relative_part_item)
+     part->items = eina_list_prepend_relative(part->items,
+                                              part_item,
+                                              relative_part_item);
+   else
+     part->items = eina_list_append(part->items, part_item);
+}
diff --git a/src/bin/project_manager/group_manager.h 
b/src/bin/project_manager/group_manager.h
index 8a7c819..af9c1ea 100644
--- a/src/bin/project_manager/group_manager.h
+++ b/src/bin/project_manager/group_manager.h
@@ -133,4 +133,7 @@ gm_part_rename(Part_* part, const char *new_part_name);
 
 void
 gm_part_restack(Part_ *part, Part_ *rel_part);
+
+void
+gm_part_item_restack(Part_ *part, Eina_Stringshare *part_item, 
Eina_Stringshare *relative_part_item);
 #endif /* GROUP_MANAGER_H */
diff --git a/src/bin/ui/group_navigator.c b/src/bin/ui/group_navigator.c
index 711bc03..93752fc 100644
--- a/src/bin/ui/group_navigator.c
+++ b/src/bin/ui/group_navigator.c
@@ -1284,41 +1284,23 @@ _part_item_restack(Part_List *pl, Elm_Object_Item 
*glit, Eina_Bool move_up)
    eina_stringshare_del(msg);
 }
 
-static void
-_editor_part_item_restacked_cb(void *data,
-                               Evas_Object *obj __UNUSED__,
-                               void *event_info)
+void
+group_navigator_part_item_restack(Evas_Object *obj,
+                                  Part_ *part,
+                                  Eina_Stringshare *part_item,
+                                  Eina_Stringshare *relative_part_item 
__UNUSED__)
 {
-   Part_List *pl = data;
-   const Editor_Part_Item_Restack *editor_part_item_restack = event_info;
-   Part_ *part;
+   Part_List *pl = evas_object_data_get(obj, GROUP_NAVIGATOR_DATA);
    Elm_Object_Item *glit, *items_glit;
    const Eina_List *l;
 
    assert(pl != NULL);
-   assert(editor_part_item_restack != NULL);
-
-   part = elm_object_item_data_get(pl->selected_part_item);
-   if (strcmp(editor_part_item_restack->part_name, part->name))
-     {
-        part = pm_resource_unsorted_get(part->group->parts, 
editor_part_item_restack->part_name);
-        group_navigator_part_select(pl->layout, part);
-     }
+   assert(part != NULL);
+   assert(part_item != NULL);
 
    glit = _part_item_find(pl, part);
    assert(glit != NULL);
 
-   TODO("move this logic to group_manager")
-   part->items = eina_list_remove(part->items, 
editor_part_item_restack->part_item);
-   if (editor_part_item_restack->relative_part_item)
-     part->items = eina_list_prepend_relative(part->items,
-                  editor_part_item_restack->part_item,
-                  editor_part_item_restack->relative_part_item);
-   else
-     part->items = eina_list_append(part->items, 
editor_part_item_restack->part_item);
-
-   evas_object_smart_callback_call(pl->layout, 
SIGNAL_GROUP_NAVIGATOR_PART_ITEM_RESTACKED, (void *)editor_part_restack);
-
    elm_genlist_item_expanded_set(pl->selected_part_item, true);
    items_glit = 
eina_list_data_get(eina_list_last(elm_genlist_item_subitems_get(pl->selected_part_item)));
    elm_genlist_item_expanded_set(items_glit, false);
@@ -1326,7 +1308,7 @@ _editor_part_item_restacked_cb(void *data,
 
    EINA_LIST_FOREACH(elm_genlist_item_subitems_get(items_glit), l, glit)
      {
-        if (elm_object_item_data_get(glit) == 
editor_part_item_restack->part_item) /* comparing stringshares */
+        if (elm_object_item_data_get(glit) == part_item) /* comparing 
stringshares */
           {
              elm_genlist_item_selected_set(glit, true);
              break;
@@ -1505,9 +1487,6 @@ group_navigator_add(Group *group)
 
    pl->name_validator = elm_validator_regexp_new(PART_NAME_REGEX, NULL);
 
-   TODO("Fix multi-tab logic");
-   evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_RESTACKED, 
_editor_part_item_restacked_cb, pl);
-
    TODO("Add deletion callback and free resources");
    return pl->layout;
 }
diff --git a/src/bin/ui/group_navigator.h b/src/bin/ui/group_navigator.h
index b6e54e9..e7fec90 100644
--- a/src/bin/ui/group_navigator.h
+++ b/src/bin/ui/group_navigator.h
@@ -38,14 +38,6 @@
 #define SIGNAL_GROUP_NAVIGATOR_PART_SELECTED 
"SIGNAL_GROUP_NAVIGATOR_PART_SELECTED"
 
 /**
- * emited when part_item is restacked in part list.
- * eventinfo - pointer to Editor_Part_Item_Restack structure
- *
- * @ingroup Partlist
- */
-#define SIGNAL_GROUP_NAVIGATOR_PART_ITEM_RESTACKED 
"SIGNAL_GROUP_NAVIGATOR_PART_ITEM_RESTACKED"
-
-/**
  * emited when part state is activated in part list.
  * eventinfo - pointer to Part_ structure
  *
@@ -96,8 +88,14 @@ void
 group_navigator_part_state_add(Evas_Object *obj, Part_ *part, State *state);
 
 void
-group_navigator_part_state_del(Evas_Object *obj, Part_ *part __UNUSED__, State 
*state);
+group_navigator_part_state_del(Evas_Object *obj, Part_ *part, State *state);
 
 void
 group_navigator_part_restack(Evas_Object *obj, Part_ *part, Part_ *rel_part);
+
+void
+group_navigator_part_item_restack(Evas_Object *obj,
+                                  Part_ *part,
+                                  Eina_Stringshare *part_item,
+                                  Eina_Stringshare *relative_part_item);
 #endif /* GROUP_NAVIGATOR_H */
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index ef25ec3..b7f949f 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -397,6 +397,23 @@ _editor_part_restacked_cb(void *data __UNUSED__,
                           editor_part_restack->relative_part_name);
 }
 
+static void
+_editor_part_item_restacked_cb(void *data __UNUSED__,
+                               Evas_Object *obj __UNUSED__,
+                               void *event_info)
+{
+   const Editor_Part_Item_Restack *editor_part_item_restack = event_info;
+
+   assert(editor_part_item_restack != NULL);
+   assert(tabs.current_group != NULL);
+   assert(tabs.current_workspace != NULL);
+
+   workspace_part_item_restack(tabs.current_workspace,
+                               editor_part_item_restack->part_name,
+                               editor_part_item_restack->part_item,
+                               editor_part_item_restack->relative_part_item);
+}
+
 Evas_Object *
 tabs_add(void)
 {
@@ -491,7 +508,7 @@ tabs_add(void)
    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_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);
 
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index 0ba5f70..4bc944e 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -1468,18 +1468,6 @@ _on_group_navigator_part_select(void *data,
 }
 
 static void
-_on_group_navigator_part_item_restacked(void *data,
-                                        Evas_Object *obj __UNUSED__,
-                                        void *event_info __UNUSED__)
-{
-   Evas_Object *workspace = (Evas_Object *)data;
-
-   WS_DATA_GET(workspace, sd);
-
-   groupedit_hard_update(sd->groupedit);
-}
-
-static void
 _on_group_navigator_part_state_select(void *data,
                                 Evas_Object *obj __UNUSED__,
                                 void *event_info)
@@ -1546,8 +1534,6 @@ workspace_add(Evas_Object *parent, Group *group)
    elm_object_part_content_set(sd->panes, "right", sd->group_navigator);
    evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_SELECTED,
                                   _on_group_navigator_part_select, obj);
-   evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_ITEM_RESTACKED,
-                                  _on_group_navigator_part_item_restacked, 
obj);
    evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_STATE_SELECTED,
                                   _on_group_navigator_part_state_select, obj);
    evas_object_smart_callback_add(sd->group_navigator, 
SIGNAL_GROUP_NAVIGATOR_PART_VISIBLE_CHANGED,
@@ -2008,3 +1994,22 @@ workspace_part_restack(Evas_Object *obj,
 
    groupedit_edit_object_part_restack(sd->groupedit, part_name, 
relative_part_name);
 }
+
+void
+workspace_part_item_restack(Evas_Object *obj,
+                            Eina_Stringshare *part_name,
+                            Eina_Stringshare *part_item_name,
+                            Eina_Stringshare *relative_part_item_name)
+{
+   Part_ *part;
+   WS_DATA_GET(obj, sd);
+   assert(part_item_name != NULL);
+
+   part = pm_resource_unsorted_get(sd->group->parts, part_name);
+
+   group_navigator_part_select(sd->group_navigator, part);
+   gm_part_item_restack(part, part_item_name, relative_part_item_name);
+   group_navigator_part_item_restack(sd->group_navigator, part, 
part_item_name, relative_part_item_name);
+
+   groupedit_hard_update(sd->groupedit);
+}
diff --git a/src/bin/ui/workspace/workspace.h b/src/bin/ui/workspace/workspace.h
index 2d1dcd9..5abb362 100644
--- a/src/bin/ui/workspace/workspace.h
+++ b/src/bin/ui/workspace/workspace.h
@@ -186,6 +186,15 @@ void
 workspace_part_restack(Evas_Object *obj,
                        Eina_Stringshare *part_name,
                        Eina_Stringshare *relative_part_name);
+
+/**
+ *
+ */
+void
+workspace_part_item_restack(Evas_Object *obj,
+                            Eina_Stringshare *part_name,
+                            Eina_Stringshare *part_item_name,
+                            Eina_Stringshare *relative_part_item_name);
 /**
  *
  */

-- 


Reply via email to