forked from enlightenment/enlightenment
parent
2b83a5816e
commit
03a23598cc
|
@ -10,71 +10,16 @@ struct _Plugin
|
|||
Evry_Selector *selector;
|
||||
};
|
||||
|
||||
static int
|
||||
_cb_sort_recent(const void *data1, const void *data2)
|
||||
{
|
||||
const Evry_Item *it1 = data1;
|
||||
const Evry_Item *it2 = data2;
|
||||
|
||||
/* sort actions matching the subtype always before those matching type*/
|
||||
if ((it1->type == EVRY_TYPE_ACTION) &&
|
||||
(it2->type == EVRY_TYPE_ACTION))
|
||||
{
|
||||
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) &&
|
||||
(act2->it1.type != act2->it1.item->type))
|
||||
return -1;
|
||||
|
||||
if ((act1->it1.type != act1->it1.item->type) &&
|
||||
(act2->it1.type == act2->it1.item->type))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (it1->usage > 0 || it2->usage > 0)
|
||||
{
|
||||
return (it1->usage > it2->usage ? -1 : 1);
|
||||
}
|
||||
|
||||
if ((it1->plugin == it2->plugin) &&
|
||||
(it1->priority - it2->priority))
|
||||
return (it1->priority - it2->priority);
|
||||
|
||||
if (it1->type != EVRY_TYPE_ACTION &&
|
||||
it2->type != EVRY_TYPE_ACTION)
|
||||
{
|
||||
int prio1 = it1->plugin->config->priority;
|
||||
int prio2 = it2->plugin->config->priority;
|
||||
|
||||
if (prio1 - prio2)
|
||||
return (prio1 - prio2);
|
||||
}
|
||||
|
||||
return strcasecmp(it1->label, it2->label);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_cb_sort(const void *data1, const void *data2)
|
||||
{
|
||||
const Evry_Item *it1 = data1;
|
||||
const Evry_Item *it2 = data2;
|
||||
|
||||
if ((it1->type == EVRY_TYPE_ACTION) &&
|
||||
(it2->type == EVRY_TYPE_ACTION))
|
||||
if ((it1->type == EVRY_TYPE_ACTION ||
|
||||
it1->subtype == EVRY_TYPE_ACTION) &&
|
||||
(it2->type == EVRY_TYPE_ACTION ||
|
||||
it2->subtype == EVRY_TYPE_ACTION))
|
||||
{
|
||||
const Evry_Action *act1 = data1;
|
||||
const Evry_Action *act2 = data2;
|
||||
|
@ -130,14 +75,14 @@ _cb_sort(const void *data1, const void *data2)
|
|||
if ((it1->plugin == it2->plugin) &&
|
||||
(it1->priority - it2->priority))
|
||||
return (it1->priority - it2->priority);
|
||||
|
||||
|
||||
if (it1->type != EVRY_TYPE_ACTION &&
|
||||
it2->type != EVRY_TYPE_ACTION)
|
||||
{
|
||||
int prio1 = it1->plugin->config->priority;
|
||||
int prio2 = it2->plugin->config->priority;
|
||||
|
||||
if (prio1 - prio2)
|
||||
|
||||
if (prio1 - prio2)
|
||||
return (prio1 - prio2);
|
||||
}
|
||||
|
||||
|
@ -281,7 +226,11 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||
{
|
||||
if (!eina_list_data_find_list(items, it))
|
||||
items = _add_item(p, items, it);
|
||||
{
|
||||
it->usage = 0;
|
||||
it->fuzzy_match = 0;
|
||||
items = _add_item(p, items, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,14 +238,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
|
||||
if (items) eina_list_free(items);
|
||||
|
||||
if (input)
|
||||
{
|
||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||
}
|
||||
else
|
||||
{
|
||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort_recent);
|
||||
}
|
||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||
|
||||
cnt = 0;
|
||||
EINA_LIST_FOREACH_SAFE(p->base.items, l, ll, it)
|
||||
|
|
Loading…
Reference in New Issue