'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->free = cb_free;
|
||||||
|
|
||||||
it->ref = 1;
|
it->ref = 1;
|
||||||
|
it->usage = -1;
|
||||||
|
|
||||||
#ifdef CHECK_REFS
|
#ifdef CHECK_REFS
|
||||||
item_cnt++;
|
item_cnt++;
|
||||||
|
@ -403,8 +404,6 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
|
||||||
/* update aggregator */
|
/* update aggregator */
|
||||||
if (eina_list_count(s->cur_plugins) > 0)
|
if (eina_list_count(s->cur_plugins) > 0)
|
||||||
{
|
{
|
||||||
agg->fetch(agg, s->input);
|
|
||||||
|
|
||||||
/* add aggregator */
|
/* add aggregator */
|
||||||
if (!(s->cur_plugins->data == agg))
|
if (!(s->cur_plugins->data == agg))
|
||||||
{
|
{
|
||||||
|
@ -413,6 +412,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
|
||||||
if (s->plugin_auto_selected)
|
if (s->plugin_auto_selected)
|
||||||
_evry_plugin_select(s, agg);
|
_evry_plugin_select(s, agg);
|
||||||
}
|
}
|
||||||
|
agg->fetch(agg, s->input);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1707,8 +1707,8 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
||||||
|
|
||||||
if (eina_list_count(s->cur_plugins) > 0)
|
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);
|
s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
|
||||||
|
sel->aggregator->fetch(sel->aggregator, s->input);
|
||||||
if (s->plugin_auto_selected)
|
if (s->plugin_auto_selected)
|
||||||
_evry_plugin_select(s, NULL);
|
_evry_plugin_select(s, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ _cb_sort_recent(const void *data1, const void *data2)
|
||||||
return -1;
|
return -1;
|
||||||
if (it2->usage && !it1->usage)
|
if (it2->usage && !it1->usage)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if ((it1->plugin == action_selector) ||
|
if ((it1->plugin == action_selector) ||
|
||||||
(it2->plugin == action_selector))
|
(it2->plugin == action_selector))
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ _cb_sort_recent(const void *data1, const void *data2)
|
||||||
return (it1->plugin->config->priority -
|
return (it1->plugin->config->priority -
|
||||||
(it2->plugin->config->priority + it2->priority));
|
(it2->plugin->config->priority + it2->priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
return (it1->plugin->config->priority -
|
return (it1->plugin->config->priority -
|
||||||
(it1->plugin->config->priority + it2->priority));
|
(it1->plugin->config->priority + it2->priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((it1->plugin == it2->plugin) &&
|
if ((it1->plugin == it2->plugin) &&
|
||||||
(it1->priority - it2->priority))
|
(it1->priority - it2->priority))
|
||||||
return (it1->priority - it2->priority);
|
return (it1->priority - it2->priority);
|
||||||
|
@ -88,7 +88,7 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
if (it1->priority - it2->priority)
|
if (it1->priority - it2->priority)
|
||||||
return (it1->priority - it2->priority);
|
return (it1->priority - it2->priority);
|
||||||
|
|
||||||
return strcasecmp(it1->label, it2->label);
|
return strcasecmp(it1->label, it2->label);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -97,7 +97,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
Plugin *p = (Plugin *) plugin;
|
Plugin *p = (Plugin *) plugin;
|
||||||
Evry_Plugin *pp;
|
Evry_Plugin *pp;
|
||||||
Evry_State *s;
|
Evry_State *s;
|
||||||
Eina_List *l, *ll;
|
Eina_List *l, *ll, *lll, *lp;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
Eina_List *items = NULL;
|
Eina_List *items = NULL;
|
||||||
|
@ -105,17 +105,16 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
History_Item *hi;
|
History_Item *hi;
|
||||||
const char *id;
|
const char *id;
|
||||||
|
|
||||||
s = p->selector->state;
|
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_FREE(p);
|
EVRY_PLUGIN_ITEMS_FREE(p);
|
||||||
|
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
s = p->selector->state;
|
||||||
cnt += eina_list_count(pp->items);
|
|
||||||
|
|
||||||
|
/* first is aggregator itself */
|
||||||
|
lp = s->cur_plugins->next;
|
||||||
|
|
||||||
if (input[0])
|
if (input[0])
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
EINA_LIST_FOREACH(lp, l, pp)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(pp->items, ll, it)
|
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))
|
if (!items || !eina_list_data_find_list(items, ll->data))
|
||||||
{
|
{
|
||||||
it = ll->data;
|
it = ll->data;
|
||||||
|
|
||||||
evry_item_ref(it);
|
evry_item_ref(it);
|
||||||
it->fuzzy_match = 0;
|
it->fuzzy_match = 0;
|
||||||
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
EVRY_PLUGIN_ITEM_APPEND(p, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items) eina_list_free(items);
|
EINA_LIST_FOREACH(lp, l, pp)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(EVRY_PLUGIN(p)->items, l, it)
|
|
||||||
{
|
{
|
||||||
cnt = 1;
|
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||||
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(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) &&
|
evry_item_ref(it);
|
||||||
((!input[0]) || (!input[0] && !hi->input) ||
|
it->fuzzy_match = 0;
|
||||||
(!strncmp(input, hi->input, strlen(input))) ||
|
items = eina_list_append(items, it);
|
||||||
(!strncmp(input, hi->input, strlen(hi->input)))))
|
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++;
|
if ((hi->plugin == it->plugin->name) &&
|
||||||
it->usage += hi->last_used;
|
((!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])
|
if (input[0])
|
||||||
{
|
{
|
||||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||||
|
@ -187,7 +225,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort_recent);
|
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort_recent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,10 +163,12 @@ _cleanup(Evry_Plugin *plugin)
|
||||||
|
|
||||||
/* TODO popup end func !!!
|
/* TODO popup end func !!!
|
||||||
- cleanup hash for open-with plugin */
|
- cleanup hash for open-with plugin */
|
||||||
eina_hash_free(added);
|
if (added)
|
||||||
|
eina_hash_free(added);
|
||||||
added = NULL;
|
added = NULL;
|
||||||
|
|
||||||
eina_hash_free(p->added);
|
if (p->added)
|
||||||
|
eina_hash_free(p->added);
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ _cleanup(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Ecore_Event_Handler *h;
|
Ecore_Event_Handler *h;
|
||||||
|
|
||||||
eina_hash_free(border_hash);
|
if (border_hash) eina_hash_free(border_hash);
|
||||||
border_hash = NULL;
|
border_hash = NULL;
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
|
@ -452,7 +452,7 @@ static const char *
|
||||||
_item_id(Evry_Plugin *p, const Evry_Item *item)
|
_item_id(Evry_Plugin *p, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
ITEM_FILE(file, item);
|
ITEM_FILE(file, item);
|
||||||
|
|
||||||
return file->uri;
|
return file->uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue