forked from enlightenment/enlightenment
sry, changed the history eet format. better now than later
SVN revision: 48564
This commit is contained in:
parent
575217b9f6
commit
d908276143
|
@ -448,8 +448,6 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
|||
|
||||
EINA_LIST_FOREACH(he->items, l, hi)
|
||||
{
|
||||
if (hi->plugin != p->base.name)
|
||||
continue;
|
||||
app = NULL;
|
||||
|
||||
/* ignore executables for parameter */
|
||||
|
@ -704,7 +702,12 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
if (!input && !plugin->items)
|
||||
{
|
||||
if (!p->apps_hist)
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
||||
{
|
||||
History_Types *ht;
|
||||
ht = evry_history_types_get(evry_hist->subjects, EVRY_TYPE_APP);
|
||||
if (ht)
|
||||
eina_hash_foreach(ht->types, _hist_items_add_cb, p);
|
||||
}
|
||||
else
|
||||
_add_desktop_list(p, p->apps_hist, NULL);
|
||||
}
|
||||
|
|
|
@ -92,84 +92,6 @@ static Eina_Bool clear_cache = EINA_FALSE;
|
|||
static void _cleanup(Evry_Plugin *plugin);
|
||||
static Eina_Bool _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata);
|
||||
|
||||
/* static E_Config_DD *cache_item_edd = NULL;
|
||||
* static E_Config_DD *cache_edd = NULL;
|
||||
*
|
||||
* static void
|
||||
* _cache_init(void)
|
||||
* {
|
||||
* #undef T
|
||||
* #undef D
|
||||
* cache_item_edd = E_CONFIG_DD_NEW("Cache_Item", Cache_Item);
|
||||
* #define T History_Item
|
||||
* #define D hist_item_edd
|
||||
* E_CONFIG_VAL(D, T, last_used, DOUBLE);
|
||||
* E_CONFIG_VAL(D, T, mime, STR);
|
||||
* #undef T
|
||||
* #undef D
|
||||
* cache_edd = E_CONFIG_DD_NEW("File_Cache", File_Cache);
|
||||
* #define T Evry_History
|
||||
* #define D hist_edd
|
||||
* E_CONFIG_VAL(D, T, version, INT);
|
||||
* E_CONFIG_HASH(D, T, files, hist_item_edd);
|
||||
* #undef T
|
||||
* #undef D
|
||||
* }
|
||||
*
|
||||
* static Eina_Bool
|
||||
* _cache_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
* {
|
||||
* Cache_Item *ci = data;
|
||||
*
|
||||
* eina_stringshare_del(ci->mime);
|
||||
* E_FREE(ci);
|
||||
*
|
||||
* return 1;
|
||||
* }
|
||||
*
|
||||
* static void
|
||||
* _cache_free(void)
|
||||
* {
|
||||
* Cleanup_Data *d;
|
||||
* char *key;
|
||||
*
|
||||
* _cache = e_config_domain_load("module.everything.filecache", cache_edd);
|
||||
*
|
||||
* if (_cache)
|
||||
* {
|
||||
* Eina_List *keys = NULL
|
||||
* if (_cache->files)
|
||||
* {
|
||||
* eina_hash_foreach(_cache->items, _cache_cleanup_cb, &keys);
|
||||
* EINA_LIST_FREE(keys, key)
|
||||
* eina_hash_del_by_key(evry_hist->subjects, key);
|
||||
* }
|
||||
*
|
||||
* _cache_unload();
|
||||
* }
|
||||
*
|
||||
* E_CONFIG_DD_FREE(cache_item_edd);
|
||||
* E_CONFIG_DD_FREE(cache_edd);
|
||||
* }
|
||||
*
|
||||
* static void
|
||||
* _cache_load(void)
|
||||
* {
|
||||
* if (_cache) return;
|
||||
*
|
||||
* _cache = e_config_domain_load("module.everything.filecache", cache_edd);
|
||||
*
|
||||
* if (!_cache)
|
||||
* {
|
||||
* _cache = E_NEW(File_Cache, 1);
|
||||
* evry_hist->version = 1;
|
||||
* }
|
||||
* if (!_cache->files)
|
||||
* _cache->files = eina_hash_string_superfast_new(NULL);
|
||||
* } */
|
||||
|
||||
|
||||
|
||||
static void
|
||||
_item_fill(Evry_Item_File *file)
|
||||
{
|
||||
|
@ -332,29 +254,32 @@ _append_files(Plugin *p)
|
|||
{
|
||||
int match;
|
||||
int cnt = 0;
|
||||
Evry_Item_File *file;
|
||||
Evry_Item *it;
|
||||
Eina_List *l;
|
||||
|
||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||
|
||||
EINA_LIST_FOREACH(p->files, l, file)
|
||||
EINA_LIST_FOREACH(p->files, l, it)
|
||||
{
|
||||
if (cnt >= MAX_SHOWN) break;
|
||||
|
||||
if (p->dirs_only && !EVRY_ITEM(file)->browseable)
|
||||
if (p->dirs_only && !it->browseable)
|
||||
continue;
|
||||
|
||||
if (p->input && (match = evry_fuzzy_match(EVRY_ITEM(file)->label, p->input)))
|
||||
if (p->input && (match = evry_fuzzy_match(it->label, p->input)))
|
||||
{
|
||||
EVRY_ITEM(file)->fuzzy_match = match;
|
||||
EVRY_ITEM(file)->priority = cnt++;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, file);
|
||||
|
||||
it->fuzzy_match = match;
|
||||
if (!it->browseable)
|
||||
it->priority = 1;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
cnt++;
|
||||
}
|
||||
else if (!p->input)
|
||||
{
|
||||
EVRY_ITEM(file)->priority = cnt++;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, file);
|
||||
if (!it->browseable)
|
||||
it->priority = 1;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
return cnt;
|
||||
|
@ -416,9 +341,12 @@ _scan_end_func(void *data)
|
|||
Eina_List *l, *ll, *lll;
|
||||
History_Item *hi;
|
||||
History_Entry *he;
|
||||
const char *type = evry_type_get(EVRY_TYPE_FILE);
|
||||
History_Types *ht = NULL;
|
||||
int cnt = 0;
|
||||
|
||||
if (_conf->cache_dirs)
|
||||
ht = evry_history_types_get(evry_hist->subjects, EVRY_TYPE_FILE);
|
||||
|
||||
if (!d->run_cnt)
|
||||
{
|
||||
EINA_LIST_FOREACH_SAFE(d->files, l, ll, item)
|
||||
|
@ -451,13 +379,11 @@ _scan_end_func(void *data)
|
|||
file->mime = eina_stringshare_ref(_mime_dir);
|
||||
|
||||
/* check if we can grab the mimetype from history */
|
||||
if ((_conf->cache_dirs && !file->mime) &&
|
||||
(he = eina_hash_find(evry_hist->subjects, file->path)))
|
||||
if ((!file->mime && _conf->cache_dirs && ht) &&
|
||||
(he = eina_hash_find(ht->types, file->path)))
|
||||
{
|
||||
EINA_LIST_FOREACH(he->items, lll, hi)
|
||||
{
|
||||
if (hi->type != type) continue;
|
||||
|
||||
if (hi->data)
|
||||
{
|
||||
file->mime = eina_stringshare_ref(hi->data);
|
||||
|
@ -490,7 +416,9 @@ _scan_end_func(void *data)
|
|||
{
|
||||
d->run_cnt++;
|
||||
d->files = eina_list_sort(d->files, -1, _cb_sort);
|
||||
p->thread = ecore_thread_run(_scan_mime_func, _scan_end_func, _scan_cancel_func, d);
|
||||
p->thread = ecore_thread_run(_scan_mime_func,
|
||||
_scan_end_func,
|
||||
_scan_cancel_func, d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -513,28 +441,36 @@ _scan_end_func(void *data)
|
|||
if (d->files)
|
||||
{
|
||||
d->run_cnt++;
|
||||
p->thread = ecore_thread_run(_scan_mime_func, _scan_end_func, _scan_cancel_func, d);
|
||||
p->thread = ecore_thread_run(_scan_mime_func,
|
||||
_scan_end_func,
|
||||
_scan_cancel_func, d);
|
||||
}
|
||||
}
|
||||
|
||||
if (!d->files)
|
||||
{
|
||||
p->files = eina_list_sort(p->files, -1, _cb_sort);
|
||||
|
||||
if (_conf->cache_dirs)
|
||||
{
|
||||
EINA_LIST_REVERSE_FOREACH(p->files, l, item)
|
||||
EINA_LIST_FOREACH(p->files, l, item)
|
||||
{
|
||||
GET_FILE(file, item);
|
||||
|
||||
if (!item->usage && (hi = evry_history_add(evry_hist->subjects, item, NULL, NULL)))
|
||||
if (!item->usage && (hi = evry_history_add(evry_hist->subjects,
|
||||
item, NULL, NULL)))
|
||||
{
|
||||
hi->last_used -= (ONE_DAY * 6.0);
|
||||
hi->last_used = ecore_time_get() -
|
||||
((ONE_DAY * 6.0) + (0.001 * (double) cnt++));
|
||||
hi->usage = TIME_FACTOR(hi->last_used);
|
||||
hi->data = eina_stringshare_ref(file->mime);
|
||||
item->hi = hi;
|
||||
}
|
||||
else if (item->hi && item->hi->count == 1)
|
||||
{
|
||||
item->hi->last_used = ecore_time_get() - (ONE_DAY * 6.0);
|
||||
item->hi->last_used = ecore_time_get() -
|
||||
((ONE_DAY * 6.0) + (0.001 * (double) cnt++));
|
||||
item->hi->usage = TIME_FACTOR(hi->last_used);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,8 +480,6 @@ _scan_end_func(void *data)
|
|||
p->thread = NULL;
|
||||
}
|
||||
|
||||
p->files = eina_list_sort(p->files, -1, _cb_sort);
|
||||
|
||||
_append_files(p);
|
||||
|
||||
evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD);
|
||||
|
@ -690,7 +624,11 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
|
||||
if (clear_cache)
|
||||
{
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
||||
History_Types *ht = evry_history_types_get(evry_hist->subjects, EVRY_TYPE_FILE);
|
||||
if (ht)
|
||||
{
|
||||
eina_hash_foreach(ht->types, _hist_items_add_cb, p);
|
||||
}
|
||||
clear_cache = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -863,14 +801,10 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
|||
Plugin *p = fdata;
|
||||
Eina_List *l, *ll;
|
||||
Evry_Item_File *file;
|
||||
const char *type = evry_type_get(EVRY_TYPE_FILE);
|
||||
double last_used = 0.0;
|
||||
|
||||
EINA_LIST_FOREACH(he->items, l, hi2)
|
||||
{
|
||||
if (hi2->type != type)
|
||||
continue;
|
||||
|
||||
if (hi2->last_used > last_used)
|
||||
hi = hi2;
|
||||
}
|
||||
|
@ -880,9 +814,15 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
|||
|
||||
if (clear_cache)
|
||||
{
|
||||
printf("clear item %s\n", (char *)key);
|
||||
|
||||
/* transient marks them for deletion */
|
||||
if (hi->count && (hi->last_used < ecore_time_get() - (5 * ONE_DAY)))
|
||||
hi->count--;
|
||||
{
|
||||
hi->transient = 1;
|
||||
hi->count--;
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -896,7 +836,7 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
|
|||
}
|
||||
|
||||
|
||||
DBG("add %s %s %s", hi->type, type, (char *) key);
|
||||
DBG("add %s", (char *) key);
|
||||
|
||||
EINA_LIST_FOREACH(p->files, ll, file)
|
||||
if (!strcmp(file->path, key))
|
||||
|
@ -1075,8 +1015,13 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
(input && strlen(input) > 2)) ||
|
||||
(_conf->show_recent)))
|
||||
{
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_items_add_cb, p);
|
||||
p->thread2 = ecore_thread_run(_hist_func, _hist_end_func, _hist_cancel_func, p);
|
||||
History_Types *ht = evry_history_types_get(evry_hist->subjects, EVRY_TYPE_FILE);
|
||||
if (ht)
|
||||
{
|
||||
eina_hash_foreach(ht->types, _hist_items_add_cb, p);
|
||||
p->thread2 = ecore_thread_run(_hist_func, _hist_end_func,
|
||||
_hist_cancel_func, p);
|
||||
}
|
||||
}
|
||||
else if ((_conf->search_recent || _conf->search_cache) &&
|
||||
(p->hist_added && (!input || (strlen(input) < 3))))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "e.h"
|
||||
|
||||
#define EVRY_API_VERSION 11
|
||||
#define EVRY_API_VERSION 12
|
||||
|
||||
#define EVRY_ACTION_OTHER 0
|
||||
#define EVRY_ACTION_FINISHED 1
|
||||
|
@ -52,6 +52,7 @@ typedef struct _Evry_State Evry_State;
|
|||
typedef struct _Evry_View Evry_View;
|
||||
typedef struct _History Evry_History;
|
||||
typedef struct _History_Entry History_Entry;
|
||||
typedef struct _History_Types History_Types;
|
||||
typedef struct _History_Item History_Item;
|
||||
typedef struct _Config Evry_Config;
|
||||
typedef struct _Plugin_Config Plugin_Config;
|
||||
|
@ -412,6 +413,11 @@ struct _History_Entry
|
|||
Eina_List *items;
|
||||
};
|
||||
|
||||
struct _History_Types
|
||||
{
|
||||
Eina_Hash *types;
|
||||
};
|
||||
|
||||
struct _History
|
||||
{
|
||||
int version;
|
||||
|
@ -425,7 +431,6 @@ struct _History
|
|||
struct _History_Item
|
||||
{
|
||||
const char *plugin;
|
||||
const char *type;
|
||||
const char *context;
|
||||
const char *input;
|
||||
double last_used;
|
||||
|
@ -478,6 +483,7 @@ EAPI void evry_history_load(void);
|
|||
EAPI void evry_history_unload(void);
|
||||
EAPI History_Item *evry_history_add(Eina_Hash *hist, Evry_Item *it, const char *ctxt, const char *input);
|
||||
EAPI int evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt);
|
||||
EAPI History_Types *evry_history_types_get(Eina_Hash *hist, Evry_Type type);
|
||||
|
||||
EAPI Evry_Plugin *evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, const char *icon,
|
||||
Evry_Type item_type,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "e_mod_main.h"
|
||||
|
||||
#define HISTORY_VERSION 8
|
||||
#define HISTORY_VERSION 10
|
||||
|
||||
#define SEVEN_DAYS 604800
|
||||
#define SEVEN_DAYS 604800.0
|
||||
|
||||
#define TIME_FACTOR(_now) (1.0 - (evry_hist->begin / _now)) / 1000000000000000.0
|
||||
|
||||
|
@ -18,6 +18,7 @@ struct _Cleanup_Data
|
|||
|
||||
static E_Config_DD *hist_entry_edd = NULL;
|
||||
static E_Config_DD *hist_item_edd = NULL;
|
||||
static E_Config_DD *hist_types_edd = NULL;
|
||||
static E_Config_DD *hist_edd = NULL;
|
||||
|
||||
Evry_History *evry_hist = NULL;
|
||||
|
@ -37,7 +38,6 @@ evry_history_init(void)
|
|||
E_CONFIG_VAL(D, T, usage, DOUBLE);
|
||||
E_CONFIG_VAL(D, T, count, INT);
|
||||
E_CONFIG_VAL(D, T, transient, INT);
|
||||
E_CONFIG_VAL(D, T, type, STR);
|
||||
E_CONFIG_VAL(D, T, data, STR);
|
||||
#undef T
|
||||
#undef D
|
||||
|
@ -46,20 +46,26 @@ evry_history_init(void)
|
|||
#define D hist_entry_edd
|
||||
E_CONFIG_LIST(D, T, items, hist_item_edd);
|
||||
#undef T
|
||||
#undef D
|
||||
hist_types_edd = E_CONFIG_DD_NEW("History_Types", History_Types);
|
||||
#define T History_Types
|
||||
#define D hist_types_edd
|
||||
E_CONFIG_HASH(D, T, types, hist_entry_edd);
|
||||
#undef T
|
||||
#undef D
|
||||
hist_edd = E_CONFIG_DD_NEW("History", Evry_History);
|
||||
#define T Evry_History
|
||||
#define D hist_edd
|
||||
E_CONFIG_VAL(D, T, version, INT);
|
||||
E_CONFIG_VAL(D, T, begin, DOUBLE);
|
||||
E_CONFIG_HASH(D, T, subjects, hist_entry_edd);
|
||||
E_CONFIG_HASH(D, T, actions, hist_entry_edd);
|
||||
E_CONFIG_HASH(D, T, subjects, hist_types_edd);
|
||||
E_CONFIG_HASH(D, T, actions, hist_types_edd);
|
||||
#undef T
|
||||
#undef D
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_hist_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
_hist_entry_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
{
|
||||
History_Entry *he = data;
|
||||
History_Item *hi;
|
||||
|
@ -72,19 +78,34 @@ _hist_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
|||
eina_stringshare_del(hi->plugin);
|
||||
if (hi->context)
|
||||
eina_stringshare_del(hi->context);
|
||||
if (hi->type)
|
||||
eina_stringshare_del(hi->type);
|
||||
if (hi->data)
|
||||
eina_stringshare_del(hi->data);
|
||||
E_FREE(hi);
|
||||
}
|
||||
|
||||
E_FREE(he);
|
||||
return 1;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
_hist_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
{
|
||||
History_Types *ht = data;
|
||||
|
||||
if (ht->types)
|
||||
{
|
||||
eina_hash_foreach(ht->types, _hist_entry_free_cb, NULL);
|
||||
eina_hash_free(ht->types);
|
||||
}
|
||||
|
||||
E_FREE(ht);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_hist_entry_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
{
|
||||
History_Entry *he = data;
|
||||
Cleanup_Data *d = fdata;
|
||||
|
@ -93,56 +114,10 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata
|
|||
|
||||
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
|
||||
{
|
||||
/* item for this plugi nneed to be removed, e.g. on updates */
|
||||
if (d->plugin)
|
||||
{
|
||||
if (hi->plugin == d->plugin)
|
||||
hi->transient = 1;
|
||||
}
|
||||
|
||||
if (hi->last_used < d->time - SEVEN_DAYS)
|
||||
{
|
||||
hi->count--;
|
||||
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");
|
||||
}
|
||||
else if (!strcmp(hi->plugin, "Actions"))
|
||||
{
|
||||
if (hi->type) eina_stringshare_del(hi->type);
|
||||
hi->type = eina_stringshare_add("ACTION");
|
||||
}
|
||||
hi->last_used = d->time - SEVEN_DAYS/2.0;
|
||||
}
|
||||
|
||||
/* item is transient or too old */
|
||||
|
@ -154,11 +129,10 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata
|
|||
eina_stringshare_del(hi->plugin);
|
||||
if (hi->context)
|
||||
eina_stringshare_del(hi->context);
|
||||
if (hi->type)
|
||||
eina_stringshare_del(hi->type);
|
||||
if (hi->data)
|
||||
eina_stringshare_del(hi->data);
|
||||
E_FREE(hi);
|
||||
printf("remove %s\n", (char *) key);
|
||||
|
||||
he->items = eina_list_remove_list(he->items, l);
|
||||
}
|
||||
|
@ -170,41 +144,50 @@ _hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata
|
|||
d->keys = eina_list_append(d->keys, key);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_hist_cleanup_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
|
||||
{
|
||||
History_Types *ht = data;
|
||||
Cleanup_Data *d = fdata;
|
||||
|
||||
eina_hash_foreach(ht->types, _hist_entry_cleanup_cb, fdata);
|
||||
|
||||
EINA_LIST_FREE(d->keys, key)
|
||||
eina_hash_del_by_key(ht->types, key);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
void
|
||||
evry_history_free(void)
|
||||
{
|
||||
Cleanup_Data *d;
|
||||
char *key;
|
||||
|
||||
evry_hist = e_config_domain_load("module.everything.history", hist_edd);
|
||||
evry_hist = e_config_domain_load("module.everything.cache", hist_edd);
|
||||
if (evry_hist)
|
||||
{
|
||||
d = E_NEW(Cleanup_Data, 1);
|
||||
d->time = ecore_time_get();
|
||||
|
||||
if (evry_hist->subjects)
|
||||
{
|
||||
{
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, d);
|
||||
EINA_LIST_FREE(d->keys, key)
|
||||
eina_hash_del_by_key(evry_hist->subjects, key);
|
||||
}
|
||||
|
||||
if (evry_hist->actions)
|
||||
{
|
||||
eina_hash_foreach(evry_hist->actions, _hist_cleanup_cb, d);
|
||||
EINA_LIST_FREE(d->keys, key)
|
||||
eina_hash_del_by_key(evry_hist->actions, key);
|
||||
}
|
||||
|
||||
|
||||
E_FREE(d);
|
||||
evry_history_unload();
|
||||
}
|
||||
|
||||
E_CONFIG_DD_FREE(hist_item_edd);
|
||||
E_CONFIG_DD_FREE(hist_entry_edd);
|
||||
E_CONFIG_DD_FREE(hist_types_edd);
|
||||
E_CONFIG_DD_FREE(hist_edd);
|
||||
}
|
||||
|
||||
|
@ -213,7 +196,7 @@ evry_history_load(void)
|
|||
{
|
||||
if (evry_hist) return;
|
||||
|
||||
evry_hist = e_config_domain_load("module.everything.history", hist_edd);
|
||||
evry_hist = e_config_domain_load("module.everything.cache", hist_edd);
|
||||
|
||||
if (evry_hist && evry_hist->version != HISTORY_VERSION)
|
||||
{
|
||||
|
@ -230,7 +213,7 @@ evry_history_load(void)
|
|||
{
|
||||
evry_hist = E_NEW(Evry_History, 1);
|
||||
evry_hist->version = HISTORY_VERSION;
|
||||
evry_hist->begin = ecore_time_get();
|
||||
evry_hist->begin = ecore_time_get() - SEVEN_DAYS;
|
||||
}
|
||||
if (!evry_hist->subjects)
|
||||
evry_hist->subjects = eina_hash_string_superfast_new(NULL);
|
||||
|
@ -246,7 +229,7 @@ evry_history_unload(void)
|
|||
{
|
||||
if (!evry_hist) return;
|
||||
|
||||
e_config_domain_save("module.everything.history", hist_edd, evry_hist);
|
||||
e_config_domain_save("module.everything.cache", hist_edd, evry_hist);
|
||||
|
||||
eina_hash_foreach(evry_hist->subjects, _hist_free_cb, NULL);
|
||||
eina_hash_foreach(evry_hist->actions, _hist_free_cb, NULL);
|
||||
|
@ -257,10 +240,34 @@ evry_history_unload(void)
|
|||
evry_hist = NULL;
|
||||
}
|
||||
|
||||
EAPI History_Types *
|
||||
evry_history_types_get(Eina_Hash *hist, Evry_Type _type)
|
||||
{
|
||||
History_Types *ht;
|
||||
const char *type = evry_type_get(_type);
|
||||
|
||||
if (!type)
|
||||
return NULL;
|
||||
|
||||
ht = eina_hash_find(hist, type);
|
||||
|
||||
if (!ht)
|
||||
{
|
||||
ht = E_NEW(History_Types, 1);
|
||||
eina_hash_add(hist, type, ht);
|
||||
}
|
||||
|
||||
if (!ht->types)
|
||||
ht->types = eina_hash_string_superfast_new(NULL);
|
||||
|
||||
return ht;
|
||||
}
|
||||
|
||||
EAPI History_Item *
|
||||
evry_history_add(Eina_Hash *hist, Evry_Item *it, const char *ctxt, const char *input)
|
||||
{
|
||||
History_Entry *he;
|
||||
History_Types *ht;
|
||||
History_Item *hi = NULL;
|
||||
Eina_List *l;
|
||||
const char *id;
|
||||
|
@ -283,18 +290,19 @@ evry_history_add(Eina_Hash *hist, Evry_Item *it, const char *ctxt, const char *i
|
|||
rem_ctxt = 0;
|
||||
}
|
||||
|
||||
he = eina_hash_find(hist, id);
|
||||
ht = evry_history_types_get(hist, it->type);
|
||||
|
||||
he = eina_hash_find(ht->types, id);
|
||||
if (!he)
|
||||
{
|
||||
he = E_NEW(History_Entry, 1);
|
||||
eina_hash_add(hist, id, he);
|
||||
eina_hash_add(ht->types, id, he);
|
||||
}
|
||||
else
|
||||
{
|
||||
EINA_LIST_FOREACH(he->items, l, hi)
|
||||
if ((hi->plugin == it->plugin->name) &&
|
||||
(!rem_ctxt || (ctxt == hi->context)) &&
|
||||
(type == hi->type))
|
||||
(!rem_ctxt || (ctxt == hi->context)))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -302,8 +310,6 @@ evry_history_add(Eina_Hash *hist, Evry_Item *it, const char *ctxt, const char *i
|
|||
{
|
||||
hi = E_NEW(History_Item, 1);
|
||||
hi->plugin = eina_stringshare_ref(it->plugin->name);
|
||||
if (it->type)
|
||||
hi->type = eina_stringshare_ref(evry_type_get(it->type));
|
||||
he->items = eina_list_append(he->items, hi);
|
||||
}
|
||||
|
||||
|
@ -340,6 +346,7 @@ EAPI int
|
|||
evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt)
|
||||
{
|
||||
History_Entry *he;
|
||||
History_Types *ht;
|
||||
History_Item *hi = NULL;
|
||||
Eina_List *l;
|
||||
int rem_ctxt = 1;
|
||||
|
@ -354,10 +361,15 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
|
|||
|
||||
if (!it->hi)
|
||||
{
|
||||
if (!(he = eina_hash_find(hist, (it->id ? it->id : it->label))))
|
||||
ht = evry_history_types_get(hist, it->type);
|
||||
|
||||
type = evry_type_get(it->type);
|
||||
|
||||
if (!(ht = eina_hash_find(hist, type)))
|
||||
return 0;
|
||||
|
||||
type = evry_type_get(it->type);
|
||||
if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label))))
|
||||
return 0;
|
||||
|
||||
if (it->type == EVRY_TYPE_ACTION)
|
||||
{
|
||||
|
@ -371,9 +383,6 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
|
|||
if (hi->plugin != it->plugin->name)
|
||||
continue;
|
||||
|
||||
if (hi->type != type)
|
||||
continue;
|
||||
|
||||
if (rem_ctxt && ctxt && (hi->context != ctxt))
|
||||
{
|
||||
it->hi = hi;
|
||||
|
@ -411,7 +420,7 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
|
|||
|
||||
if (ctxt && hi->context && (hi->context == ctxt))
|
||||
{
|
||||
it->usage += hi->usage * hi->count * 10;
|
||||
it->usage += hi->usage * hi->count * 10.0;
|
||||
}
|
||||
}
|
||||
else if (evry_conf->history_sort_mode == 1)
|
||||
|
@ -420,7 +429,7 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
|
|||
|
||||
if (ctxt && hi->context && (hi->context == ctxt))
|
||||
{
|
||||
it->usage += hi->usage * hi->count * 10;
|
||||
it->usage += hi->usage * hi->count * 10.0;
|
||||
}
|
||||
}
|
||||
else if (evry_conf->history_sort_mode == 2)
|
||||
|
|
|
@ -35,7 +35,7 @@ struct _Smart_Data
|
|||
Eina_List *items;
|
||||
Item *cur_item;
|
||||
Ecore_Idle_Enterer *idle_enter;
|
||||
Ecore_Idle_Enterer *thumb_idler;
|
||||
Ecore_Timer *thumb_idler;
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord cx, cy, cw, ch;
|
||||
Evas_Coord sx, sy;
|
||||
|
@ -155,7 +155,6 @@ _thumb_idler(void *data)
|
|||
}
|
||||
|
||||
sd->queue = eina_list_remove_list(sd->queue, l);
|
||||
e_util_wakeup();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -402,7 +401,7 @@ _e_smart_reconfigure_do(void *data)
|
|||
evas_object_smart_callback_call(obj, "changed", NULL);
|
||||
|
||||
if (!sd->thumb_idler)
|
||||
sd->thumb_idler = ecore_idle_enterer_before_add(_thumb_idler, sd);
|
||||
sd->thumb_idler = ecore_timer_add(0.01, _thumb_idler, sd);
|
||||
|
||||
sd->update = EINA_TRUE;
|
||||
|
||||
|
@ -440,7 +439,7 @@ _e_smart_del(Evas_Object *obj)
|
|||
if (sd->idle_enter)
|
||||
ecore_idle_enterer_del(sd->idle_enter);
|
||||
if (sd->thumb_idler)
|
||||
ecore_idle_enterer_del(sd->thumb_idler);
|
||||
ecore_timer_del(sd->thumb_idler);
|
||||
if (sd->animator)
|
||||
ecore_animator_del(sd->animator);
|
||||
|
||||
|
@ -877,7 +876,7 @@ _clear_items(Evas_Object *obj)
|
|||
sd->queue = NULL;
|
||||
|
||||
if (sd->thumb_idler)
|
||||
ecore_idle_enterer_del(sd->thumb_idler);
|
||||
ecore_timer_del(sd->thumb_idler);
|
||||
sd->thumb_idler = NULL;
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1389,7 @@ _cb_item_changed(void *data, int type, void *event)
|
|||
sd->queue = eina_list_append(sd->queue, it);
|
||||
|
||||
if (!sd->thumb_idler)
|
||||
sd->thumb_idler = ecore_idle_enterer_before_add(_thumb_idler, sd);
|
||||
sd->thumb_idler = ecore_timer_add(0.01,_thumb_idler, sd);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue