'everything' module:

- core: cleanups
- apps: small optimization


SVN revision: 41693
This commit is contained in:
Hannes Janetzek 2009-08-11 17:03:36 +00:00
parent 01d1ae246e
commit 5e3f6b5179
2 changed files with 62 additions and 85 deletions

View File

@ -688,27 +688,29 @@ _evry_selector_update(Evry_Selector *sel)
Evry_State *s = sel->state; Evry_State *s = sel->state;
Evry_Item *it = NULL; Evry_Item *it = NULL;
if (s && !s->sel_item && s->cur_plugins) if (s)
{ {
/* get first item */ if (s->cur_plugins)
Evry_Plugin *p = s->plugin;
if (!p)
{ {
_evry_select_plugin(s, s->cur_plugins->data); /* get first plugin */
p = s->plugin; if ((!s->plugin) || (!eina_list_data_find(s->cur_plugins, s->plugin)))
_evry_select_plugin(s, s->cur_plugins->data);
} }
else
s->plugin = NULL;
if (p->items)
{
it = p->items->data;
s->item_auto_selected = EINA_TRUE;
_evry_list_item_sel(s, it);
}
}
else if (s && s->sel_item)
{
it = s->sel_item; it = s->sel_item;
if (!it && s->plugin)
{
/* get first item */
if (s->plugin->items)
{
it = s->plugin->items->data;
s->item_auto_selected = EINA_TRUE;
_evry_list_item_sel(s, it);
}
}
} }
_evry_selector_icon_set(sel); _evry_selector_icon_set(sel);
@ -726,7 +728,7 @@ _evry_selector_update(Evry_Selector *sel)
{ {
/* no items for this state - clear selector */ /* no items for this state - clear selector */
edje_object_part_text_set(sel->o_main, "e.text.label", ""); edje_object_part_text_set(sel->o_main, "e.text.label", "");
if (sel == selector && s->plugin) if (sel == selector && s && s->plugin)
edje_object_part_text_set(sel->o_main, "e.text.plugin", s->plugin->name); edje_object_part_text_set(sel->o_main, "e.text.plugin", s->plugin->name);
else else
edje_object_part_text_set(sel->o_main, "e.text.plugin", ""); edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
@ -1367,13 +1369,8 @@ _evry_matches_update(Evry_Selector *sel, Evry_Plugin *plugin)
has_items = p->fetch(p, s->input); has_items = p->fetch(p, s->input);
} }
if ((has_items && eina_list_count(p->items) > 0) || if ((has_items && eina_list_count(p->items) > 0) || (sel->states->next))
(sel->states->next) s->cur_plugins = eina_list_append(s->cur_plugins, p);
/* (p->async_query) */
) /* XXX append in async_update instead?*/
{
s->cur_plugins = eina_list_append(s->cur_plugins, p);
}
} }
if (eina_list_count(s->cur_plugins) > 1) if (eina_list_count(s->cur_plugins) > 1)
@ -1382,17 +1379,6 @@ _evry_matches_update(Evry_Selector *sel, Evry_Plugin *plugin)
s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator); s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
} }
} }
/* TODO do this in separate function ? */
if (s->cur_plugins)
{
if (plugin && !eina_list_data_find(s->cur_plugins, plugin))
s->plugin = s->cur_plugins->data;
}
else
{
s->plugin = NULL;
}
} }
static void static void
@ -2089,7 +2075,6 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
if (!s->plugin) _evry_select_plugin(s, p); if (!s->plugin) _evry_select_plugin(s, p);
} }
/* */
if (eina_list_count(s->cur_plugins) > 1) if (eina_list_count(s->cur_plugins) > 1)
{ {
if (s->plugin == selector->aggregator) if (s->plugin == selector->aggregator)
@ -2097,9 +2082,14 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
selector->aggregator->fetch(selector->aggregator, NULL); selector->aggregator->fetch(selector->aggregator, NULL);
if(!eina_list_data_find(s->cur_plugins, selector->aggregator)) if (!eina_list_data_find(s->cur_plugins, selector->aggregator))
s->cur_plugins = eina_list_prepend(s->cur_plugins, {
selector->aggregator); s->cur_plugins = eina_list_prepend(s->cur_plugins,
selector->aggregator);
_evry_list_clear_list(s);
s->plugin = selector->aggregator;
}
} }
if (list->visible) if (list->visible)
@ -2109,51 +2099,38 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
{ {
p = s->plugin; p = s->plugin;
if ((s->item_auto_selected) && if ((s->item_auto_selected) && (s->plugin->items->data != s->sel_item))
(s->plugin->items->data != s->sel_item))
{ {
s->sel_item = NULL; s->sel_item = NULL;
_evry_selector_update(selector); _evry_selector_update(selector);
} }
/* if (s->plugin == selector->aggregator) if (list->visible)
* _evry_list_clear_list(s); {
* else */ Eina_List *l;
{ Evry_Item *it;
Eina_List *l; evas_event_freeze(list->popup->evas);
Evry_Item *it; e_box_freeze(list->o_list);
evas_event_freeze(list->popup->evas); EINA_LIST_FOREACH(p->items, l, it)
e_box_freeze(list->o_list); if (it->o_bg) e_box_unpack(it->o_bg);
EINA_LIST_FOREACH(p->items, l, it)
if (it->o_bg) e_box_unpack(it->o_bg);
e_box_thaw(list->o_list); e_box_thaw(list->o_list);
evas_event_thaw(list->popup->evas); evas_event_thaw(list->popup->evas);
} }
_evry_list_show_items(s, p); _evry_list_show_items(s, p);
if (list->visible && s->sel_item) if (list->visible && s->sel_item)
{ {
/* TODO check this again!*/ /* TODO check this again!*/
if (s->item_auto_selected ||
!eina_list_data_find(p->items, s->sel_item))
{
_evry_list_item_desel(s, s->sel_item);
s->sel_item = p->items->data;
}
_evry_list_item_sel(s, s->sel_item); _evry_list_item_sel(s, s->sel_item);
_evry_list_scroll_to(s, s->sel_item); _evry_list_scroll_to(s, s->sel_item);
} }
} }
/* else if (/\*s->plugin_auto_selected &&*\/ p->trigger &&
* (!strncmp(s->input, p->trigger, strlen(p->trigger))))
* {
* _evry_list_clear_list(s);
* _evry_list_show_items(s, p);
* } */
else if (s->plugin) else if (s->plugin)
_evry_list_tab_scroll_to(s, s->plugin); {
_evry_list_tab_scroll_to(s, s->plugin);
}
_evry_selector_update(selector); _evry_selector_update(selector);
} }

View File

@ -56,9 +56,6 @@ _begin(Evry_Plugin *p, Evry_Item *it)
inst = E_NEW(Inst, 1); inst = E_NEW(Inst, 1);
} }
if (inst)
inst->apps_all = efreet_util_desktop_name_glob_list("*");
p->private = inst; p->private = inst;
return 1; return 1;
@ -290,9 +287,12 @@ _fetch(Evry_Plugin *p, const char *input)
/* add apps matching input */ /* add apps matching input */
if (input) if (input)
_add_desktop_list(p, inst->apps_all, match1, match2); {
if (!inst->apps_all)
inst->apps_all = efreet_util_desktop_name_glob_list("*");
_add_desktop_list(p, inst->apps_all, match1, match2);
}
/* add exe history items */ /* add exe history items */
else if (!p->items) else if (!p->items)
{ {