rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=f15e7632ce2b058711f16b4c72b0f454a5aeeaeb
commit f15e7632ce2b058711f16b4c72b0f454a5aeeaeb Author: Vyacheslav Reutskiy <[email protected]> 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/resource_manager/resource_manager2.h | 3 +++ src/bin/ui/project_navigator.c | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/bin/common/widget_list.c b/src/bin/common/widget_list.c index e8219b3..03b8989 100644 --- a/src/bin/common/widget_list.c +++ b/src/bin/common/widget_list.c @@ -447,6 +447,7 @@ widget_tree_items_get(Eina_List *groups, char *group_prefix; int group_prefix_len; Eina_List *l, *lnext; + Eina_Bool broken_tree; assert(prefix != NULL); assert(folders_out != NULL); @@ -460,6 +461,8 @@ widget_tree_items_get(Eina_List *groups, EINA_LIST_FOREACH(groups, l, group) { + group->display_name = NULL; + broken_tree = false; cmp = strncmp(group->common.name, prefix, prefix_len); /* skipping all groups with different prefix */ if (cmp < 0) @@ -475,9 +478,24 @@ widget_tree_items_get(Eina_List *groups, } group_prefix = widget_prefix_get(group->common.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; @@ -492,6 +510,8 @@ widget_tree_items_get(Eina_List *groups, } else { + if (broken_tree) + group->display_name = group->common.name + group_prefix_len - 1; *groups_out = eina_list_append(*groups_out, group); } free(group_prefix); diff --git a/src/bin/resource_manager/resource_manager2.h b/src/bin/resource_manager/resource_manager2.h index 0034478..128a139 100644 --- a/src/bin/resource_manager/resource_manager2.h +++ b/src/bin/resource_manager/resource_manager2.h @@ -107,6 +107,9 @@ struct _Group2 Evas_Object *edit_object; /**< object needed to access group with edje_edit functions. Should be NULL if group is not open */ Resource2 *current_selected; History *history; /**< history of changes in the group */ + 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) **/ }; struct _Part2 diff --git a/src/bin/ui/project_navigator.c b/src/bin/ui/project_navigator.c index f6f491a..bbef7f5 100644 --- a/src/bin/ui/project_navigator.c +++ b/src/bin/ui/project_navigator.c @@ -67,6 +67,9 @@ _group_item_label_get(void *data, const char *pos; Group2 *group = data; + if (group->display_name) + return strdup(group->display_name); + pos = strrchr(group->common.name, '/'); if (pos) return strdup(pos + 1); else return strdup(group->common.name); --
