'everything'

- good ol' x40 revealed some performance issues with dirbrowse. fixed
- renamed state->sel_item to cur_item


SVN revision: 42082
This commit is contained in:
Hannes Janetzek 2009-08-29 04:42:17 +00:00
parent 9deb61f2d1
commit 477a2d2854
7 changed files with 101 additions and 143 deletions

View File

@ -26581,7 +26581,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
/////////////////////////////////////////////////////////////////////////////
/*** MOD: EVERYTHING ***/
/* #define DROP_SHADOW 1 */
#define DROP_SHADOW 1
ICON("everything-launch","icon_advanced.png",64)
@ -27937,14 +27937,14 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "clip";
mouse_events: 0;
type: RECT;
/* clip_to: "base"; */
clip_to: "base";
description { state: "default" 0.0;
rel1.to: "base";
rel2.to: "base";
@ -27989,7 +27989,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
}
part { name: "e.text.label";
type: TEXT;
/* clip_to: "base"; */
clip_to: "base";
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
@ -28046,13 +28046,13 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
program { name: "thumb_show_delayed";
signal: "e,action,thumb,show_delayed";
source: "e";
action: STATE_SET "default" 0.1;
action: STATE_SET "default" 0.0;
target: "base";
after: "thumb_show_delayed2";
}
program { name: "thumb_show_delayed2";
action: STATE_SET "visible" 0.0;
transition: SINUSOIDAL 0.2;
transition: SINUSOIDAL 0.3;
target: "base";
}
program { name: "thumb_show";
@ -28112,14 +28112,14 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "clip";
mouse_events: 0;
type: RECT;
/* clip_to: "base"; */
clip_to: "base";
description { state: "default" 0.0;
rel1 {
@ -28173,7 +28173,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
rel1 {
to: "base";
relative: 1.0 0.0;
offset: 1 6;
offset: -6 6;
}
rel2 {
to: "base";
@ -28198,7 +28198,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
}
part { name: "e.text.label";
type: TEXT;
/* clip_to: "base"; */
clip_to: "base";
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
@ -28269,13 +28269,13 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
program { name: "thumb_show_delayed";
signal: "e,action,thumb,show_delayed";
source: "e";
action: STATE_SET "default" 0.1;
action: STATE_SET "default" 0.0;
target: "base";
after: "thumb_show_delayed2";
}
program { name: "thumb_show_delayed2";
action: STATE_SET "visible" 0.0;
transition: SINUSOIDAL 0.2;
transition: SINUSOIDAL 0.3;
target: "base";
}
program { name: "thumb_show";

View File

@ -84,6 +84,7 @@ struct _Evry_Item
int fuzzy_match;
/* do not set by plugin! */
Evry_Item *next;
Evry_Plugin *plugin;
int ref;
void (*free) (Evry_Item *item);
@ -160,8 +161,10 @@ struct _Evry_State
Evry_Plugin *plugin;
/* selected item */
Evry_Item *sel_item;
Evry_Item *cur_item;
Eina_List *sel_items;
/* this is for the case when the current plugin was not selected
manually and a higher priority (async) plugin retrieves
candidates, the higher priority plugin is made current */
@ -173,7 +176,7 @@ struct _Evry_State
struct _Evry_View
{
Evry_View *id;
Evry_View *id;
const char *name;
const char *trigger;
int active;
@ -209,14 +212,12 @@ struct _Evry_Action
/* use icon name from theme */
const char *icon;
/* not to be set by plugin! */
Evas_Object *o_icon;
int priority;
};
/* evry.c */
EAPI void evry_item_select(const Evry_State *s, Evry_Item *it);
EAPI void evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark);
EAPI void evry_plugin_select(const Evry_State *s, Evry_Plugin *p);
EAPI int evry_list_win_show(void);
EAPI void evry_list_win_hide(void);

View File

@ -236,7 +236,6 @@ evry_hide(void)
input_window = 0;
}
EAPI void
evry_clear_input(void)
{
@ -316,6 +315,22 @@ evry_item_select(const Evry_State *state, Evry_Item *it)
_evry_selector_update(selector);
}
EAPI void
evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark)
{
Evry_State *s = (Evry_State *)state;
if (mark)
s->sel_items = eina_list_append(s->sel_items, it);
else
s->sel_items = eina_list_remove(s->sel_items, it);
/* s->plugin_auto_selected = EINA_FALSE;
* s->item_auto_selected = EINA_FALSE;
* _evry_item_sel(s, it);
* _evry_selector_update(selector); */
}
EAPI void
evry_item_ref(Evry_Item *it)
{
@ -331,15 +346,12 @@ evry_list_win_show(void)
return 1;
}
EAPI void
evry_list_win_hide(void)
{
_evry_list_win_clear(1);
}
EAPI void
evry_plugin_async_update(Evry_Plugin *p, int action)
{
@ -508,7 +520,6 @@ _evry_list_win_clear(int hide)
}
}
static Evry_Window *
_evry_window_new(E_Zone *zone)
{
@ -652,9 +663,9 @@ _evry_selector_activate(Evry_Selector *sel)
{
_evry_update_text_label(s);
if (sel->state->sel_item)
if (sel->state->cur_item)
edje_object_part_text_set(sel->o_main, "e.text.plugin",
s->sel_item->plugin->name);
s->cur_item->plugin->name);
_evry_view_show(s->view);
_evry_list_win_update(s);
@ -667,11 +678,6 @@ _evry_selector_thumb_gen(void *data, Evas_Object *obj, void *event_info)
Evas_Coord w, h;
Evry_Selector *sel = data;
/* if (!(selector[0] == data) &&
* !(selector[1] == data) &&
* !(selector[2] == data))
* return; */
if (sel->o_icon)
evas_object_del(sel->o_icon);
sel->o_icon = NULL;
@ -734,7 +740,7 @@ _evry_selector_icon_set(Evry_Selector *sel)
if (!s) return;
it = s->sel_item;
it = s->cur_item;
if (it && it->plugin && it->plugin->icon_get)
{
@ -774,14 +780,14 @@ _evry_selector_update(Evry_Selector *sel)
if (s)
{
it = s->sel_item;
it = s->cur_item;
if (!s->plugin && it)
_evry_item_desel(s, NULL);
else if (it && !eina_list_data_find_list(s->plugin->items, it))
_evry_item_desel(s, NULL);
it = s->sel_item;
it = s->cur_item;
if (s->plugin && (!it || s->item_auto_selected))
{
@ -913,7 +919,7 @@ _evry_selector_objects_get(Evry_Action *act)
while (sel->state)
_evry_state_pop(sel);
it = selectors[0]->state->sel_item;
it = selectors[0]->state->cur_item;
EINA_LIST_FOREACH(sel->plugins, l, plugin)
{
@ -995,7 +1001,7 @@ _evry_browse_item(Evry_Selector *sel)
Evry_View *view = NULL;
const char *type_out;
it = s->sel_item;
it = s->cur_item;
if (!it || !it->browseable)
return 0;
@ -1087,7 +1093,7 @@ _evry_selectors_switch(void)
if (selector == selectors[0])
{
if (s->sel_item)
if (s->cur_item)
_evry_selector_activate(selectors[1]);
}
else if (selector == selectors[1])
@ -1095,9 +1101,9 @@ _evry_selectors_switch(void)
int next_selector = 0;
Evry_Action *act;
if ((s->sel_item) &&
(s->sel_item->plugin == action_selector) &&
(act = s->sel_item->data) &&
if ((s->cur_item) &&
(s->cur_item->plugin == action_selector) &&
(act = s->cur_item->data) &&
(act->type_in2))
{
_evry_selector_objects_get(act);
@ -1344,15 +1350,15 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
update_timer = NULL;
}
if (!s_subject->sel_item || !s_action->sel_item) return;
if (!s_subject->cur_item || !s_action->cur_item) return;
if (s_action->sel_item->plugin == action_selector)
if (s_action->cur_item->plugin == action_selector)
{
Evry_Action *act = s_action->sel_item->data;
Evry_Action *act = s_action->cur_item->data;
Evry_Item *it_object = NULL;
if (selectors[2] == selector)
it_object = selector->state->sel_item;
it_object = selector->state->cur_item;
if (act->type_in2 && !it_object) return;
@ -1363,7 +1369,7 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
}
else if (s_action->plugin->action)
{
Evry_Item *it = s_action->sel_item;
Evry_Item *it = s_action->cur_item;
if (!s_action->plugin->action(s_action->plugin, it))
return;
}
@ -1371,10 +1377,10 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
/* let subject and object plugin know that an action was performed */
if (s_subject->plugin->action)
s_subject->plugin->action(s_subject->plugin, s_subject->sel_item);
s_subject->plugin->action(s_subject->plugin, s_subject->cur_item);
if (s_object && s_object->plugin->action)
s_object->plugin->action(s_object->plugin, s_object->sel_item);
s_object->plugin->action(s_object->plugin, s_object->cur_item);
if (finished)
evry_hide();
@ -1416,7 +1422,6 @@ _evry_view_hide(Evry_View *v)
}
}
static void
_evry_view_update(Evry_State *s, Evry_Plugin *p)
{
@ -1449,7 +1454,6 @@ _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev)
return s->view->cb_key_down(s->view, ev);
}
static int
_evry_view_toggle(Evry_State *s, const char *trigger)
{
@ -1585,21 +1589,21 @@ _evry_matches_update(Evry_Selector *sel, int async)
static void
_evry_item_desel(Evry_State *s, Evry_Item *it)
{
if (s->sel_item)
evry_item_free(s->sel_item);
if (s->cur_item)
evry_item_free(s->cur_item);
s->sel_item = NULL;
s->cur_item = NULL;
}
static void
_evry_item_sel(Evry_State *s, Evry_Item *it)
{
if (s->sel_item == it) return;
if (s->cur_item == it) return;
_evry_item_desel(s, NULL);
evry_item_ref(it);
s->sel_item = it;
s->cur_item = it;
}
static void

View File

@ -16,7 +16,6 @@ struct _Plugin
/* current list of files */
Eina_List *cur;
Eina_Bool command;
Ecore_Idle_Enterer *idler;
const char *input;
};
@ -81,49 +80,6 @@ _cb_sort(const void *data1, const void *data2)
return strcasecmp(it1->label, it2->label);
}
static int
_dirbrowse_idler(void *data)
{
Plugin *p = data;
Eina_List *l;
Evry_Item_File *file;
Eina_Bool update = EINA_FALSE;
int cnt = 20;
if (!p->idler) return 0;
EINA_LIST_FOREACH(p->files, l, file)
{
if (!file->mime)
{
_item_fill(file);
cnt--;
if (eina_list_data_find_list(EVRY_PLUGIN(p)->items, file))
update = EINA_TRUE;
}
if (cnt == 0) break;
}
if (update && !p->command)
{
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD);
}
if (cnt > 0)
{
p->idler = NULL;
return 0;
}
e_util_wakeup();
return 1;
}
static void
_item_free(Evry_Item *it)
{
@ -242,12 +198,9 @@ _scan_end_func(void *data)
evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD);
}
p->idler = ecore_idle_enterer_before_add(_dirbrowse_idler, p);
E_FREE(d);
}
static void
_read_directory(Plugin *p)
{
@ -309,10 +262,6 @@ _cleanup(Evry_Plugin *plugin)
EINA_LIST_FREE(p->files, file)
evry_item_free(EVRY_ITEM(file));
if (p->idler)
ecore_idle_enterer_del(p->idler);
p->idler = NULL;
EVRY_PLUGIN_ITEMS_CLEAR(p);
E_FREE(p);
@ -364,8 +313,9 @@ _fetch(Evry_Plugin *plugin, const char *input)
int prio = 0;
if (p->command) return 1;
if (strncmp(p->directory, "/", 1)) return 0;
if (!strcmp(p->directory, "/")) return 0;
snprintf(dir, 4096, "%s", p->directory);
end = strrchr(dir, '/');
@ -405,7 +355,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
return 0;
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
return 1;
}
@ -541,6 +491,5 @@ _shutdown(void)
evry_action_free(act2);
}
EINA_MODULE_INIT(_init);
EINA_MODULE_SHUTDOWN(_shutdown);

