forked from enlightenment/enlightenment
'everything' only show items in aggregator that match input or are in history
when more than one plugin is active SVN revision: 42096
This commit is contained in:
parent
c5507a54dd
commit
b08b15d677
|
@ -279,6 +279,7 @@ evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label, void (*cb_free
|
|||
it->free = cb_free;
|
||||
|
||||
it->ref = 1;
|
||||
it->usage = -1;
|
||||
|
||||
#ifdef CHECK_REFS
|
||||
item_cnt++;
|
||||
|
@ -403,8 +404,6 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
|
|||
/* update aggregator */
|
||||
if (eina_list_count(s->cur_plugins) > 0)
|
||||
{
|
||||
agg->fetch(agg, s->input);
|
||||
|
||||
/* add aggregator */
|
||||
if (!(s->cur_plugins->data == agg))
|
||||
{
|
||||
|
@ -413,6 +412,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
|
|||
if (s->plugin_auto_selected)
|
||||
_evry_plugin_select(s, agg);
|
||||
}
|
||||
agg->fetch(agg, s->input);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1707,8 +1707,8 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
|||
|
||||
if (eina_list_count(s->cur_plugins) > 0)
|
||||
{
|
||||
sel->aggregator->fetch(sel->aggregator, s->input);
|
||||
s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
|
||||
sel->aggregator->fetch(sel->aggregator, s->input);
|
||||
if (s->plugin_auto_selected)
|
||||
_evry_plugin_select(s, NULL);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
Plugin *p = (Plugin *) plugin;
|
||||
Evry_Plugin *pp;
|
||||
Evry_State *s;
|
||||
Eina_List *l, *ll;
|
||||
Eina_List *l, *ll, *lll, *lp;
|
||||
Evry_Item *it;
|
||||
int cnt = 0;
|
||||
Eina_List *items = NULL;
|
||||
|
@ -105,17 +105,16 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
History_Item *hi;
|
||||
const char *id;
|
||||
|
||||
s = p->selector->state;
|
||||
|
||||
EVRY_PLUGIN_ITEMS_FREE(p);
|
||||
|
||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||
cnt += eina_list_count(pp->items);
|
||||
s = p->selector->state;
|
||||
|
||||
/* first is aggregator itself */
|
||||
lp = s->cur_plugins->next;
|
||||
|
||||
if (input[0])
|
||||
{
|
||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||
EINA_LIST_FOREACH(lp, l, pp)
|
||||
{
|
||||
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||
{
|
||||
|
@ -132,53 +131,92 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
}
|
||||
}
|
||||
|
||||
if (!input[0] || eina_list_count(items) < 50)
|
||||
/* always append items of action selector */
|
||||
if (!input[0] && (p->selector == selectors[1]))
|
||||
{
|
||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||
EINA_LIST_FOREACH(lp, l, pp)
|
||||
{
|
||||
for (cnt = 0, ll = pp->items; ll && cnt < 50; ll = ll->next, cnt++)
|
||||
for (cnt = 0, ll = pp->items; ll && cnt < 50; ll = ll->next, cnt++)
|
||||
{
|
||||
if (!items || !eina_list_data_find_list(items, ll->data))
|
||||
{
|
||||
it = ll->data;
|
||||
if (!items || !eina_list_data_find_list(items, ll->data))
|
||||
{
|
||||
it = ll->data;
|
||||
|
||||
evry_item_ref(it);
|
||||
it->fuzzy_match = 0;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
}
|
||||
evry_item_ref(it);
|
||||
it->fuzzy_match = 0;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items) eina_list_free(items);
|
||||
|
||||
EINA_LIST_FOREACH(EVRY_PLUGIN(p)->items, l, it)
|
||||
EINA_LIST_FOREACH(lp, l, pp)
|
||||
{
|
||||
cnt = 1;
|
||||
if (it->usage) continue;
|
||||
|
||||
if (it->plugin->item_id)
|
||||
id = it->plugin->item_id(it->plugin, it);
|
||||
else
|
||||
id = it->label;
|
||||
|
||||
if ((he = eina_hash_find(p->selector->history, id)))
|
||||
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||
{
|
||||
EINA_LIST_FOREACH(he->items, ll, hi)
|
||||
cnt = 1;
|
||||
if (it->usage == 0)
|
||||
continue;
|
||||
|
||||
if ((it->usage > 0) && (!eina_list_data_find_list(items, it)))
|
||||
{
|
||||
if ((hi->plugin == it->plugin->name) &&
|
||||
((!input[0]) || (!input[0] && !hi->input) ||
|
||||
(!strncmp(input, hi->input, strlen(input))) ||
|
||||
(!strncmp(input, hi->input, strlen(hi->input)))))
|
||||
evry_item_ref(it);
|
||||
it->fuzzy_match = 0;
|
||||
items = eina_list_append(items, it);
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (it->plugin->item_id)
|
||||
id = it->plugin->item_id(it->plugin, it);
|
||||
else
|
||||
id = it->label;
|
||||
|
||||
if ((he = eina_hash_find(p->selector->history, id)))
|
||||
{
|
||||
EINA_LIST_FOREACH(he->items, lll, hi)
|
||||
{
|
||||
cnt++;
|
||||
it->usage += hi->last_used;
|
||||
if ((hi->plugin == it->plugin->name) &&
|
||||
((!input[0]) || (!input[0] && !hi->input) ||
|
||||
(!strncmp(input, hi->input, strlen(input))) ||
|
||||
(!strncmp(input, hi->input, strlen(hi->input)))))
|
||||
{
|
||||
cnt++;
|
||||
it->usage += hi->last_used;
|
||||
}
|
||||
}
|
||||
it->usage /= (double)cnt;
|
||||
|
||||
if (!eina_list_data_find_list(items, it))
|
||||
{
|
||||
evry_item_ref(it);
|
||||
it->fuzzy_match = 0;
|
||||
items = eina_list_append(items, it);
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
}
|
||||
}
|
||||
it->usage /= (double)cnt;
|
||||
else it->usage = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE this is kind of weird. list_count returns 2 even if there is
|
||||
only one item in list */
|
||||
if (eina_list_count(lp) == 2)
|
||||
{
|
||||
pp = lp->data;
|
||||
EINA_LIST_FOREACH(pp->items, l, it)
|
||||
{
|
||||
if (!eina_list_data_find_list(items, it))
|
||||
{
|
||||
evry_item_ref(it);
|
||||
it->fuzzy_match = 0;
|
||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (items) eina_list_free(items);
|
||||
|
||||
if (input[0])
|
||||
{
|
||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||
|
|
|
@ -163,10 +163,12 @@ _cleanup(Evry_Plugin *plugin)
|
|||
|
||||
/* TODO popup end func !!!
|
||||
- cleanup hash for open-with plugin */
|
||||
eina_hash_free(added);
|
||||
if (added)
|
||||
eina_hash_free(added);
|
||||
added = NULL;
|
||||
|
||||
eina_hash_free(p->added);
|
||||
if (p->added)
|
||||
eina_hash_free(p->added);
|
||||
|
||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ _cleanup(Evry_Plugin *p)
|
|||
{
|
||||
Ecore_Event_Handler *h;
|
||||
|
||||
eina_hash_free(border_hash);
|
||||
if (border_hash) eina_hash_free(border_hash);
|
||||
border_hash = NULL;
|
||||
|
||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||
|
|
Loading…
Reference in New Issue