- wrong sorting of apps from history
- get correct url hash for files. - strip double slash
- update selector when swtching to aggregator plugin
added 
- XF86Back to toggle thumb/list mode
- XF86Forward to zoom in thumb mode
cleanups


SVN revision: 48780
This commit is contained in:
Hannes Janetzek 2010-05-12 17:29:38 +00:00
parent eb77076200
commit 6620e1a566
7 changed files with 97 additions and 87 deletions

View File

@ -279,7 +279,6 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const 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 app;
@ -324,7 +323,6 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const 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 app;
@ -341,7 +339,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match)
EVRY_ACTN(app)->remember_context = EINA_TRUE;
EVRY_ITEM(app)->id = eina_stringshare_add(desktop->exec);
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
EVRY_ITEM(app)->fuzzy_match = match;
if (desktop->comment)
EVRY_ITEM(app)->detail = eina_stringshare_add(desktop->comment);
else if (desktop->generic_name)
@ -354,6 +352,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match)
EVRY_ACTN(app)->remember_context = EINA_TRUE;
EVRY_ITEM(app)->id = eina_stringshare_add(file);
EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION;
EVRY_ITEM(app)->fuzzy_match = match;
}
app->desktop = desktop;
@ -464,11 +463,11 @@ _hist_items_add_cb(const Eina_Hash *hash, const void *key, void *data, void *fda
if ((d = efreet_util_desktop_exec_find(key)))
{
app = _item_add(p, d, NULL, 1);
app = _item_add(p, d, NULL, 0);
}
else
{
app = _item_add(p, NULL, (char *) key, 1);
app = _item_add(p, NULL, (char *) key, 0);
if (app && app->desktop)
efreet_desktop_ref(app->desktop);
}

View File

@ -220,7 +220,11 @@ _scan_func(void *data)
EVRY_ITEM(file)->browseable = is_dir;
d->files = eina_list_append(d->files, file);
snprintf(buf, sizeof(buf), "%s/%s", d->directory, filename);
if (d->directory[1])
snprintf(buf, sizeof(buf), "%s/%s", d->directory, filename);
else
snprintf(buf, sizeof(buf), "/%s", filename);
file->path = strdup(buf);
}
closedir(d->dirp);
@ -426,6 +430,10 @@ _scan_end_func(void *data)
_scan_cancel_func, d);
return;
}
else
{
p->files = eina_list_sort(p->files, -1, _cb_sort);
}
}
else
{
@ -456,23 +464,23 @@ _scan_end_func(void *data)
{
if (!(p->command == CMD_SHOW_HIDDEN) && _conf->cache_dirs)
{
EINA_LIST_FOREACH(p->files, l, item)
EINA_LIST_REVERSE_FOREACH(p->files, l, item)
{
GET_FILE(file, item);
if (!item->usage &&
(hi = evry->history_item_add(item, NULL, NULL)))
{
hi->last_used = SIX_DAYS_AGO - (0.001 * (double) cnt++);
hi->usage = MIN_USAGE;
hi->last_used = SIX_DAYS_AGO;
hi->usage = MIN_USAGE * (double) cnt++;
hi->data = eina_stringshare_ref(file->mime);
item->hi = hi;
}
else if (item->hi && (item->hi->count == 1) &&
(item->hi->last_used < SIX_DAYS_AGO))
{
item->hi->last_used = SIX_DAYS_AGO - (0.001 * (double) cnt++);
item->hi->usage = MIN_USAGE;
item->hi->last_used = SIX_DAYS_AGO;
item->hi->usage = MIN_USAGE * (double) cnt++;
}
}
}
@ -482,8 +490,6 @@ _scan_end_func(void *data)
p->thread = NULL;
}
p->files = eina_list_sort(p->files, -1, _cb_sort);
_append_files(p);
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
@ -1297,7 +1303,10 @@ _plugins_init(const Evry_API *api)
_recentf_begin, _finish, _recentf_fetch);
p->browse = &_recentf_browse;
if (evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 3))
p->config->min_query = 3;
{
p->config->top_level = EINA_FALSE;
p->config->min_query = 3;
}
}
#undef PLUGIN_NEW

View File

