'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:
Hannes Janetzek 2009-08-30 11:07:10 +00:00
parent c5507a54dd
commit b08b15d677
5 changed files with 90 additions and 50 deletions

View File

@ -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);
}

View File

@ -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,9 +131,10 @@ _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++)
{
@ -150,12 +150,22 @@ _fetch(Evry_Plugin *plugin, const char *input)
}
}
if (items) eina_list_free(items);
EINA_LIST_FOREACH(EVRY_PLUGIN(p)->items, l, it)
EINA_LIST_FOREACH(lp, l, pp)
{
EINA_LIST_FOREACH(pp->items, ll, it)
{
cnt = 1;
if (it->usage) continue;
if (it->usage == 0)
continue;
if ((it->usage > 0) && (!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);
continue;
}
if (it->plugin->item_id)
id = it->plugin->item_id(it->plugin, it);
@ -164,7 +174,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
if ((he = eina_hash_find(p->selector->history, id)))
{
EINA_LIST_FOREACH(he->items, ll, hi)
EINA_LIST_FOREACH(he->items, lll, hi)
{
if ((hi->plugin == it->plugin->name) &&
((!input[0]) || (!input[0] && !hi->input) ||
@ -176,8 +186,36 @@ _fetch(Evry_Plugin *plugin, const char *input)
}
}
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);
}
}
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])
{

View File

@ -163,9 +163,11 @@ _cleanup(Evry_Plugin *plugin)
/* TODO popup end func !!!
- cleanup hash for open-with plugin */
if (added)
eina_hash_free(added);
added = NULL;
if (p->added)
eina_hash_free(p->added);
EVRY_PLUGIN_ITEMS_CLEAR(p);

View File

@ -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);