- fix last commit, need to check where hist item does vanish

- sort actions better



SVN revision: 48550
This commit is contained in:
Hannes Janetzek 2010-05-02 16:16:20 +00:00
parent fc31b50109
commit 3f751f14f9
5 changed files with 42 additions and 10 deletions

View File

@ -464,11 +464,7 @@ _scan_end_func(void *data)
DBG("cached: %s %s", file->mime, file->path);
hi->transient = 0;
item->hi = hi;
/* remember that item was found */
if (hi->count == 1)
{
item->usage = -1;
}
break;
}
}
@ -536,9 +532,9 @@ _scan_end_func(void *data)
hi->data = eina_stringshare_ref(file->mime);
item->hi = hi;
}
else
else if (item->hi && item->hi->count == 1)
{
item->usage = 0;
item->hi->last_used = ecore_time_get() - (ONE_DAY * 6.0);
}
}
}

View File

@ -418,6 +418,8 @@ struct _History
Eina_Hash *subjects;
Eina_Hash *actions;
double begin;
Eina_Bool changed;
};
struct _History_Item

View File

@ -236,6 +236,8 @@ evry_history_load(void)
evry_hist->subjects = eina_hash_string_superfast_new(NULL);
if (!evry_hist->actions)
evry_hist->actions = eina_hash_string_superfast_new(NULL);
evry_hist->changed = EINA_FALSE;
}
@ -268,6 +270,8 @@ evry_history_add(Eina_Hash *hist, Evry_Item *it, const char *ctxt, const char *i
if (!it) return NULL;
evry_hist->changed = EINA_TRUE;
type = evry_type_get(it->type);
id = (it->id ? it->id : it->label);
@ -345,6 +349,9 @@ evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, c
if (!it->plugin->history)
return 0;
if (evry_hist->changed)
it->hi = NULL;
if (!it->hi)
{
if (!(he = eina_hash_find(hist, (it->id ? it->id : it->label))))

View File

@ -91,6 +91,15 @@ _cb_sort(const void *data1, const void *data2)
const Evry_Action *act1 = data1;
const Evry_Action *act2 = data2;
if (act1->remember_context || act2->remember_context)
{
if (act1->remember_context && !act2->remember_context)
return -1;
if (!act1->remember_context && act2->remember_context)
return 1;
}
/* sort type match before subtype match */
if (act1->it1.item && act2->it1.item)
{
if ((act1->it1.type == act1->it1.item->type) &&
@ -101,7 +110,7 @@ _cb_sort(const void *data1, const void *data2)
(act2->it1.type == act2->it1.item->type))
return 1;
}
if (it1->fuzzy_match || it2->fuzzy_match)
if (it1->fuzzy_match || it2->fuzzy_match)

View File

@ -22,7 +22,15 @@ _cb_sort_recent(const void *data1, const void *data2)
{
const Evry_Action *act1 = data1;
const Evry_Action *act2 = data2;
if (act1->remember_context || act2->remember_context)
{
if (act1->remember_context && !act2->remember_context)
return -1;
if (!act1->remember_context && act2->remember_context)
return 1;
}
if (act1->it1.item && act2->it1.item)
{
if ((act1->it1.type == act1->it1.item->type) &&
@ -72,7 +80,15 @@ _cb_sort(const void *data1, const void *data2)
{
const Evry_Action *act1 = data1;
const Evry_Action *act2 = data2;
if (act1->remember_context || act2->remember_context)
{
if (act1->remember_context && !act2->remember_context)
return -1;
if (!act1->remember_context && act2->remember_context)
return 1;
}
if (act1->it1.item && act2->it1.item)
{
if ((act1->it1.type == act1->it1.item->type) &&
@ -293,6 +309,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
p->base.items = eina_list_remove_list(p->base.items, l);
}
evry_hist->changed = EINA_FALSE;
return 1;
}