'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
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";
type: RECT;
description { state: "default" 0;
@ -26806,7 +26820,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
clip_to: "clip";
mouse_events: 0;
description { state: "default" 0.0;
color: 255 255 255 96; //32;
color: 255 255 255 10; //32;
rel1.offset: 2 2;
rel2.offset: -3 -3;
image {
@ -26816,7 +26830,7 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
color: 255 255 255 96;
color: 255 255 255 36;
}
}
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: "everything_bar.png" COMP;
image: "everything_box.png" COMP;
image: "vgrad_dark.png" COMP;
#ifdef DROP_SHADOW
image: "drop.png" COMP;
#endif
@ -27332,9 +27347,10 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
}
}
part { name: "list_bg";
type: RECT;
/* type: RECT; */
clip_to: "base";
description { state: "default" 0.0;
image.normal: "vgrad_dark.png";
rel1 {
to: "list_clip";
offset: 0 0;
@ -27343,7 +27359,8 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
to: "list_clip";
offset: 0 0;
}
color: 234 234 234 255;
fill.smooth: 0;
/* color: 234 234 234 255; */
}
}
part { name: "e.swallow.list";
@ -27963,9 +27980,9 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
parts {
part { name: "base";
mouse_events: 0;
description { state: "default" 0.0;
color_class: "dialog_base";
image.normal: "vgrad_dark.png";
type: RECT;
description { state: "default" 0.0;
visible: 0;
rel1 {
relative: 0.0 0.0;
offset: 0 -3;
@ -27974,9 +27991,6 @@ MIMEBASE("application/x-font-bdf","icon_mime_font_generic.png", ".BDF", 128);
relative: 1.0 1.0;
offset: -1 6;
}
fill {
smooth: 0;
}
}
}
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";
source: "e";
action: STATE_SET "selected" 0.0;
transition: DECELERATE 0.1;
/* transition: DECELERATE 0.; */
target: "bg";
target: "clip";
/* target: "clip"; */
}
program { name: "unsel";
signal: "e,state,unselected";
source: "e";
action: STATE_SET "default" 0.0;
transition: SINUSOIDAL 0.2;
transition: SINUSOIDAL 0.1;
target: "bg";
target: "clip";
/* target: "clip"; */
}
program { name: "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";
source: "e";
action: STATE_SET "selected" 0.0;
/* transition: LINEAR 0.04; */
target: "bg";
target: "clip";
/* target: "clip"; */
}
program { name: "unsel";
signal: "e,state,unselected";
source: "e";
action: STATE_SET "default" 0.0;
/* transition: LINEAR 0.03; */
transition: SINUSOIDAL 0.1;
target: "bg";
target: "clip";
/* target: "clip"; */
}
program { name: "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_select(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;
_evry_state_new(sel, plugins);
_evry_matches_update(sel);
_evry_matches_update(sel, 1);
return 1;
}
@ -894,7 +894,7 @@ _evry_selector_actions_get(Evry_Item *it)
if (!plugins) return 0;
_evry_state_new(sel, plugins);
_evry_matches_update(sel);
_evry_matches_update(sel, 1);
return 1;
}
@ -938,7 +938,7 @@ _evry_selector_objects_get(Evry_Action *act)
if (!plugins) return 0;
_evry_state_new(sel, plugins);
_evry_matches_update(sel);
_evry_matches_update(sel, 1);
return 1;
}
@ -1027,11 +1027,11 @@ _evry_browse_item(Evry_Selector *sel)
if (s->view)
{
_evry_view_hide(s->view);
view = s->view->id;
view = s->view;
}
_evry_state_new(sel, plugins);
_evry_matches_update(sel);
_evry_matches_update(sel, 1);
_evry_selector_update(sel);
s = sel->state;
@ -1074,11 +1074,10 @@ _evry_selectors_switch(void)
if (update_timer)
{
if ((s && !s->plugin->async_fetch) &&
((selector == selectors[0]) ||
(selector == selectors[1])))
if ((selector == selectors[0]) ||
(selector == selectors[1]))
{
_evry_matches_update(selector);
_evry_matches_update(selector, 0);
_evry_selector_update(selector);
}
@ -1296,7 +1295,7 @@ _evry_update(Evry_State *s, int fetch)
static int
_evry_update_timer(void *data)
{
_evry_matches_update(selector);
_evry_matches_update(selector, 1);
_evry_selector_update(selector);
_evry_list_win_update(selector->state);
update_timer = NULL;
@ -1338,12 +1337,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
if (update_timer)
{
if ((selector->state->plugin) &&
(!selector->state->plugin->async_fetch))
{
_evry_matches_update(selector);
_evry_selector_update(selector);
}
_evry_matches_update(selector, 0);
_evry_selector_update(selector);
ecore_timer_del(update_timer);
update_timer = NULL;
@ -1363,12 +1358,14 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
act->item2 = it_object;
act->action(act);
if (!act->action(act))
return;
}
else if (s_action->plugin->action)
{
{
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;
@ -1520,7 +1517,7 @@ _evry_view_toggle(Evry_State *s, const char *trigger)
}
static void
_evry_matches_update(Evry_Selector *sel)
_evry_matches_update(Evry_Selector *sel, int async)
{
Evry_State *s = sel->state;
Evry_Plugin *p;
@ -1557,11 +1554,15 @@ _evry_matches_update(Evry_Selector *sel)
{
if (!win->plugin_dedicated && p->trigger) continue;
if (p == sel->aggregator) continue;
if (p->fetch(p, input) ||
(sel->states->next) ||
(win->plugin_dedicated))
s->cur_plugins = eina_list_append(s->cur_plugins, p);
if (!async && p->async_fetch && p->items)
{
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)

View File

@ -1,5 +1,8 @@
#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;
struct _Plugin
@ -57,7 +60,7 @@ static Evry_Plugin *
_begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
{
PLUGIN(p, plugin);
const char *mime;
if (!item) return 0;
@ -74,7 +77,7 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
if (!mime) return NULL;
p->candidate = EVRY_ITEM(file);
p->candidate = item;
p->apps_mime = efreet_util_desktop_mime_list(mime);
desktop = e_exehist_mime_desktop_get(mime);
if (desktop)
@ -83,23 +86,21 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
p->apps_mime = eina_list_prepend(p->apps_mime, desktop);
}
return EVRY_PLUGIN(p);
return plugin;
}
static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *item)
{
PLUGIN(p, plugin);
/* taken from exebuf module */
char *path, *pp, *last;
E_Exe_List *el;
el = e_config_domain_load("exebuf_exelist_cache", exelist_edd);
if (el)
{
E_Exe *ee;
EINA_LIST_FREE(el->list, ee)
{
exe_list = eina_list_append(exe_list, strdup(ee->path));
@ -126,12 +127,12 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item)
exe_path = eina_list_append(exe_path, strdup(last));
free(path);
}
exe_scan_idler = ecore_idler_add(_scan_idler, NULL);
added = eina_hash_string_small_new(_hash_free);
return EVRY_PLUGIN(p);
return plugin;
}
static void
@ -153,9 +154,9 @@ _cleanup(Evry_Plugin *plugin)
PLUGIN(p, plugin);
Efreet_Desktop *desktop;
char *str;
eina_hash_free(added);
EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->apps_all, desktop)
@ -202,24 +203,25 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
Efreet_Desktop *d2;
int already_refd = 0;
char *exe;
if (file)
{
Eina_List *l;
int len;
char buf[1024];
char *tmp;
if ((app = eina_hash_find(added, file)))
{
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
{
EVRY_ITEM(app)->fuzzy_match = match;
EVRY_ITEM(app)->plugin = EVRY_PLUGIN(p);
EVRY_PLUGIN_ITEM_APPEND(p, app);
}
return 1;
}
len = strlen(file);
tmp = ecore_file_app_exe_get(file);
snprintf(buf, sizeof(buf), "%s*", tmp);
@ -242,7 +244,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
exe = desktop->exec;
else
exe = file;
if (!exe) return 0;
if ((app = eina_hash_find(added, exe)) &&
@ -251,21 +253,22 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
{
EVRY_ITEM(app)->fuzzy_match = match;
EVRY_ITEM(app)->plugin = EVRY_PLUGIN(p);
EVRY_PLUGIN_ITEM_APPEND(p, app);
}
return 1;
}
if (desktop && !already_refd)
efreet_desktop_ref(desktop);
app = E_NEW(Evry_Item_App, 1);
if (desktop)
evry_item_new(EVRY_ITEM(app), EVRY_PLUGIN(p), desktop->name, _item_free);
else
evry_item_new(EVRY_ITEM(app), EVRY_PLUGIN(p), file, _item_free);
app->desktop = desktop;
if (file) app->file = eina_stringshare_add(file);
@ -277,19 +280,19 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
if (tmp && strcmp(exe, tmp))
{
evry_item_ref(EVRY_ITEM(app));
evry_item_ref(EVRY_ITEM(app));
eina_hash_add(added, tmp, app);
}
}
if (file && strcmp(exe, file))
{
evry_item_ref(EVRY_ITEM(app));
evry_item_ref(EVRY_ITEM(app));
eina_hash_add(added, file, app);
}
EVRY_ITEM(app)->fuzzy_match = match;
EVRY_PLUGIN_ITEM_APPEND(p, app);
return 1;
}
@ -372,7 +375,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
int len = input ? strlen(input) : 0;
EVRY_PLUGIN_ITEMS_CLEAR(p);
/* add apps for a given mimetype */
if (plugin->type == type_action)
{
@ -414,7 +417,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
{
if (eina_list_data_find_list(cat_set, desktop)) continue;
if (eina_list_data_find_list(cat_app, desktop)) continue;
ll = eina_list_data_find_list(apps, desktop);
if (ll)
{
@ -440,10 +443,10 @@ _fetch(Evry_Plugin *plugin, const char *input)
if (input && len > 2)
{
char *space;
if ((space = strchr(input, ' ')))
len = (space - input);
EINA_LIST_FOREACH(exe_list, l, file)
{
if (!strncmp(file, input, len))
@ -500,7 +503,7 @@ _app_action(const Evry_Item *it1, const Evry_Item *it2)
if (!it1) return 0;
ITEM_APP(app, it1);
zone = e_util_zone_current_get(e_manager_current_get());
if (app->desktop)
@ -589,7 +592,7 @@ _exec_term_action(Evry_Action *act)
int ret;
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;
ret = _app_action(EVRY_ITEM(tmp), NULL);
@ -625,7 +628,7 @@ _open_term_action(Evry_Action *act)
{
ITEM_FILE(file, act->item1);
Evry_Item_App *tmp;
char buf[1024];
char buf[1024];
char *dir, *path;
int ret = 0;
@ -641,17 +644,17 @@ _open_term_action(Evry_Action *act)
free(dir);
}
if (path)
{
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;
ret = _app_action(EVRY_ITEM(tmp), NULL);
E_FREE(tmp);
free(path);
}
return ret;
}
@ -785,7 +788,7 @@ _exec_border_intercept(Evry_Action *act)
{
Evry_Item_App *app = E_NEW(Evry_Item_App, 1);
E_Border *bd = act->item1->data;
app->desktop = bd->desktop;
act->item1 = EVRY_ITEM(app);
@ -845,11 +848,11 @@ _init(void)
"system-run",
_exec_term_action, _exec_term_check_item,
NULL, NULL, NULL);
act6 = evry_action_new("Open Terminal here", "FILE", NULL, NULL,
"system-run",
_open_term_action, NULL, NULL, NULL, NULL);
evry_action_register(act);
evry_action_register(act1);
@ -866,14 +869,14 @@ _init(void)
#define T E_Exe
#define D exelist_exe_edd
E_CONFIG_VAL(D, T, path, STR);
exelist_edd = E_CONFIG_DD_NEW("E_Exe_List", E_Exe_List);
#undef T
#undef D
#define T E_Exe_List
#define D exelist_edd
E_CONFIG_LIST(D, T, list, exelist_exe_edd);
return EINA_TRUE;
}
@ -915,7 +918,7 @@ _scan_idler(void *data)
E_Exe_List *el;
E_Exe *ee;
int different = 0;
/* FIXME: check theat they match or not */
for (l = exe_list, l2 = exe_list2; l && l2; l = l->next, l2 = l2->next)
{
@ -975,7 +978,7 @@ _scan_idler(void *data)
if (exe_dir)
{
dir = exe_path->data;
dp = readdir(exe_dir);
if (dp)
{

View File

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