View File

@ -100,7 +100,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
Eina_List *l;
Evry_Item_File *file = NULL;
ITEM_FILE(cur_item, v->state->sel_item);
ITEM_FILE(cur_item, v->state->cur_item);
if (!strcmp(ev->key, "Down"))
{
@ -175,7 +175,7 @@ _view_update(Evry_View *view)
{
Image_View *v = (Image_View *) view;
Evry_Item_File *file;
Evry_Item *selected = v->state->sel_item;
Evry_Item *selected = v->state->cur_item;
v->items = _get_list(v->state);
if (!v->items) return 0;

View File

@ -64,9 +64,8 @@ _view_create(Evry_View *v, const Evry_State *s, const Evas_Object *swallow)
char *text =
"<title><b>Welcome!</b></title>"
"Ok, here comes the explanation of <hilight>everything</hilight>...<br>"
"<hilight>everything</hilight> is simple! Just type a few letters of <br>"
"the thing you are looking for. Use cursor <hilight>&lt;up/down&gt;</hilight> <br>"
"to choose from the list of found things.<br>"
"Just type a few letters of the thing you are looking for. <br>"
"Use cursor <hilight>&lt;up/down&gt;</hilight> to choose from the list of things.<br>"
"Press <hilight>&lt;tab&gt;</hilight> to select "
"an action, then press <hilight>&lt;return&gt;</hilight>.<br>"
/* "You might want to know <br>some mo keybinding to ease your experience though.<br>" */

View File

@ -24,7 +24,7 @@ struct _Smart_Data
{
View *view;
Eina_List *items;
Item *sel_item;
Item *cur_item;
Ecore_Idle_Enterer *idle_enter;
Ecore_Idle_Enterer *thumb_idler;
Ecore_Idle_Enterer *update_idler;
@ -112,6 +112,21 @@ _thumb_idler(void *data)
return 0;
}
static int
_check_item(const Evry_Item *it)
{
if (it->plugin->type_out != view_types) return 0;
ITEM_FILE(file, it);
if (!file->uri || !file->mime) return 0;
if (!strncmp(file->mime, "image/", 6))
return 1;
return 0;
}
static int
_e_smart_reconfigure_do(void *data)
{
@ -296,6 +311,11 @@ _e_smart_reconfigure_do(void *data)
edje_object_part_swallow(it->frame, "e.swallow.icon", it->image);
evas_object_show(it->image);
}
/* dirbrowse fetches the mimetype for icon_get */
if (!it->get_thumb && _check_item(it->item))
it->get_thumb = EINA_TRUE;
}
evas_object_move(it->frame, xx, yy);
@ -506,21 +526,6 @@ _pan_view_set(Evas_Object *obj, View *view)
sd->view = view;
}
static int
_check_item(const Evry_Item *it)
{
if (it->plugin->type_out != view_types) return 0;
ITEM_FILE(file, it);
if (!file->uri || !file->mime) return 0;
if (!strncmp(file->mime, "image/", 6))
return 1;
return 0;
}
static Item *
_pan_item_add(Evas_Object *obj, Evry_Item *item)
{
@ -568,12 +573,12 @@ _pan_item_select(Evas_Object *obj, Item *it)
Smart_Data *sd = evas_object_smart_data_get(obj);
int align = -1;
if (sd->sel_item)
if (sd->cur_item)
{
sd->sel_item->selected = EINA_FALSE;
edje_object_signal_emit(sd->sel_item->frame, "e,state,unselected", "e");
sd->sel_item = it;
sd->sel_item->selected = EINA_TRUE;
sd->cur_item->selected = EINA_FALSE;
edje_object_signal_emit(sd->cur_item->frame, "e,state,unselected", "e");
sd->cur_item = it;
sd->cur_item->selected = EINA_TRUE;
}
if (it)
@ -591,7 +596,7 @@ _pan_item_select(Evas_Object *obj, Item *it)
e_scrollframe_child_pos_set(sd->view->sframe, 0, align);
if (sd->view->zoom < 2)
edje_object_signal_emit(sd->sel_item->frame, "e,state,selected", "e");
edje_object_signal_emit(sd->cur_item->frame, "e,state,selected", "e");
if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter);
sd->idle_enter = ecore_idle_enterer_before_add(_e_smart_reconfigure_do, obj);
@ -637,7 +642,7 @@ _update_frame(Evas_Object *obj)
sd->switch_mode = EINA_TRUE;
_e_smart_reconfigure_do(obj);
sd->switch_mode = EINA_FALSE;
_pan_item_select(obj, sd->sel_item);
_pan_item_select(obj, sd->cur_item);
return 0;
}
@ -679,9 +684,9 @@ _view_update(Evry_View *view)
v_it->pos = pos;
/* set selected state -> TODO remove*/
if (p_it == v->state->sel_item)
if (p_it == v->state->cur_item)
{
sd->sel_item = v_it;
sd->cur_item = v_it;
v_it->selected = EINA_TRUE;
}
else
@ -734,9 +739,9 @@ _view_update(Evry_View *view)
v_it->pos = pos;
/* TODO no needed */
if (p_it == v->state->sel_item)
if (p_it == v->state->cur_item)
{
sd->sel_item = v_it;
sd->cur_item = v_it;
v_it->selected = EINA_TRUE;
}
@ -827,7 +832,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
}
if (sd->items)
l = eina_list_data_find_list(sd->items, sd->sel_item);
l = eina_list_data_find_list(sd->items, sd->cur_item);
if (!v->list_mode)
{
@ -864,8 +869,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
EINA_LIST_FOREACH(l, ll, it)
{
if (it->y > sd->sel_item->y &&
it->x >= sd->sel_item->x)
if (it->y > sd->cur_item->y &&
it->x >= sd->cur_item->x)
break;
}
@ -885,8 +890,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
EINA_LIST_REVERSE_FOREACH(l, ll, it)
{
if (it->y < sd->sel_item->y &&
it->x <= sd->sel_item->x)
if (it->y < sd->cur_item->y &&
it->x <= sd->cur_item->x)
break;
}