rimmed pushed a commit to branch eflete-1.18.

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

commit e626e1fd90aa9501450d49c8d035941cabbe708e
Author: Vyacheslav Reutskiy <v.reuts...@samsung.com>
Date:   Mon Feb 6 13:06:22 2017 +0200

    project_navigator: made correct display groups like '////'
    
    Fixes T4674
    
    @fix
    
    Change-Id: Ic6d726b8a166da017b01994f1eb8cd51ddbfefce
---
 src/bin/common/widget_list.c               | 22 +++++++++++++++++++++-
 src/bin/project_manager/resource_manager.h |  4 ++++
 src/bin/ui/project_navigator.c             |  3 +++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/src/bin/common/widget_list.c b/src/bin/common/widget_list.c
index b29018a..460a7bc 100644
--- a/src/bin/common/widget_list.c
+++ b/src/bin/common/widget_list.c
@@ -310,6 +310,7 @@ widget_tree_items_get(Eina_List *groups,
    Eina_Stringshare *group_prefix;
    int group_prefix_len;
    Eina_List *l, *lnext;
+   Eina_Bool broken_tree;
 
    assert(prefix != NULL);
    assert(folders_out != NULL);
@@ -323,6 +324,8 @@ widget_tree_items_get(Eina_List *groups,
 
    EINA_LIST_FOREACH(groups, l, group)
      {
+        group->display_name = NULL;
+        broken_tree = false;
         cmp = strncmp(group->name, prefix, prefix_len);
         /* skipping all groups with different prefix */
         if (cmp < 0)
@@ -338,9 +341,24 @@ widget_tree_items_get(Eina_List *groups,
           }
 
         group_prefix = widget_prefix_get(group->name, level, 
&group_prefix_len);
+
+        /* chech the item to correctness before to add to the tree */
         if (group_prefix)
           {
-             *folders_out= eina_list_append(*folders_out, 
eina_stringshare_ref(group_prefix));
+             /* if prefix '/' - it's posible only if groups name starts from
+              * symbol '/' */
+             if ((group_prefix_len == 1) && (group_prefix[0] == '/'))
+               broken_tree = true;
+
+             /* case if group name have successaively two and more '/' symbols 
*/
+             if ((group_prefix[group_prefix_len - 1] == '/') &&
+                 (group_prefix[group_prefix_len - 2] == '/'))
+               broken_tree = true;
+          }
+
+        if (group_prefix && !broken_tree)
+          {
+             *folders_out= eina_list_append(*folders_out, 
eina_stringshare_add(group_prefix));
 
              /* skipping other groups from the same "folder" */
              lnext = l;
@@ -355,6 +373,8 @@ widget_tree_items_get(Eina_List *groups,
           }
         else
           {
+             if (broken_tree)
+               group->display_name = group->name + group_prefix_len - 1;
              *groups_out = eina_list_append(*groups_out, group);
           }
         eina_stringshare_del(group_prefix);
diff --git a/src/bin/project_manager/resource_manager.h 
b/src/bin/project_manager/resource_manager.h
index 38cb4e4..c847104 100644
--- a/src/bin/project_manager/resource_manager.h
+++ b/src/bin/project_manager/resource_manager.h
@@ -125,6 +125,10 @@ struct _Group
 
    Evas_Object *edit_object;  /**< object needed to access group with 
edje_edit functions. Should be NULL if group is not open */
    Resource *current_selected;
+   const char *display_name;  /**< display name for project navi. @note don't
+                                   free this member, because it's a slice of
+                                   full group name (common.name) **/
+
 
    History *history;          /**< history of changes in the group */
 };
diff --git a/src/bin/ui/project_navigator.c b/src/bin/ui/project_navigator.c
index 47b2c04..b8af9f1 100644
--- a/src/bin/ui/project_navigator.c
+++ b/src/bin/ui/project_navigator.c
@@ -66,6 +66,9 @@ _group_item_label_get(void *data,
    const char *pos;
    Group *group = data;
 
+   if (group->display_name)
+     return strdup(group->display_name);
+
    pos = strrchr(group->name, '/');
    if (pos) return strdup(pos + 1);
    else return strdup(group->name);

-- 


Reply via email to