rimmed pushed a commit to branch master.

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

commit dd153c4c55555d6aa58de095488e68aa69b37a1f
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Mon Dec 21 15:25:49 2015 +0200

    workspace: fix part add logic
---
 src/bin/ui/group_navigator.c     | 19 ++++---------------
 src/bin/ui/group_navigator.h     |  4 ++++
 src/bin/ui/tabs.c                | 36 +++++++++++++++++++++++-------------
 src/bin/ui/workspace/workspace.c | 21 ++++++++++++---------
 src/bin/ui/workspace/workspace.h | 12 ++++++------
 5 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/src/bin/ui/group_navigator.c b/src/bin/ui/group_navigator.c
index 016c923..2ecae16 100644
--- a/src/bin/ui/group_navigator.c
+++ b/src/bin/ui/group_navigator.c
@@ -587,20 +587,14 @@ _popup_add_part_ok_clicked(void *data,
    ecore_job_add(_job_popup_del, pl);
 }
 
-static void
-_editor_part_added_cb(void *data,
-                      Evas_Object *obj __UNUSED__,
-                      void *event_info)
+void
+group_navigator_part_add(Evas_Object *obj, Part_ *part)
 {
-   Part_List *pl = data;
-   Eina_Stringshare *part_name = event_info;
-   Part_ *part;
+   Part_List *pl = evas_object_data_get(obj, GROUP_NAVIGATOR_DATA);
    Elm_Object_Item *glit;
 
    assert(pl != NULL);
-   assert(part_name != NULL);
-
-   part = gm_part_add(ap.project, pl->group, part_name);
+   assert(part != NULL);
 
    glit = elm_genlist_item_append(pl->genlist,
                                   pl->itc_part,
@@ -609,10 +603,6 @@ _editor_part_added_cb(void *data,
                                   ELM_GENLIST_ITEM_TREE,
                                   NULL,
                                   NULL);
-
-   /* callback should be called before selection to allow some additional 
loading */
-   evas_object_smart_callback_call(ap.win, SIGNAL_PART_ADDED, (void *)part);
-
    elm_genlist_item_selected_set(glit, true);
 }
 
@@ -1607,7 +1597,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_ADDED, 
_editor_part_added_cb, pl);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_DELETED, 
_editor_part_deleted_cb, pl);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_ADDED, 
_editor_part_item_added_cb, pl);
    evas_object_smart_callback_add(ap.win, SIGNAL_EDITOR_PART_ITEM_DELETED, 
_editor_part_item_deleted_cb, pl);
diff --git a/src/bin/ui/group_navigator.h b/src/bin/ui/group_navigator.h
index dfd04f7..fb0f11f 100644
--- a/src/bin/ui/group_navigator.h
+++ b/src/bin/ui/group_navigator.h
@@ -87,4 +87,8 @@ group_navigator_part_select(Evas_Object *obj, Part_ *part);
  */
 void
 group_navigator_part_update(Evas_Object *obj, Part_ *part);
+
+
+void
+group_navigator_part_add(Evas_Object *obj, Part_ *part);
 #endif /* GROUP_NAVIGATOR_H */
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index 5005943..3d8d789 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -202,18 +202,6 @@ _property_attribute_changed(void *data __UNUSED__,
 }
 
 static void
-_part_added(void *data __UNUSED__,
-            Evas_Object *obj __UNUSED__,
-            void *ei)
-{
-   Part_ *part = ei;
-
-   assert(tabs.current_workspace != NULL);
-
-   workspace_edit_object_part_add(tabs.current_workspace, part);
-}
-
-static void
 _part_item_added(void *data __UNUSED__,
                  Evas_Object *obj __UNUSED__,
                  void *ei __UNUSED__)
@@ -332,6 +320,20 @@ _project_closed(void *data __UNUSED__,
    tabs_menu_tab_open(TAB_LAST);
 }
 
+static void
+_editor_part_added_cb(void *data __UNUSED__,
+                      Evas_Object *obj __UNUSED__,
+                      void *event_info)
+{
+   Eina_Stringshare *part_name = event_info;
+
+   assert(part_name != NULL);
+   assert(tabs.current_group != NULL);
+   assert(tabs.current_workspace != NULL);
+
+   workspace_part_add(tabs.current_workspace, part_name);
+}
+
 Evas_Object *
 tabs_add(void)
 {
@@ -414,7 +416,6 @@ tabs_add(void)
    elm_object_item_disabled_set(tabs.menu.item_colorclass, true);
 
    evas_object_smart_callback_add(ap.win, SIGNAL_PROPERTY_ATTRIBUTE_CHANGED, 
_property_attribute_changed, NULL);
-   evas_object_smart_callback_add(ap.win, SIGNAL_PART_ADDED, _part_added, 
NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_PART_DELETED, _part_deleted, 
NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_PART_RENAMED, _part_renamed, 
NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_PART_UNSELECTED, 
_part_unselected, NULL);
@@ -424,6 +425,15 @@ tabs_add(void)
    evas_object_smart_callback_add(ap.win, SIGNAL_PROJECT_OPENED, 
_project_opened, NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_PROJECT_CLOSED, 
_project_closed, 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_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);
+
    return tabs.layout;
 }
 
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index c20f256..292fa36 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -1730,15 +1730,6 @@ workspace_edit_object_soft_update(Evas_Object *obj)
 }
 
 Eina_Bool
-workspace_edit_object_part_add(Evas_Object *obj, Part_ *part)
-{
-   WS_DATA_GET(obj, sd);
-   assert(part != NULL);
-
-   return groupedit_edit_object_part_add(sd->groupedit, part);
-}
-
-Eina_Bool
 workspace_edit_object_part_del(Evas_Object *obj, Part_ *part)
 {
    WS_DATA_GET(obj, sd);
@@ -1900,3 +1891,15 @@ workspace_edit_object_part_item_selected_set(Evas_Object 
*obj,
    groupedit_edit_object_part_item_selected_set(sd->groupedit, item_name, 
selected);
    return true;
 }
+
+void
+workspace_part_add(Evas_Object *obj, Eina_Stringshare *part_name)
+{
+   Part_ *part;
+   WS_DATA_GET(obj, sd);
+   assert(part_name != NULL);
+
+   part = gm_part_add(ap.project, sd->group, part_name);
+   groupedit_edit_object_part_add(sd->groupedit, part);
+   group_navigator_part_add(sd->group_navigator, part);
+}
diff --git a/src/bin/ui/workspace/workspace.h b/src/bin/ui/workspace/workspace.h
index ad095b3..21b63b9 100644
--- a/src/bin/ui/workspace/workspace.h
+++ b/src/bin/ui/workspace/workspace.h
@@ -106,17 +106,17 @@ void
 workspace_groupview_hard_update(Evas_Object *obj);
 
 /**
- * Add new part into style, which currently loaded into workspace.
+ * Add new part to group_edit and group_navigator.
+ * Part should be already added to edit_object.
  *
  * @param obj The workspace object.
- * @param part Pointer to Part_ structure.
- *
- * @return EINA_FALSE on failure, EINA_TRUE on success.
+ * @param part_name name of added part
  *
  * @ingroup Workspace
  */
-Eina_Bool
-workspace_edit_object_part_add(Evas_Object *obj, Part_ *part);
+void
+workspace_part_add(Evas_Object *obj, Eina_Stringshare *part_name);
+
 /**
  * Delete part from style, which currently loaded into workspace.
  *

-- 


Reply via email to