filepanel: on tab focus improve visibility.

This patch selects the next best match. Making it easier
to follow the file in use (especially duplicate names).
On expand (next best), it will automatically select
the actual path. Visual and usability improvement.
Thanks Brokenshackles for suggestion.
This commit is contained in:
Alastair Poole 2018-06-06 14:04:09 +01:00
parent 476e71f78f
commit f438e6e62b
1 changed files with 34 additions and 1 deletions

View File

@ -1084,6 +1084,35 @@ _edi_filepanel_select_check(void *data EINA_UNUSED)
return ECORE_CALLBACK_RENEW;
}
static void
_edi_filepanel_select_next_best_path(const char *path)
{
Elm_Object_Item *item;
char *end, *try = strdup(path);
while (1)
{
if (!strcmp(try, edi_project_get()))
break;
end = strrchr(try, '/');
if (!end)
break;
else
*end = '\0';
item = _file_listing_item_find(try);
if (item)
{
elm_genlist_item_selected_set(item, EINA_TRUE);
elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
break;
}
}
free(try);
}
void
edi_filepanel_select_path(const char *path)
{
@ -1091,12 +1120,16 @@ edi_filepanel_select_path(const char *path)
item = _file_listing_item_find(path);
if (!item)
return;
{
_edi_filepanel_select_next_best_path(path);
return;
}
if (elm_genlist_item_selected_get(item))
return;
elm_genlist_item_selected_set(item, EINA_TRUE);
elm_genlist_item_bring_in(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
}
void