ajwillia-ms pushed a commit to branch master. http://git.enlightenment.org/tools/edi.git/commit/?id=16ba73c6f720f740279aedbf91b733c621097814
commit 16ba73c6f720f740279aedbf91b733c621097814 Author: Andy Williams <a...@andywilliams.me> Date: Fri Dec 11 13:37:03 2015 +0000 [ui] Smooth file panel scrolling Cache responses to mime lookups so we get can scroll much more smoothly after initial load Author: unixtaker Signed-off-by: Andy Williams <a...@andywilliams.me> --- src/bin/edi_filepanel.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/bin/edi_filepanel.c b/src/bin/edi_filepanel.c index 278c71d..e37b43d 100644 --- a/src/bin/edi_filepanel.c +++ b/src/bin/edi_filepanel.c @@ -150,19 +150,31 @@ _text_get(void *data, Evas_Object *obj EINA_UNUSED, const char *source EINA_UNUS return strdup(basename(data)); } +static Eina_Hash *mime_entries = NULL; + +static Edi_Content_Provider* +_get_provider_from_hashset(const char *filename) +{ + if ( mime_entries == NULL ) mime_entries = eina_hash_string_superfast_new(NULL); + const char *mime = eina_hash_find(mime_entries, filename); + if ( !mime ) + { + mime = efreet_mime_type_get(filename); + eina_hash_add(mime_entries, filename, strdup(mime)); + } + return edi_content_provider_for_mime_get(mime); +} + static Evas_Object * _content_get(void *data, Evas_Object *obj, const char *source) { - Evas_Object *ic; - Edi_Content_Provider *provider; - const char *mime; - if (strcmp(source, "elm.swallow.icon")) return NULL; - mime = efreet_mime_type_get((const char *)data); - provider = edi_content_provider_for_mime_get(mime); + Edi_Content_Provider *provider; + provider = _get_provider_from_hashset((const char *)data); + Evas_Object *ic; ic = elm_icon_add(obj); elm_icon_order_lookup_set(ic, ELM_ICON_LOOKUP_FDO_THEME); if (provider) --