fix sorting

SVN revision: 48267
This commit is contained in:
Hannes Janetzek 2010-04-24 01:26:10 +00:00
parent 55ba16a896
commit 4e1d229714
1 changed files with 55 additions and 57 deletions

View File

@ -125,9 +125,6 @@ _fetch(Evry_Plugin *plugin, const char *input)
if (!s || !s->cur_plugins || !s->cur_plugins->next) if (!s || !s->cur_plugins || !s->cur_plugins->next)
return 0; return 0;
/* first is aggregator itself */
lp = s->cur_plugins;
EVRY_PLUGIN_ITEMS_FREE(p); EVRY_PLUGIN_ITEMS_FREE(p);
/* get current 'context' ... */ /* get current 'context' ... */
@ -141,7 +138,23 @@ _fetch(Evry_Plugin *plugin, const char *input)
} }
} }
if (input) lp = s->cur_plugins;
if ((lp) && (eina_list_count(lp) == 1))
{
pp = lp->data;
if (pp->aggregate);
{
EINA_LIST_FOREACH(pp->items, l, it)
{
evry_history_item_usage_set(p->selector->history, it, input, context);
it->fuzzy_match = evry_fuzzy_match(it->label, input);
items = _add_item(p, items, it);
}
}
}
else if (input)
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH(lp, l, pp)
{ {
@ -153,34 +166,36 @@ _fetch(Evry_Plugin *plugin, const char *input)
it->fuzzy_match = evry_fuzzy_match(it->label, input); it->fuzzy_match = evry_fuzzy_match(it->label, input);
if (it->fuzzy_match || p->selector == selectors[2]) if (it->fuzzy_match || p->selector == selectors[2])
{
evry_history_item_usage_set(p->selector->history, it, input, context);
items = _add_item(p, items, it); items = _add_item(p, items, it);
} }
} }
} }
}
/* always append items of action or object selector */ else if ((!input) &&
if ((!input) &&
((p->selector == selectors[1]) || ((p->selector == selectors[1]) ||
(p->selector == selectors[2]))) (p->selector == selectors[2])))
{ {
/* always append items of action or object selector */
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH(lp, l, pp)
{ {
if (!pp->aggregate) continue; if (!pp->aggregate) continue;
cnt = 0; cnt = 0;
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH(pp->items, ll, it)
{ {
if (cnt++ == MAX_ITEMS) break; if (cnt++ == MAX_ITEMS) break;
if (!eina_list_data_find_list(items, it)) if (!eina_list_data_find_list(items, it))
{ {
evry_history_item_usage_set(p->selector->history, it, NULL, context);
it->fuzzy_match = 0; it->fuzzy_match = 0;
items = _add_item(p, items, it); items = _add_item(p, items, it);
} }
} }
} }
} }
else
{
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH(lp, l, pp)
{ {
if (!pp->aggregate) continue; if (!pp->aggregate) continue;
@ -195,22 +210,6 @@ _fetch(Evry_Plugin *plugin, const char *input)
} }
} }
} }
if (lp && ((eina_list_count(lp) == 2) || (!EVRY_PLUGIN(p)->items)))
{
pp = lp->data;
if (pp->aggregate)
{
EINA_LIST_FOREACH(pp->items, l, it)
{
if (!eina_list_data_find_list(items, it))
{
it->fuzzy_match = 0;
items = _add_item(p, items, it);
}
}
}
} }
if (items) eina_list_free(items); if (items) eina_list_free(items);
@ -233,21 +232,20 @@ _fetch(Evry_Plugin *plugin, const char *input)
} }
/* remove duplicates provided by different plugins */ /* remove duplicates provided by different plugins */
EINA_LIST_FOREACH_SAFE(p->base.items, l, ll, it) /* EINA_LIST_FOREACH_SAFE(p->base.items, l, ll, it)
{ * {
for (lll = l->next; lll; lll = lll->next) * EINA_LIST_FOREACH(l->next, lll, it2)
{ * {
it2 = lll->data; * if ((it->plugin->name != it2->plugin->name) &&
if ((it->plugin->name != it2->plugin->name) && * (it->plugin->type_out == it2->plugin->type_out) &&
(it->plugin->type_out == it2->plugin->type_out) && * (it->id == it2->id))
(it->id == it2->id)) * {
{ * p->base.items = eina_list_remove_list(p->base.items, l);
p->base.items = eina_list_remove_list(p->base.items, l); * evry_item_free(it);
evry_item_free(it); * break;
break; * }
} * }
} * } */
}
return 1; return 1;
} }