'everything'

- keep state of view for zoom and mode when browsing
- only update non async sources when switching selectors while update timer is active
- fix 'open with' action



SVN revision: 42047
This commit is contained in:
Hannes Janetzek 2009-08-27 20:52:14 +00:00
parent da3242531c
commit b516d40fa5
4 changed files with 146 additions and 114 deletions

View File

@ -26647,6 +26647,20 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
} }
} }
#endif #endif
part { name: "border_bg";
mouse_events: 0;
description { state: "default" 0.0;
color: 255 255 255 66; //32;
rel1.to: "bg";
rel1.offset: 2 4;
rel2.to: "bg";
rel2.offset: -3 -3;
image {
normal: "everything_item_bg.png";
border: 5 5 5 5;
}
}
}
part { name: "frame"; part { name: "frame";
type: RECT; type: RECT;
description { state: "default" 0; description { state: "default" 0;
@ -26806,7 +26820,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
clip_to: "clip"; clip_to: "clip";
mouse_events: 0; mouse_events: 0;
description { state: "default" 0.0; description { state: "default" 0.0;
color: 255 255 255 96; //32; color: 255 255 255 10; //32;
rel1.offset: 2 2; rel1.offset: 2 2;
rel2.offset: -3 -3; rel2.offset: -3 -3;
image { image {
@ -26816,7 +26830,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
} }
description { state: "selected" 0.0; description { state: "selected" 0.0;
inherit: "default" 0.0; inherit: "default" 0.0;
color: 255 255 255 96; color: 255 255 255 36;
} }
} }
part { name: "border"; part { name: "border";
@ -27010,6 +27024,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
image: "menu_sel_fg.png" COMP; image: "menu_sel_fg.png" COMP;
image: "everything_bar.png" COMP; image: "everything_bar.png" COMP;
image: "everything_box.png" COMP; image: "everything_box.png" COMP;
image: "vgrad_dark.png" COMP;
#ifdef DROP_SHADOW #ifdef DROP_SHADOW
image: "drop.png" COMP; image: "drop.png" COMP;
#endif #endif
@ -27332,9 +27347,10 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
} }
} }
part { name: "list_bg"; part { name: "list_bg";
type: RECT; /* type: RECT; */
clip_to: "base"; clip_to: "base";
description { state: "default" 0.0; description { state: "default" 0.0;
image.normal: "vgrad_dark.png";
rel1 { rel1 {
to: "list_clip"; to: "list_clip";
offset: 0 0; offset: 0 0;
@ -27343,7 +27359,8 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
to: "list_clip"; to: "list_clip";
offset: 0 0; offset: 0 0;
} }
color: 234 234 234 255; fill.smooth: 0;
/* color: 234 234 234 255; */
} }
} }
part { name: "e.swallow.list"; part { name: "e.swallow.list";
@ -27963,9 +27980,9 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
parts { parts {
part { name: "base"; part { name: "base";
mouse_events: 0; mouse_events: 0;
type: RECT;
description { state: "default" 0.0; description { state: "default" 0.0;
color_class: "dialog_base"; visible: 0;
image.normal: "vgrad_dark.png";
rel1 { rel1 {
relative: 0.0 0.0; relative: 0.0 0.0;
offset: 0 -3; offset: 0 -3;
@ -27974,9 +27991,6 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
relative: 1.0 1.0; relative: 1.0 1.0;
offset: -1 6; offset: -1 6;
} }
fill {
smooth: 0;
}
} }
} }
part { name: "e.swallow.preview"; part { name: "e.swallow.preview";
@ -28226,17 +28240,17 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
signal: "e,state,selected"; signal: "e,state,selected";
source: "e"; source: "e";
action: STATE_SET "selected" 0.0; action: STATE_SET "selected" 0.0;
transition: DECELERATE 0.1; /* transition: DECELERATE 0.; */
target: "bg"; target: "bg";
target: "clip"; /* target: "clip"; */
} }
program { name: "unsel"; program { name: "unsel";
signal: "e,state,unselected"; signal: "e,state,unselected";
source: "e"; source: "e";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
transition: SINUSOIDAL 0.2; transition: SINUSOIDAL 0.1;
target: "bg"; target: "bg";
target: "clip"; /* target: "clip"; */
} }
program { name: "thumb_gen"; program { name: "thumb_gen";
signal: "e,action,thumb,gen"; signal: "e,action,thumb,gen";
@ -28409,17 +28423,16 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
signal: "e,state,selected"; signal: "e,state,selected";
source: "e"; source: "e";
action: STATE_SET "selected" 0.0; action: STATE_SET "selected" 0.0;
/* transition: LINEAR 0.04; */
target: "bg"; target: "bg";
target: "clip"; /* target: "clip"; */
} }
program { name: "unsel"; program { name: "unsel";
signal: "e,state,unselected"; signal: "e,state,unselected";
source: "e"; source: "e";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
/* transition: LINEAR 0.03; */ transition: SINUSOIDAL 0.1;
target: "bg"; target: "bg";
target: "clip"; /* target: "clip"; */
} }
program { name: "thumb_gen"; program { name: "thumb_gen";
signal: "e,action,thumb,gen"; signal: "e,action,thumb,gen";

View File

@ -34,7 +34,7 @@ struct _Evry_List_Window
}; };
static void _evry_matches_update(Evry_Selector *sel); static void _evry_matches_update(Evry_Selector *sel, int async);
static void _evry_plugin_action(Evry_Selector *sel, int finished); static void _evry_plugin_action(Evry_Selector *sel, int finished);
static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p); static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p);
static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p); static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p);
@ -856,7 +856,7 @@ _evry_selector_subjects_get(const char *plugin_name)
if (!plugins) return 0; if (!plugins) return 0;
_evry_state_new(sel, plugins); _evry_state_new(sel, plugins);
_evry_matches_update(sel); _evry_matches_update(sel, 1);
return 1; return 1;
} }
@ -894,7 +894,7 @@ _evry_selector_actions_get(Evry_Item *it)
if (!plugins) return 0; if (!plugins) return 0;
_evry_state_new(sel, plugins); _evry_state_new(sel, plugins);
_evry_matches_update(sel); _evry_matches_update(sel, 1);
return 1; return 1;
} }
@ -938,7 +938,7 @@ _evry_selector_objects_get(Evry_Action *act)
if (!plugins) return 0; if (!plugins) return 0;
_evry_state_new(sel, plugins); _evry_state_new(sel, plugins);
_evry_matches_update(sel); _evry_matches_update(sel, 1);
return 1; return 1;
} }
@ -1027,11 +1027,11 @@ _evry_browse_item(Evry_Selector *sel)
if (s->view) if (s->view)
{ {
_evry_view_hide(s->view); _evry_view_hide(s->view);
view = s->view->id; view = s->view;
} }
_evry_state_new(sel, plugins); _evry_state_new(sel, plugins);
_evry_matches_update(sel); _evry_matches_update(sel, 1);
_evry_selector_update(sel); _evry_selector_update(sel);
s = sel->state; s = sel->state;
@ -1074,11 +1074,10 @@ _evry_selectors_switch(void)
if (update_timer) if (update_timer)
{ {
if ((s && !s->plugin->async_fetch) && if ((selector == selectors[0]) ||
((selector == selectors[0]) || (selector == selectors[1]))
(selector == selectors[1])))
{ {
_evry_matches_update(selector); _evry_matches_update(selector, 0);
_evry_selector_update(selector); _evry_selector_update(selector);
} }
@ -1296,7 +1295,7 @@ _evry_update(Evry_State *s, int fetch)
static int static int
_evry_update_timer(void *data) _evry_update_timer(void *data)
{ {
_evry_matches_update(selector); _evry_matches_update(selector, 1);
_evry_selector_update(selector); _evry_selector_update(selector);
_evry_list_win_update(selector->state); _evry_list_win_update(selector->state);
update_timer = NULL; update_timer = NULL;
@ -1338,12 +1337,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
if (update_timer) if (update_timer)
{ {
if ((selector->state->plugin) && _evry_matches_update(selector, 0);
(!selector->state->plugin->async_fetch))
{
_evry_matches_update(selector);
_evry_selector_update(selector); _evry_selector_update(selector);
}
ecore_timer_del(update_timer); ecore_timer_del(update_timer);
update_timer = NULL; update_timer = NULL;
@ -1363,12 +1358,14 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
act->item2 = it_object; act->item2 = it_object;
act->action(act); if (!act->action(act))
return;
} }
else if (s_action->plugin->action) else if (s_action->plugin->action)
{ {
Evry_Item *it = s_action->sel_item; Evry_Item *it = s_action->sel_item;
s_action->plugin->action(s_action->plugin, it); if (!s_action->plugin->action(s_action->plugin, it))
return;
} }
else return; else return;
@ -1520,7 +1517,7 @@ _evry_view_toggle(Evry_State *s, const char *trigger)
} }
static void static void
_evry_matches_update(Evry_Selector *sel) _evry_matches_update(Evry_Selector *sel, int async)
{ {
Evry_State *s = sel->state; Evry_State *s = sel->state;
Evry_Plugin *p; Evry_Plugin *p;
@ -1557,12 +1554,16 @@ _evry_matches_update(Evry_Selector *sel)
{ {
if (!win->plugin_dedicated && p->trigger) continue; if (!win->plugin_dedicated && p->trigger) continue;
if (p == sel->aggregator) continue; if (p == sel->aggregator) continue;
if (!async && p->async_fetch && p->items)
if (p->fetch(p, input) || {
(sel->states->next) ||
(win->plugin_dedicated))
s->cur_plugins = eina_list_append(s->cur_plugins, p); s->cur_plugins = eina_list_append(s->cur_plugins, p);
} }
else
{
if (p->fetch(p, input) || (sel->states->next) || (win->plugin_dedicated))
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)
{ {

View File

@ -1,5 +1,8 @@
#include "Evry.h" #include "Evry.h"
#define TERM_ACTION_CMD "/usr/bin/xterm -hold -e '%s'"
#define TERM_ACTION_DIR "/usr/bin/xterm -e \'cd %s && /bin/bash\'"
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
@ -74,7 +77,7 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
if (!mime) return NULL; if (!mime) return NULL;
p->candidate = EVRY_ITEM(file); p->candidate = item;
p->apps_mime = efreet_util_desktop_mime_list(mime); p->apps_mime = efreet_util_desktop_mime_list(mime);
desktop = e_exehist_mime_desktop_get(mime); desktop = e_exehist_mime_desktop_get(mime);
if (desktop) if (desktop)
@ -83,14 +86,12 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
p->apps_mime = eina_list_prepend(p->apps_mime, desktop); p->apps_mime = eina_list_prepend(p->apps_mime, desktop);
} }
return EVRY_PLUGIN(p); return plugin;
} }
static Evry_Plugin * static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *item) _begin(Evry_Plugin *plugin, const Evry_Item *item)
{ {
PLUGIN(p, plugin);
/* taken from exebuf module */ /* taken from exebuf module */
char *path, *pp, *last; char *path, *pp, *last;
E_Exe_List *el; E_Exe_List *el;
@ -131,7 +132,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item)
added = eina_hash_string_small_new(_hash_free); added = eina_hash_string_small_new(_hash_free);
return EVRY_PLUGIN(p); return plugin;
} }
static void static void
@ -215,6 +216,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app)) if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
{ {
EVRY_ITEM(app)->fuzzy_match = match; EVRY_ITEM(app)->fuzzy_match = match;
EVRY_ITEM(app)->plugin = EVRY_PLUGIN(p);
EVRY_PLUGIN_ITEM_APPEND(p, app); EVRY_PLUGIN_ITEM_APPEND(p, app);
} }
return 1; return 1;
@ -251,6 +253,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app)) if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
{ {
EVRY_ITEM(app)->fuzzy_match = match; EVRY_ITEM(app)->fuzzy_match = match;
EVRY_ITEM(app)->plugin = EVRY_PLUGIN(p);
EVRY_PLUGIN_ITEM_APPEND(p, app); EVRY_PLUGIN_ITEM_APPEND(p, app);
} }
return 1; return 1;
@ -589,7 +592,7 @@ _exec_term_action(Evry_Action *act)
int ret; int ret;
tmp = E_NEW(Evry_Item_App, 1); tmp = E_NEW(Evry_Item_App, 1);
snprintf(buf, sizeof(buf), "/usr/bin/xterm -hold -e '%s'", app->file); snprintf(buf, sizeof(buf), TERM_ACTION_CMD, app->file);
tmp->file = buf; tmp->file = buf;
ret = _app_action(EVRY_ITEM(tmp), NULL); ret = _app_action(EVRY_ITEM(tmp), NULL);
@ -645,7 +648,7 @@ _open_term_action(Evry_Action *act)
if (path) if (path)
{ {
tmp = E_NEW(Evry_Item_App, 1); tmp = E_NEW(Evry_Item_App, 1);
snprintf(buf, sizeof(buf), "/usr/bin/xterm -e \'cd %s && /bin/bash\'", path); snprintf(buf, sizeof(buf), TERM_ACTION_DIR, path);
tmp->file = buf; tmp->file = buf;
ret = _app_action(EVRY_ITEM(tmp), NULL); ret = _app_action(EVRY_ITEM(tmp), NULL);
E_FREE(tmp); E_FREE(tmp);

View File

@ -13,6 +13,7 @@ struct _View
Evas_Object *bg, *sframe, *span; Evas_Object *bg, *sframe, *span;
int iw, ih; int iw, ih;
int zoom;
Eina_Bool list_mode : 1; Eina_Bool list_mode : 1;
}; };
@ -30,7 +31,7 @@ struct _Smart_Data
Evas_Coord sx, sy; Evas_Coord sx, sy;
double selmove; double selmove;
Eina_Bool update : 1; Eina_Bool update : 1;
int zoom;
}; };
struct _Item struct _Item
@ -49,7 +50,7 @@ struct _Item
int pos; int pos;
}; };
static Evry_View *view = NULL; static View *view = NULL;
static const char *view_types = NULL; static const char *view_types = NULL;
static void static void
@ -133,7 +134,7 @@ _e_smart_reconfigure_do(void *data)
{ {
iw = sd->w; iw = sd->w;
} }
else if (sd->zoom == 0) else if (sd->view->zoom == 0)
{ {
int cnt = eina_list_count(sd->items); int cnt = eina_list_count(sd->items);
@ -147,7 +148,7 @@ _e_smart_reconfigure_do(void *data)
else else
iw = sd->w / 4; iw = sd->w / 4;
} }
else if (sd->zoom == 1) else if (sd->view->zoom == 1)
{ {
aspect_w *= 2; aspect_w *= 2;
aspect_w /= 3; aspect_w /= 3;
@ -239,7 +240,7 @@ _e_smart_reconfigure_do(void *data)
if (sd->view->list_mode) if (sd->view->list_mode)
align = it->y - (double)it->y / (double)sd->ch * (sd->h - it->h); align = it->y - (double)it->y / (double)sd->ch * (sd->h - it->h);
else if ((it->y + it->h) - sd->cy > sd->h) else if ((it->y + it->h) - sd->cy > sd->h)
align = it->y - (2 - sd->zoom) * it->h; align = it->y - (2 - sd->view->zoom) * it->h;
else if (it->y < sd->cy) else if (it->y < sd->cy)
align = it->y; align = it->y;
@ -271,19 +272,22 @@ _e_smart_reconfigure_do(void *data)
edje_object_part_text_set(it->frame, "e.text.label", it->item->label); edje_object_part_text_set(it->frame, "e.text.label", it->item->label);
evas_object_show(it->frame); evas_object_show(it->frame);
if (sd->update && !it->visible) if (sd->update)
edje_object_signal_emit(it->frame, "e,action,thumb,show_delayed", "e"); edje_object_signal_emit(it->frame, "e,action,thumb,show_delayed", "e");
else if (!it->visible) else
edje_object_signal_emit(it->frame, "e,action,thumb,show", "e"); edje_object_signal_emit(it->frame, "e,action,thumb,show", "e");
it->visible = EINA_TRUE; it->visible = EINA_TRUE;
} }
/* hmmm somehow this should be moved up to !it->visible */ /* hmmm somehow this should be moved up to !it->visible */
if (it->selected && sd->zoom < 2) if (sd->update)
{
if (it->selected && sd->view->zoom < 2)
edje_object_signal_emit(it->frame, "e,state,selected", "e"); edje_object_signal_emit(it->frame, "e,state,selected", "e");
else else
edje_object_signal_emit(it->frame, "e,state,unselected", "e"); edje_object_signal_emit(it->frame, "e,state,unselected", "e");
}
if (!it->image && !it->have_thumb && if (!it->image && !it->have_thumb &&
it->item->plugin && it->item->plugin->icon_get) it->item->plugin && it->item->plugin->icon_get)
@ -330,7 +334,7 @@ _e_smart_reconfigure_do(void *data)
if (changed) if (changed)
evas_object_smart_callback_call(obj, "changed", NULL); evas_object_smart_callback_call(obj, "changed", NULL);
sd->update = EINA_FALSE; sd->update = EINA_TRUE;
if (recursion == 0) if (recursion == 0)
sd->idle_enter = NULL; sd->idle_enter = NULL;
@ -580,7 +584,8 @@ _pan_item_select(Evas_Object *obj, Item *it)
sd->sel_item = it; sd->sel_item = it;
sd->sel_item->selected = EINA_TRUE; sd->sel_item->selected = EINA_TRUE;
if (sd->zoom < 2) sd->update = EINA_FALSE;
if (sd->view->zoom < 2)
edje_object_signal_emit(sd->sel_item->frame, "e,state,selected", "e"); edje_object_signal_emit(sd->sel_item->frame, "e,state,selected", "e");
if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter); if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter);
@ -768,10 +773,10 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
((!strcmp(ev->key, "plus")) || ((!strcmp(ev->key, "plus")) ||
(!strcmp(ev->key, "z")))) (!strcmp(ev->key, "z"))))
{ {
sd->zoom++; v->zoom++;
if (sd->zoom > 2) sd->zoom = 0; if (v->zoom > 2) v->zoom = 0;
if (sd->zoom == 2) if (v->zoom == 2)
_clear_items(v->span); _clear_items(v->span);
if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter); if (sd->idle_enter) ecore_idle_enterer_del(sd->idle_enter);
@ -867,6 +872,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
static Evry_View * static Evry_View *
_view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow) _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
{ {
VIEW(parent, view);
View *v; View *v;
if (!s->plugin) if (!s->plugin)
@ -877,6 +884,10 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
v->state = s; v->state = s;
v->evas = evas_object_evas_get(swallow); v->evas = evas_object_evas_get(swallow);
v->list_mode = parent->list_mode;
v->zoom = parent->zoom;
v->bg = edje_object_add(v->evas); v->bg = edje_object_add(v->evas);
e_theme_edje_object_set(v->bg, "base/theme/widgets", e_theme_edje_object_set(v->bg, "base/theme/widgets",
"e/modules/everything/thumbview/main/window"); "e/modules/everything/thumbview/main/window");
@ -897,9 +908,6 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
EVRY_VIEW(v)->o_list = v->bg; EVRY_VIEW(v)->o_list = v->bg;
v->list_mode = EINA_TRUE;
v->tabs = evry_tab_view_new(s, v->evas); v->tabs = evry_tab_view_new(s, v->evas);
v->view.o_bar = v->tabs->o_tabs; v->view.o_bar = v->tabs->o_tabs;
@ -923,15 +931,22 @@ _view_destroy(Evry_View *view)
static Eina_Bool static Eina_Bool
_init(void) _init(void)
{ {
view = E_NEW(Evry_View, 1); View *v = E_NEW(View, 1);
view->id = view;
view->name = "Icon View"; v->view.id = EVRY_VIEW(v);
view->create = &_view_create; v->view.name = "Icon View";
view->destroy = &_view_destroy; v->view.create = &_view_create;
view->update = &_view_update; v->view.destroy = &_view_destroy;
view->clear = &_view_clear; v->view.update = &_view_update;
view->cb_key_down = &_cb_key_down; v->view.clear = &_view_clear;
evry_view_register(view, 1); v->view.cb_key_down = &_cb_key_down;
/* TODO config option*/
v->list_mode = EINA_TRUE;
evry_view_register(EVRY_VIEW(v), 1);
view = v;
view_types = eina_stringshare_add("FILE"); view_types = eina_stringshare_add("FILE");
@ -942,7 +957,7 @@ static void
_shutdown(void) _shutdown(void)
{ {
eina_stringshare_del(view_types); eina_stringshare_del(view_types);
evry_view_unregister(view); evry_view_unregister(EVRY_VIEW(view));
E_FREE(view); E_FREE(view);
} }