@ -503,7 +503,6 @@ _e_mod_menu_add(void *data __UNUSED__, E_Menu *m)
e_menu_item_callback_set(mi, _e_mod_run_cb, NULL);
}
EAPI int evry_api_version_check(int version)
{
if (EVRY_API_VERSION == version)

View File

@ -50,7 +50,7 @@ static void _evry_selector_free(Evry_Selector *sel);
static void _evry_selector_activate(Evry_Selector *sel);
static void _evry_selectors_switch(int dir);
static void _evry_selector_update(Evry_Selector *sel);
static void _evry_selector_icon_set(Evry_Selector *sel);
static void _evry_selector_item_set(Evry_Selector *sel);
static int _evry_selector_subjects_get(const char *plugin_name);
static int _evry_selector_actions_get(Evry_Item *it);
static int _evry_selector_objects_get(Evry_Action *act);
@ -412,7 +412,7 @@ evry_item_free(Evry_Item *it)
IF_RELEASE(it->context);
IF_RELEASE(it->detail);
IF_RELEASE(it->icon);
if (it->free)
it->free(it);
else
@ -427,6 +427,9 @@ _evry_selector_for_plugin_get(Evry_Plugin *p)
for (i = 0; i < 3; i++)
{
if (p == selectors[i]->aggregator)
return selectors[i];
s = selectors[i]->state;
if (s && eina_list_data_find(s->plugins, p))
return selectors[i];
@ -541,11 +544,10 @@ evry_plugin_update(Evry_Plugin *p, int action)
Evry_State *s;
Evry_Plugin *agg;
Evry_Selector *sel;
int update_agg = 0;
if (!win) return;
printf("plugin: %s\n", p->name);
sel = _evry_selector_for_plugin_get(p);
if (!sel || !sel->state) return;
@ -605,14 +607,15 @@ evry_plugin_update(Evry_Plugin *p, int action)
s->cur_plugins = eina_list_remove(s->cur_plugins, agg);
}
}
update_agg = 1;
}
if (s->sel_items)
eina_list_free(s->sel_items);
s->sel_items = NULL;
/* plugin is visible */
if ((s->plugin == p) || (s->plugin == agg))
if ((s->plugin == p) || (update_agg && s->plugin == agg))
{
_evry_selector_update(sel);
}
@ -968,8 +971,10 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
if (!strncmp(file->mime, "image/", 6))
{
sel->o_thumb = e_thumb_icon_add(win->popup->evas);
evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen", _evry_selector_thumb_gen, sel);
edje_object_part_geometry_get(sel->o_main, "e.swallow.thumb", NULL, NULL, &w, &h);
evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen",
_evry_selector_thumb_gen, sel);
edje_object_part_geometry_get(sel->o_main, "e.swallow.thumb",
NULL, NULL, &w, &h);
e_thumb_icon_file_set(sel->o_thumb, file->path, NULL);
e_thumb_icon_size_set(sel->o_thumb, w, h);
e_thumb_icon_begin(sel->o_thumb);
@ -981,10 +986,10 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
}
static void
_evry_selector_icon_set(Evry_Selector *sel)
_evry_selector_item_update(Evry_Selector *sel)
{
Evry_State *s = sel->state;
Evry_Item *it;
Evry_Item *it = NULL;
Evas_Object *o;
if (!edje_object_part_exists(sel->o_main, "e.swallow.icons")) return;
@ -995,12 +1000,29 @@ _evry_selector_icon_set(Evry_Selector *sel)
sel->o_icon = NULL;
}
if (!s) return;
if (!s || !(it = s->cur_item))
{
/* no items for this state - clear selector */
edje_object_part_text_set(sel->o_main, "e.text.label", "");
if (sel == selector && s && s->plugin)
edje_object_part_text_set(sel->o_main, "e.text.plugin",
EVRY_ITEM(s->plugin)->label);
else
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
it = s->cur_item;
if (!s) return;
}
if (it)
{
edje_object_part_text_set(sel->o_main, "e.text.label", it->label);
if (sel == selector)
edje_object_part_text_set(sel->o_main, "e.text.plugin",
EVRY_ITEM(it->plugin)->label);
else
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
if (!_evry_selector_thumb(sel, it))
{
o = evry_util_icon_get(it, win->popup->evas);
@ -1016,12 +1038,8 @@ _evry_selector_icon_set(Evry_Selector *sel)
}
}
}
else if (it)
{
_evry_selector_thumb(sel, it);
}
if (!sel->o_icon && s->plugin && EVRY_ITEM(s->plugin)->icon)
if (!(sel->o_icon) && (EVRY_ITEM(s->plugin)->icon))
{
o = evry_icon_theme_get(EVRY_ITEM(s->plugin)->icon, win->popup->evas);
if (o)
@ -1040,6 +1058,8 @@ _evry_selector_update(Evry_Selector *sel)
Evry_Item *it = NULL;
Eina_Bool item_changed = EINA_FALSE;
DBG("%p", sel);
if (s)
{
it = s->cur_item;
@ -1070,26 +1090,8 @@ _evry_selector_update(Evry_Selector *sel)
}
}
_evry_selector_icon_set(sel);
_evry_selector_item_update(sel);
if (it)
{
edje_object_part_text_set(sel->o_main, "e.text.label", it->label);
if (sel == selector)
edje_object_part_text_set(sel->o_main, "e.text.plugin", EVRY_ITEM(it->plugin)->label);
else
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
}
else
{
/* no items for this state - clear selector */
edje_object_part_text_set(sel->o_main, "e.text.label", "");
if (sel == selector && s && s->plugin)
edje_object_part_text_set(sel->o_main, "e.text.plugin", EVRY_ITEM(s->plugin)->label);
else
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
}
if (sel == selectors[0])
{
@ -1113,8 +1115,8 @@ _evry_list_win_update(Evry_State *s)
if (s != selector->state) return;
if (!list->visible) return;
if (s->changed)
_evry_view_update(s, s->plugin);
/* if (s->changed) */
_evry_view_update(s, s->plugin);
}
static int
@ -1662,8 +1664,8 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
goto end;
}
/* let plugin intercept keypress */
else if (s->plugin && s->plugin->cb_key_down &&
s->plugin->cb_key_down(s->plugin, ev))
if (s->plugin && s->plugin->cb_key_down &&
s->plugin->cb_key_down(s->plugin, ev))
goto end;
/* let view intercept keypress */
else if (_evry_view_key_press(s, ev))

