edi_filepanel: select on focus.

Use a timer for selecting the file browser item. Click tab and click
browser file work as before. Clicking the editor will focus in the
browser also with an "unnoticable" delay from the timer poll.
This commit is contained in:
Al Poole 2017-11-23 14:51:29 +00:00
parent 099b9c039e
commit 25339554b7
2 changed files with 19 additions and 3 deletions

View File

@ -1025,6 +1025,23 @@ _filter_key_down_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
elm_genlist_filter_set(tree, (void *)strdup(match));
}
Eina_Bool
_edi_filepanel_select_check(void *data EINA_UNUSED)
{
Edi_Mainview_Panel *current;
Edi_Mainview_Item *item;
current = edi_mainview_panel_current_get();
if (!current) return ECORE_CALLBACK_RENEW;
item = edi_mainview_item_current_get(current);
if (!item) return ECORE_CALLBACK_RENEW;
edi_filepanel_select_path(item->path);
return ECORE_CALLBACK_RENEW;
}
void
edi_filepanel_select_path(const char *path)
{
@ -1149,6 +1166,8 @@ edi_filepanel_add(Evas_Object *parent, Evas_Object *win,
edi_filepanel_scm_status_update();
ecore_timer_add(0.1, _edi_filepanel_select_check, NULL);
_root_dir = calloc(1, sizeof(Edi_Dir_Data));
_root_dir->path = path;
_file_listing_fill(_root_dir, NULL);

View File

@ -1203,9 +1203,6 @@ _focused_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
code = elm_code_widget_code_get(editor->entry);
filename = elm_code_file_path_get(code->file);
edi_filepanel_select_path(filename);
mtime = ecore_file_mod_time(filename);
if ((editor->save_time) && (editor->save_time < mtime))