From 46ada2a38bad83148bc9f9640cc5731e373d0d9c Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Sat, 1 May 2010 15:43:31 +0000 Subject: [PATCH] fix bug causing wrong types set in history. and fix old history in cleanup function SVN revision: 48507 --- src/modules/everything-files/e_mod_main.c | 9 ++++-- src/modules/everything/e_mod_main.c | 2 +- src/modules/everything/evry_history.c | 34 +++++++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/modules/everything-files/e_mod_main.c b/src/modules/everything-files/e_mod_main.c index e985e59e7..b9e7af3f0 100644 --- a/src/modules/everything-files/e_mod_main.c +++ b/src/modules/everything-files/e_mod_main.c @@ -224,9 +224,10 @@ _scan_func(void *data) if (!EVRY_ITEM(file)->browseable) { - if (d->second_run) - usleep(2500); - +#if _BSD_SOURCE || _XOPEN_SOURCE >= 500 + /* let main process do its thing while reading mimetypes */ + usleep(1000); +#endif if ((mime = efreet_mime_type_get(file->path))) { file->mime = mime; @@ -692,6 +693,8 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda if (!hi) return EINA_TRUE; + DBG("add %s %s %s", hi->type, type, (char *) key); + EINA_LIST_FOREACH(p->files, ll, file) if (!strcmp(file->path, key)) return EINA_TRUE; diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index dcf3de9e7..c6f6d25d3 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -84,7 +84,7 @@ evry_type_register(const char *type) EAPI const char * evry_type_get(Evry_Type type) { - const char *ret = eina_list_nth(_evry_types, type - 1); + const char *ret = eina_list_nth(_evry_types, type); if (!ret) return eina_stringshare_add(""); diff --git a/src/modules/everything/evry_history.c b/src/modules/everything/evry_history.c index 90d5f6f4e..a9f7144a4 100644 --- a/src/modules/everything/evry_history.c +++ b/src/modules/everything/evry_history.c @@ -106,6 +106,40 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata hi->last_used = d->time - SEVEN_DAYS/2; } + /* XXX fix history - remove later */ + if (!hi->type || !strcmp(hi->type, "NONE") || !strcmp(hi->type, "")) + { + hi->count = 0; + } + if (hi->count && hi->plugin) + { + if (!strcmp(hi->plugin, "Files")) + { + if (hi->type) eina_stringshare_del(hi->type); + hi->type = eina_stringshare_add("FILE"); + } + else if (!strcmp(hi->plugin, "Tracker")) + { + if (hi->type) eina_stringshare_del(hi->type); + hi->type = eina_stringshare_add("FILE"); + } + else if (!strcmp(hi->plugin, "Applications")) + { + if (hi->type) eina_stringshare_del(hi->type); + hi->type = eina_stringshare_add("APPLICATION"); + } + else if (!strcmp(hi->plugin, "Open With...")) + { + if (hi->type) eina_stringshare_del(hi->type); + hi->type = eina_stringshare_add("APPLICATION"); + } + else if (!strcmp(hi->plugin, "Settings")) + { + if (hi->type) eina_stringshare_del(hi->type); + hi->type = eina_stringshare_add("E_SETTINGS"); + } + } + /* item is transient or too old */ if (!hi->count || hi->transient) {