View File

@ -73,6 +73,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
(CHECK_SUBTYPE(it, act->it1.type))) &&
(!act->check_item || act->check_item(act, it)))
{
/* if (act->base.plugin) */
act->base.plugin = plugin;
if (!eina_list_data_find_list(p->actions, act))

View File

@ -846,6 +846,10 @@ _clear_items(Evas_Object *obj)
if (sd->thumb_idler)
ecore_timer_del(sd->thumb_idler);
sd->thumb_idler = NULL;
if (sd->selector)
evas_object_del(sd->selector);
sd->selector = NULL;
}
static void
@ -876,7 +880,7 @@ _view_clear(Evry_View *view, int slide)
sd->clearing = EINA_FALSE;
_clear_items(v->span);
EINA_LIST_FREE(sd->items, it)
{
evry_item_free(it->item);
@ -1101,8 +1105,8 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
const char *key = ev->key;
if (((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
(!strcmp(key, "2"))) || !strcmp(key, "XF86Back"))
if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
(!strcmp(key, "2")))
{
if (v->mode == VIEW_MODE_LIST)
v->mode = VIEW_MODE_DETAIL;
@ -1133,6 +1137,23 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
_update_frame(v->span);
goto end;
}
else if (!strcmp(key, "XF86Back"))
{
if (v->mode == VIEW_MODE_LIST ||
v->mode == VIEW_MODE_DETAIL)
{
v->zoom = 0;
v->mode = VIEW_MODE_THUMB;
}
else
{
v->mode = VIEW_MODE_DETAIL;
}
_clear_items(v->span);
_update_frame(v->span);
goto end;
}
if (((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) ||
(ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) &&

View File

@ -168,12 +168,6 @@ _tabs_update(Tab_View *v)
edje_object_signal_emit(o, "e,state,unselected", "e");
}
/* if (eina_list_count(s->cur_plugins) == 2)
* {
* v->align = 0;
* e_box_align_set(v->o_tabs, 0.0, 0.5);
* } */
/* else */
if (s->plugin)
_tab_scroll_to(v, s->plugin, 0);
@ -288,30 +282,15 @@ _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev)
if (!v->state || !v->state->cur_plugins) return 0;
/* if (!strcmp(key, "Next"))
* {
* _plugin_next(v);
* return 1;
* }
* else if (!strcmp(key, "Prior"))
* {
* _plugin_prev(v);
* return -1;
* }
* else */
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
if (!strcmp(key, "Next"))
{
if (!strcmp(key, "Left"))
{
_plugin_prev(v);
return -1;
}
else if (!strcmp(key, "Right"))
{
_plugin_next(v);
return 1;
}
_plugin_next(v);
return 1;
}
else if (!strcmp(key, "Prior"))
{
_plugin_prev(v);
return -1;
}
else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
{