'everything' module:

- cleaned up view plugin api and plugins
- run calc and aspell only when triggered


SVN revision: 41875
This commit is contained in:
Hannes Janetzek 2009-08-19 12:07:37 +00:00
parent c345e7c8c8
commit 08a169c696
10 changed files with 591 additions and 587 deletions

View File

@ -139,16 +139,15 @@ struct _Evry_State
struct _Evry_View
{
Evry_View *id;
const char *name;
Evas_Object *(*begin) (Evry_View *v, const Evry_State *s, const Evas_Object *swallow);
int (*cb_key_down) (Evry_View *v, const Ecore_Event_Key *ev);
int (*update) (Evry_View *v, const Evry_State *s);
void (*clear) (Evry_View *v, const Evry_State *s);
void (*cleanup) (Evry_View *v);
const Evry_State *state;
Evry_View *(*create) (const Evry_View *view, const Evry_State *s, const Evas_Object *swallow);
void (*destroy) (const Evry_View *view);
Evas_Object *(*object) (const Evry_View *view);
int (*cb_key_down) (const Evry_View *view, const Ecore_Event_Key *ev);
int (*update) (const Evry_View *view);
void (*clear) (const Evry_View *view);
int priority;
};

View File

@ -9,7 +9,7 @@
#include "e_mod_main.h"
#define CONFIG_VERSION 1
#define CONFIG_VERSION 2
/* actual module specifics */
static void _e_mod_action_exebuf_cb(E_Object *obj, const char *params);
@ -82,7 +82,9 @@ e_modapi_init(E_Module *m)
E_CONFIG_VAL(D, T, hide_input, INT);
E_CONFIG_VAL(D, T, hide_list, INT);
E_CONFIG_VAL(D, T, quick_nav, INT);
E_CONFIG_LIST(D, T, plugins_conf, conf_item_edd);
E_CONFIG_LIST(D, T, conf_subjects, conf_item_edd);
E_CONFIG_LIST(D, T, conf_actions, conf_item_edd);
E_CONFIG_LIST(D, T, conf_objects, conf_item_edd);
#undef T
#undef D
evry_conf = e_config_domain_load("module.everything", conf_edd);
@ -100,6 +102,9 @@ e_modapi_init(E_Module *m)
evry_conf->hide_input = 0;
evry_conf->hide_list = 1;
evry_conf->quick_nav = 1;
evry_conf->conf_subjects = NULL;
evry_conf->conf_actions = NULL;
evry_conf->conf_objects = NULL;
}
/* search for plugins */
@ -164,8 +169,8 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
}
/* conf_module = NULL; */
eina_list_free(evry_conf->plugins);
eina_list_free(evry_conf->actions);
if (evry_conf->plugins) eina_list_free(evry_conf->plugins);
if (evry_conf->actions) eina_list_free(evry_conf->actions);
if (plugins)
{
@ -182,7 +187,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
e_configure_registry_item_del("extensions/run_everything");
e_configure_registry_category_del("extensions");
if (evry_conf->plugins_conf) eina_list_free(evry_conf->plugins_conf);
if (evry_conf->conf_subjects) eina_list_free(evry_conf->conf_subjects);
if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions);
if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects);
E_FREE(evry_conf);
@ -357,13 +364,20 @@ evry_action_free(Evry_Action *act)
void
evry_plugin_register(Evry_Plugin *p, int priority)
{
Eina_List *l;
Eina_List *l, *confs = NULL;
Plugin_Config *pc;
Eina_Bool found = 0;
evry_conf->plugins = eina_list_append(evry_conf->plugins, p);
EINA_LIST_FOREACH(evry_conf->plugins_conf, l, pc)
if (p->type == type_subject)
confs = evry_conf->conf_subjects;
else if (p->type == type_action)
confs = evry_conf->conf_actions;
else if (p->type == type_object)
confs = evry_conf->conf_objects;
EINA_LIST_FOREACH(confs, l, pc)
{
if (pc->name && p->name && !strcmp(pc->name, p->name))
{
@ -379,7 +393,7 @@ evry_plugin_register(Evry_Plugin *p, int priority)
pc->enabled = 1;
pc->priority = priority ? priority : 100;;
evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc);
confs = eina_list_append(confs, pc);
}
/* if (plugin->trigger && !pc->trigger)
@ -391,6 +405,13 @@ evry_plugin_register(Evry_Plugin *p, int priority)
eina_list_count(evry_conf->plugins),
_evry_cb_plugin_sort);
if (p->type == type_subject)
evry_conf->conf_subjects = confs;
else if (p->type == type_action)
evry_conf->conf_actions = confs;
else if (p->type == type_object)
evry_conf->conf_objects = confs;
if (p->type == type_subject)
{
char buf[256];

View File

@ -15,7 +15,9 @@ struct _Config
int width, height;
/* generic plugin config */
Eina_List *plugins_conf;
Eina_List *conf_subjects;
Eina_List *conf_actions;
Eina_List *conf_objects;
int scroll_animate;
double scroll_speed;

View File

@ -47,8 +47,6 @@ struct _Evry_Window
Evas_Object *o_main;
Eina_Bool request_selection;
/* E_Popup *input_win; */
Eina_Bool plugin_dedicated;
};
@ -56,11 +54,8 @@ struct _Evry_List_Window
{
E_Popup *popup;
Evas_Object *o_main;
Evas_Object *o_list;
Evas_Object *o_tabs;
Evry_View *view;
Eina_Bool visible;
};
@ -189,7 +184,7 @@ evry_show(E_Zone *zone, const char *params)
win->plugin_dedicated = EINA_TRUE;
mime_hash = eina_hash_stringshared_new(NULL);
_evry_selector_subjects_get(params);
_evry_selector_activate(selectors[0]);
@ -265,7 +260,7 @@ evry_hide(void)
eina_hash_free(mime_hash);
mime_hash = NULL;
EINA_LIST_FREE(handlers, ev)
ecore_event_handler_del(ev);
@ -300,7 +295,7 @@ evry_item_new(Evry_Plugin *p, const char *label, void (*cb_free) (Evry_Item *ite
it->plugin = p;
if (label) it->label = eina_stringshare_add(label);
if (cb_free) it->cb_free = cb_free;
it->ref = 1;
/* item_cnt++; */
@ -383,10 +378,9 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
/* received data from a plugin of the current selector ? */
if (!s || !eina_list_data_find(s->plugins, p))
{
if (p->type == type_action)
/* if (p->type == type_action) */
/* TODO */
return;
}
if (action == EVRY_ASYNC_UPDATE_ADD)
@ -437,11 +431,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
}
/* plugin box was updated: realign */
if (s->plugin)
{
_evry_tabs_update(s);
/* _evry_tab_scroll_to(s, s->plugin); */
}
_evry_tabs_update(s);
}
}
@ -522,11 +512,11 @@ evry_fuzzy_match(const char *str, const char *match)
offset += 1;
else
offset += 3;
if (offset < 10)
continue;
}
if (min < MAX_FUZZ && offset < 10)
{
/* first offset of match in word */
@ -535,10 +525,10 @@ evry_fuzzy_match(const char *str, const char *match)
first = 1;
last = offset;
}
min += offset + (offset - last) * 5;
last = offset;
/* try next char of match */
if (*(++m) != 0 && !isspace(*m))
continue;
@ -554,7 +544,7 @@ evry_fuzzy_match(const char *str, const char *match)
/* go to next match */
for (; (*m != 0) && !isspace(*m); m++);
}
if (m_cnt < m_num - 1)
{
/* test next match */
@ -636,12 +626,6 @@ _evry_list_win_new(E_Zone *zone)
e_popup_move_resize(popup, x, y, mw, mh);
list_win->view = evry_conf->views->data;
o = list_win->view->begin(list_win->view, NULL, list_win->o_main);
edje_object_part_swallow(list_win->o_main, "e.swallow.list", o);
evas_object_show(o);
list_win->o_list = o;
o = list_win->o_main;
evas_object_move(o, 0, 0);
evas_object_resize(o, list_win->popup->w, list_win->popup->h);
@ -663,8 +647,6 @@ _evry_list_win_new(E_Zone *zone)
static void
_evry_list_win_free(Evry_List_Window *list_win)
{
list_win->view->cleanup(list_win->view);
e_popup_hide(list_win->popup);
evas_event_freeze(list_win->popup->evas);
evas_object_del(list_win->o_tabs);
@ -848,7 +830,11 @@ _evry_selector_activate(Evry_Selector *sel)
}
if (s && s->view)
_evry_view_toggle(s);
{
s->view->clear(s->view);
edje_object_part_unswallow(list->o_main, s->o_view);
evas_object_hide(s->o_view);
}
_evry_list_win_clear(evry_conf->hide_list);
}
@ -866,6 +852,12 @@ _evry_selector_activate(Evry_Selector *sel)
edje_object_part_text_set(sel->o_main, "e.text.plugin",
s->sel_item->plugin->name);
if (s->view)
{
edje_object_part_swallow(list->o_main, "e.swallow.list", s->o_view);
evas_object_show(s->o_view);
}
_evry_list_win_update(s);
}
}
@ -1084,7 +1076,6 @@ _evry_selector_objects_get(const char *type)
return 1;
}
static Evry_State *
_evry_state_new(Evry_Selector *sel, Eina_List *plugins)
{
@ -1115,12 +1106,7 @@ _evry_state_pop(Evry_Selector *sel)
p->cleanup(p);
if (s->view)
{
s->view->cleanup(s->view);
s->view = NULL;
s->o_view = NULL;
/* if (s->o_view) evas_object_del(s->o_view); */
}
s->view->destroy(s->view);
E_FREE(s);
@ -1146,8 +1132,6 @@ _evry_browse_item(Evry_Selector *sel)
if (!it || !it->browseable)
return;
_evry_view_clear(sel->state);
type_out = it->plugin->type_out;
if (!type_out)
@ -1162,19 +1146,21 @@ _evry_browse_item(Evry_Selector *sel)
plugins = eina_list_append(plugins, p);
}
if (plugins)
if (!plugins) return;
if (s->o_view)
{
/* _evry_list_win_show(); */
_evry_state_new(sel, plugins);
_evry_matches_update(sel);
_evry_selector_update(sel);
edje_object_part_unswallow(list->o_main, s->o_view);
evas_object_hide(s->o_view);
}
_evry_state_new(sel, plugins);
_evry_matches_update(sel);
_evry_selector_update(sel);
_evry_list_win_update(sel->state);
_evry_update_text_label(sel->state);
}
static void
_evry_browse_back(Evry_Selector *sel)
{
@ -1183,18 +1169,19 @@ _evry_browse_back(Evry_Selector *sel)
if (!s || !sel->states->next)
return;
/* _evry_view_clear(s); */
if (s->view)
{
_evry_view_toggle(s);
}
_evry_state_pop(sel);
sel->aggregator->fetch(sel->aggregator, sel->state->input);
s = sel->state;
sel->aggregator->fetch(sel->aggregator, s->input);
_evry_selector_update(sel);
_evry_list_win_update(sel->state);
_evry_update_text_label(sel->state);
edje_object_part_swallow(list->o_main, "e.swallow.list", s->o_view);
evas_object_show(s->o_view);
_evry_tabs_update(s);
_evry_update_text_label(s);
}
static void
@ -1208,7 +1195,6 @@ _evry_selectors_switch(void)
((selector == selectors[0]) ||
(selector == selectors[1])))
{
_evry_view_clear(s);
_evry_matches_update(selector);
_evry_selector_update(selector);
}
@ -1225,26 +1211,21 @@ _evry_selectors_switch(void)
else if (selector == selectors[1])
{
int next_selector = 0;
Evry_Action *act;
if (s->sel_item && s->sel_item->plugin == action_selector)
if (s->sel_item && (s->sel_item->plugin == action_selector) &&
(act = s->sel_item->data[0]) && act->type_in2)
{
Evry_Action *act = s->sel_item->data[0];
if (act && act->type_in2)
{
_evry_selector_objects_get(act->type_in2);
_evry_selector_update(selectors[2]);
edje_object_signal_emit(win->o_main,
"e,state,object_selector_show", "e");
next_selector = 2;
}
_evry_selector_objects_get(act->type_in2);
_evry_selector_update(selectors[2]);
edje_object_signal_emit(win->o_main,
"e,state,object_selector_show", "e");
next_selector = 2;
}
_evry_selector_activate(selectors[next_selector]);
}
else if (selector == selectors[2])
{
_evry_view_clear(s);
while (selector->states)
_evry_state_pop(selector);
@ -1262,9 +1243,6 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
Evry_State *s = selector->state;
const char *key = NULL, *old;
/* ev_last_is_mouse = 0;
* item_mouseover = NULL; */
win->request_selection = EINA_FALSE;
ev = event;
@ -1497,7 +1475,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
else
{
Evry_Item *it = s_action->sel_item;
s_action->plugin->action(s_action->plugin, it, selector->state->input);
s_action->plugin->action(s_action->plugin, it,
selector->state->input);
}
if (s_subject->plugin->action)
@ -1518,82 +1497,72 @@ _evry_view_update(Evry_State *s, Evry_Plugin *p)
{
if (!list->visible) return;
if (s->plugin)
if (!s->view)
{
if (s->view)
{
if (!s->view->update(s->view, s))
_evry_view_toggle(s);
}
else
list->view->update(list->view, s);
Evry_View *view = evry_conf->views->data;
s->view = view->create(view, s, list->o_main);
s->o_view = view->object(s->view);
edje_object_part_swallow(list->o_main, "e.swallow.list", s->o_view);
evas_object_show(s->o_view);
}
else
{
if (s->view)
_evry_view_toggle(s);
list->view->clear(list->view, s);
}
if (s->view)
s->view->update(s->view);
}
static void
_evry_view_clear(Evry_State *s)
{
if (!s) return;
if (!s || !s->view) return;
if (s->view)
s->view->clear(s->view, s);
else
list->view->clear(list->view, s);
s->view->clear(s->view);
}
static int
_evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev)
{
if (s->view)
return s->view->cb_key_down(s->view, ev);
else
return list->view->cb_key_down(list->view, ev);
if (!s || !s->view) return 0;
return s->view->cb_key_down(s->view, ev);
}
static int
_evry_view_toggle(Evry_State *s)
{
Evry_View *v;
Evas_Object *o;
Eina_List *l;
Evry_View *view, *v;
Eina_List *l, *ll;
_evry_list_win_show();
l = eina_list_data_find_list(evry_conf->views, s->view->id);
if (l && l->next)
l = l->next;
else
l = evry_conf->views;
EINA_LIST_FOREACH(l, ll, view)
{
if ((view != s->view->id) &&
(v = view->create(view, s, list->o_main)))
break;
}
if (!v) return 0;
if (s->view)
{
s->view->cleanup(s->view);
s->view = NULL;
edje_object_part_swallow(list->o_main, "e.swallow.list", list->o_list);
evas_object_show(list->o_list);
_evry_view_update(s, s->plugin);
edje_object_part_unswallow(list->o_main, s->o_view);
evas_object_hide(s->o_view);
s->view->destroy(s->view);
}
else
{
EINA_LIST_FOREACH(evry_conf->views, l, v)
if (v != list->view) break;
if (!v) return 0;
o = v->begin(v, s, list->o_main);
if (!o) return 0;
edje_object_part_unswallow(list->o_main, list->o_list);
evas_object_hide(list->o_list);
_evry_view_clear(s);
s->view = v;
edje_object_part_swallow(list->o_main, "e.swallow.list", o);
evas_object_show(o);
}
s->view = v;
v->update(v);
s->o_view = v->object(v);
edje_object_part_swallow(list->o_main, "e.swallow.list", s->o_view);
evas_object_show(s->o_view);
return 1;
}
@ -1729,6 +1698,7 @@ _evry_select_plugin(Evry_State *s, Evry_Plugin *p)
p = s->cur_plugins->data;
s->plugin_auto_selected = EINA_TRUE;
}
else s->plugin_auto_selected = EINA_FALSE;
if (p && list->visible && s == selector->state)
{
@ -1764,12 +1734,9 @@ _evry_plugin_next(Evry_State *s)
if (p)
{
s->plugin_auto_selected = EINA_FALSE;
/* _evry_view_clear(s); */
_evry_select_plugin(s, p);
_evry_view_update(s, p);
_evry_tab_scroll_to(s, p);
_evry_selector_update(selector);
_evry_view_update(s, p);
}
}
@ -1803,12 +1770,9 @@ _evry_plugin_next_by_name(Evry_State *s, const char *key)
if (p)
{
s->plugin_auto_selected = EINA_FALSE;
/* _evry_view_clear(s); */
_evry_select_plugin(s, p);
_evry_view_update(s, p);
_evry_tab_scroll_to(s, p);
_evry_selector_update(selector);
_evry_view_update(s, p);
}
}
@ -1833,11 +1797,9 @@ _evry_plugin_prev(Evry_State *s)
if (p)
{
s->plugin_auto_selected = EINA_FALSE;
/* _evry_view_clear(s); */
_evry_select_plugin(s, p);
_evry_view_update(s, p);
_evry_selector_update(selector);
_evry_view_update(s, p);
}
}
@ -1975,10 +1937,9 @@ _evry_plug_actions_free(void)
{
Evry_Plugin *p = action_selector;
evry_plugin_unregister(p);
eina_stringshare_del(p->config->name);
E_FREE(p->config);
evry_plugin_free(p);
evry_plugin_free(p);
}
static int
@ -2102,7 +2063,7 @@ _evry_plug_aggregator_free(Evry_Plugin *p)
{
if (p->config->name) eina_stringshare_del(p->config->name);
E_FREE(p->config);
evry_plugin_free(p);
evry_plugin_free(p);
}
@ -2161,7 +2122,7 @@ _evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input)
}
}
eina_list_free(items);
if (items) eina_list_free(items);
if (input[0])
p->items = eina_list_sort(p->items, eina_list_count(p->items), _evry_fuzzy_sort_cb);
@ -2283,7 +2244,7 @@ Evas_Object *
evry_icon_theme_get(const char *icon, Evas *e)
{
Evas_Object *o = e_icon_add(e);
if (e_config->icon_theme_overrides)
{
if (_evry_icon_fdo_set(o, icon) ||
@ -2307,7 +2268,7 @@ evry_icon_mime_get(const char *mime, Evas *e)
{
char *file;
const char *icon;
if (!(icon = eina_hash_find(mime_hash, mime)))
{
file = efreet_mime_type_icon_get(mime, e_config->icon_theme, 64);

View File

@ -88,9 +88,9 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
eina_list_free(cfdata->p_subject);
eina_list_free(cfdata->p_action);
eina_list_free(cfdata->p_object);
if (cfdata->p_subject) eina_list_free(cfdata->p_subject);
if (cfdata->p_action) eina_list_free(cfdata->p_action);
if (cfdata->p_object) eina_list_free(cfdata->p_object);
E_FREE(cfdata);
}

View File

@ -13,7 +13,7 @@ _cb_border_remove(void *data, int type, void *event)
Evry_Item *it;
ev = event;
EINA_LIST_FOREACH(p->items, l, it)
{
if (it->data[0] == ev->border)
@ -42,15 +42,14 @@ static void
_cleanup(Evry_Plugin *p)
{
Evry_Item *it;
Ecore_Event_Handler *h;
EINA_LIST_FREE(p->items, it)
evry_item_free(it);
while (handlers)
{
ecore_event_handler_del(handlers->data);
handlers = eina_list_remove_list(handlers, handlers);
}
EINA_LIST_FREE(handlers, h)
ecore_event_handler_del(h);
}
static void

View File

@ -8,9 +8,7 @@ static int _cb_del(void *data, int type, void *event);
static Evry_Plugin *p1;
static Ecore_Exe *exe = NULL;
static Eina_List *history = NULL;
static Ecore_Event_Handler *data_handler = NULL;
static Ecore_Event_Handler *error_handler = NULL;
static Ecore_Event_Handler *del_handler = NULL;
static Eina_List *handlers = NULL;
static int error = 0;
@ -21,16 +19,6 @@ _begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
{
Evry_Item *it;
data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_data, p);
error_handler = ecore_event_handler_add(ECORE_EXE_EVENT_ERROR, _cb_error, p);
del_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _cb_del, p);
exe = ecore_exe_pipe_run("bc -l",
ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED |
ECORE_EXE_PIPE_WRITE |
ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED,
NULL);
if (history)
{
const char *result;
@ -46,12 +34,37 @@ _begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
it = evry_item_new(p, "0", NULL);
p->items = eina_list_prepend(p->items, it);
return 1;
}
static int
_run_bc(Evry_Plugin *p)
{
handlers = eina_list_append
(handlers, ecore_event_handler_add
(ECORE_EXE_EVENT_DATA, _cb_data, p));
handlers = eina_list_append
(handlers, ecore_event_handler_add
(ECORE_EXE_EVENT_ERROR, _cb_error, p));
handlers = eina_list_append
(handlers, ecore_event_handler_add
(ECORE_EXE_EVENT_DEL, _cb_del, p));
exe = ecore_exe_pipe_run("bc -l",
ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED |
ECORE_EXE_PIPE_WRITE |
ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED,
NULL);
return !!exe;
}
static void
_cleanup(Evry_Plugin *p)
{
Ecore_Event_Handler *h;
Evry_Item *it;
int items = 10;
@ -69,16 +82,15 @@ _cleanup(Evry_Plugin *p)
evry_item_free(it);
}
ecore_event_handler_del(data_handler);
ecore_event_handler_del(error_handler);
ecore_event_handler_del(del_handler);
data_handler = NULL;
error_handler = NULL;
del_handler = NULL;
EINA_LIST_FREE(handlers, h)
ecore_event_handler_del(h);
ecore_exe_quit(exe);
ecore_exe_free(exe);
exe = NULL;
if (exe)
{
ecore_exe_quit(exe);
ecore_exe_free(exe);
exe = NULL;
}
}
static int
@ -123,8 +135,8 @@ _fetch(Evry_Plugin *p, const char *input)
if (!input) return 0;
if (!data_handler && !_begin(p, NULL)) return 0;
if (!exe && !_run_bc(p)) return 0;
if (!strncmp(input, "scale=", 6))
snprintf(buf, 1024, "%s\n", input);
else
@ -196,8 +208,8 @@ static Eina_Bool
_init(void)
{
p1 = evry_plugin_new("Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=",
NULL, _cleanup, _fetch, _action, NULL, NULL, NULL, NULL);
_begin, _cleanup, _fetch, _action, NULL, NULL, NULL, NULL);
evry_plugin_register(p1, 0);
return EINA_TRUE;

View File

@ -1,11 +1,24 @@
#include "Evry.h"
typedef struct _Image_View Image_View;
struct _Image_View
{
Evry_View view;
Evas *evas;
const Evry_State *state;
Evas_Object *o_main;
Eina_List *items;
Evas_Object *o_thumb[4];
};
static Evry_View *view = NULL;
static Evas_Object *o_thumb[4];
static Evas_Object *o_main = NULL;
static Eina_List *items = NULL;
static const char *view_types;
static const char *view_types = NULL;
static int
_check_item(const Evry_Item *it)
@ -24,103 +37,102 @@ static void
_cb_preview_thumb_gen(void *data, Evas_Object *obj, void *event_info)
{
Evas_Coord w, h;
if (!o_main) return;
e_icon_size_get(o_thumb[1], &w, &h);
edje_extern_object_min_size_set(o_thumb[1], w, h);
edje_object_part_swallow(o_main, "e.swallow.icon2", o_thumb[1]);
/* evas_object_size_hint_aspect_set(o_thumb[1], EVAS_ASPECT_CONTROL_HORIZONTAL, w, h); */
evas_object_show(o_thumb[1]);
Image_View *v = data;
e_icon_size_get(v->o_thumb[1], &w, &h);
edje_extern_object_min_size_set(v->o_thumb[1], w, h);
edje_object_part_swallow(v->o_main, "e.swallow.icon2", v->o_thumb[1]);
evas_object_show(v->o_thumb[1]);
}
void
_show_item(const Evry_Item *it, int dir)
_show_item(Image_View *v, const Evry_Item *it, int dir)
{
int w, h;
if (o_thumb[1 + dir])
if (v->o_thumb[1 + dir])
{
e_thumb_icon_end(o_thumb[1+dir]);
edje_object_part_unswallow(o_main, o_thumb[1+dir]);
evas_object_hide(o_thumb[1+dir]);
evas_object_del(o_thumb[1+dir]);
e_thumb_icon_end(v->o_thumb[1+dir]);
edje_object_part_unswallow(v->o_main, v->o_thumb[1+dir]);
evas_object_hide(v->o_thumb[1+dir]);
evas_object_del(v->o_thumb[1+dir]);
}
if (dir && o_thumb[1])
if (dir && v->o_thumb[1])
{
edje_object_part_unswallow(o_main, o_thumb[1]);
edje_object_part_unswallow(v->o_main, v->o_thumb[1]);
if (dir > 0)
{
o_thumb[2] = o_thumb[1];
edje_object_part_swallow(o_main, "e.swallow.icon1", o_thumb[2]);
v->o_thumb[2] = v->o_thumb[1];
edje_object_part_swallow(v->o_main, "e.swallow.icon1", v->o_thumb[2]);
}
else
{
o_thumb[0] = o_thumb[1];
edje_object_part_swallow(o_main, "e.swallow.icon3", o_thumb[0]);
v->o_thumb[0] = v->o_thumb[1];
edje_object_part_swallow(v->o_main, "e.swallow.icon3", v->o_thumb[0]);
}
}
o_thumb[1] = e_thumb_icon_add(evas_object_evas_get(o_main));
e_thumb_icon_file_set(o_thumb[1], it->uri, NULL);
evas_object_smart_callback_add(o_thumb[1], "e_thumb_gen", _cb_preview_thumb_gen, NULL);
/* evas_object_geometry_get(o_main, &x, &y, &w, &h); */
edje_object_part_geometry_get(o_main, "e.swallow.icon2", NULL, NULL, &w, &h);
e_thumb_icon_size_set(o_thumb[1], w, h);
e_thumb_icon_begin(o_thumb[1]);
v->o_thumb[1] = e_thumb_icon_add(v->evas);
e_thumb_icon_file_set(v->o_thumb[1], it->uri, NULL);
evas_object_smart_callback_add(v->o_thumb[1], "e_thumb_gen", _cb_preview_thumb_gen, v);
edje_object_part_geometry_get(v->o_main, "e.swallow.icon2", NULL, NULL, &w, &h);
e_thumb_icon_size_set(v->o_thumb[1], w, h);
e_thumb_icon_begin(v->o_thumb[1]);
if (dir)
{
if (dir > 0)
edje_object_signal_emit(o_main, "e,signal,slide_left", "e");
edje_object_signal_emit(v->o_main, "e,signal,slide_left", "e");
else
edje_object_signal_emit(o_main, "e,signal,slide_right", "e");
edje_object_signal_emit(v->o_main, "e,signal,slide_right", "e");
}
}
static int
_cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
_cb_key_down(const Evry_View *view, const Ecore_Event_Key *ev)
{
Image_View *v = (Image_View *) view;
Eina_List *l;
Evry_Item *it = NULL, *cur_item;
cur_item = view->state->sel_item;
cur_item = v->state->sel_item;
if (!strcmp(ev->key, "Down"))
{
if (!items) return 1;
if (!v->items) return 1;
l = eina_list_data_find_list(items, cur_item);
l = eina_list_data_find_list(v->items, cur_item);
if (l && l->next)
it = l->next->data;
else
it = items->data;
it = v->items->data;
if (it && (it != cur_item))
{
_show_item(it, 1);
evry_item_select(view->state, it);
_show_item(v, it, 1);
evry_item_select(v->state, it);
}
return 1;
}
else if (!strcmp(ev->key, "Up"))
{
if (!items) return 1;
if (!v->items) return 1;
l = eina_list_data_find_list(items, cur_item);
l = eina_list_data_find_list(v->items, cur_item);
if (l && l->prev)
it = l->prev->data;
else
it = eina_list_last(items)->data;
it = eina_list_last(v->items)->data;
if (it && (it != cur_item))
{
_show_item(it, -1);
evry_item_select(view->state, it);
_show_item(v, it, -1);
evry_item_select(v->state, it);
}
return 1;
}
@ -129,98 +141,107 @@ _cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
}
static void
_clear(Evry_View *v, const Evry_State *s)
_view_clear(const Evry_View *view)
{
if (o_thumb[0]) evas_object_del(o_thumb[0]);
if (o_thumb[1]) evas_object_del(o_thumb[1]);
if (o_thumb[2]) evas_object_del(o_thumb[2]);
o_thumb[0] = NULL;
o_thumb[1] = NULL;
o_thumb[2] = NULL;
}
static void
_cleanup(Evry_View *v)
{
_clear(v, NULL);
Image_View *v = (Image_View *) view;
if (o_main) evas_object_del(o_main);
o_main = NULL;
if (v->o_thumb[0]) evas_object_del(v->o_thumb[0]);
v->o_thumb[0] = NULL;
if (v->o_thumb[1]) evas_object_del(v->o_thumb[1]);
v->o_thumb[1] = NULL;
if (v->o_thumb[2]) evas_object_del(v->o_thumb[2]);
v->o_thumb[2] = NULL;
if (v->items) eina_list_free(v->items);
v->items = NULL;
}
static Evry_Item *
_find_first(const Evry_State *s)
static Eina_List *
_get_list(const Evry_State *s)
{
Eina_List *l;
Evry_Item *it, *found = NULL;
eina_list_free(items);
items = NULL;
Eina_List *l, *items = NULL;
Evry_Item *it;
EINA_LIST_FOREACH(s->plugin->items, l, it)
{
if (!_check_item(it)) continue;
if (!found) found = it;
items = eina_list_append(items, it);
}
if (_check_item(it))
items = eina_list_append(items, it);
if (_check_item(s->sel_item))
return s->sel_item;
return found;
return items;
}
static int
_update(Evry_View *v, const Evry_State *s)
_view_update(const Evry_View *view)
{
Image_View *v = (Image_View *) view;
Evry_Item *it;
v->state = s;
it = _find_first(s);
if (!it) return 0;
_show_item(it, 0);
evry_item_select(view->state, it);
v->items = _get_list(v->state);
if (!v->items) return 0;
it = eina_list_data_find(v->items, v->state->sel_item);
if (!it)
{
it = v->items->data;
evry_item_select(v->state, it);
}
_show_item(v, it, 0);
return 1;
}
static Evas_Object *
_begin(Evry_View *v, const Evry_State *s, const Evas_Object *swallow)
_view_object(const Evry_View *view)
{
return ((Image_View*) view)->o_main;
}
static Evry_View *
_view_create(const Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
{
Image_View *v;
int w, h, x, y;
Evry_Item *it;
if (!(it = _find_first(s))) return NULL;
if (!_get_list(s))
return NULL;
o_main = edje_object_add(evas_object_evas_get(swallow));
e_theme_edje_object_set(o_main, "base/theme/everything",
v = E_NEW(Image_View, 1);
v->view = *view;
v->state = s;
v->evas = evas_object_evas_get(swallow);
v->o_main = edje_object_add(v->evas);
e_theme_edje_object_set(v->o_main, "base/theme/everything",
"e/widgets/everything/preview");
edje_object_part_geometry_get(swallow, "e.swallow.list", &x, &y, &w, &h);
edje_extern_object_min_size_set(o_main, w * 3, 100);
evas_object_resize(o_main, w * 3, h);
edje_extern_object_min_size_set(v->o_main, w * 3, 100);
evas_object_resize(v->o_main, w * 3, h);
if (!o_main) return NULL;
return &v->view;
}
view->state = s;
static void
_view_destroy(const Evry_View *view)
{
Image_View *v = (Image_View *) view;
_show_item(it, 0);
_view_clear(view);
evas_object_del(v->o_main);
return o_main;
E_FREE(v);
}
static Eina_Bool
_init(void)
{
view = E_NEW(Evry_View, 1);
view->name = "Image Preview";
view->begin = &_begin;
view->update = &_update;
view->clear = &_clear;
view->id = view;
view->name = "Image Viewer";
view->create = &_view_create;
view->destroy = &_view_destroy;
view->object = &_view_object;
view->update = &_view_update;
view->clear = &_view_clear;
view->cb_key_down = &_cb_key_down;
view->cleanup = &_cleanup;
evry_view_register(view, 2);
view_types = eina_stringshare_add("FILE");

View File

@ -385,11 +385,12 @@ _shutdown(void)
EINA_LIST_FREE(plugins, p)
{
evry_plugin_unregister(p);
inst = p->private;
if (inst->condition[0]) free(inst->condition);
E_FREE(inst);
E_FREE(p);
evry_plugin_free(p);
}
}

View File

@ -5,84 +5,182 @@ typedef struct _List_View List_View;
struct _List_View
{
Evry_View view;
Evas *evas;
Evas_Object *o_list;
const Evry_State *state;
Evas_Object *o_list;
Eina_List *items;
int ev_last_is_mouse;
Evry_Item *item_mouseover;
Ecore_Animator *scroll_animator;
Ecore_Timer *scroll_timer;
double scroll_align_to;
double scroll_align;
Ecore_Idler *item_idler;
Eina_List *items;
double scroll_align_to;
double scroll_align;
/* int ev_last_is_mouse;
* Evry_Item *item_mouseover; */
/* Ecore_Timer *scroll_timer; */
/* Ecore_Animator *scroll_animator; */
};
static void _list_item_next(const Evry_State *s);
static void _list_item_prev(const Evry_State *s);
static void _list_item_first(const Evry_State *s);
static void _list_item_last(const Evry_State *s);
static void _list_scroll_to(Evry_Item *it);
/* static int _list_animator(void *data);
* static int _list_scroll_timer(void *data); */
static int _list_item_idler(void *data);
static void _list_clear_list(const Evry_State *s);
static Evry_View *view = NULL;
static List_View *list = NULL;
static void
_list_show_items(const Evry_State *s, Evry_Plugin *p)
_list_clear(const Evry_View *view)
{
List_View *v = (List_View *) view;
Evry_Item *it;
if (v->item_idler)
{
ecore_idler_del(v->item_idler);
v->item_idler = NULL;
}
/* if (v->scroll_timer)
* {
* ecore_timer_del(v->scroll_timer);
* v->scroll_timer = NULL;
* }
*
* if (v->scroll_animator)
* {
* ecore_animator_del(v->scroll_animator);
* v->scroll_animator = NULL;
* } */
/* v->scroll_align = 0; */
if (!v->items) return;
evas_event_freeze(v->evas);
e_box_freeze(v->o_list);
EINA_LIST_FREE(v->items, it)
{
if (it->o_bg)
{
e_box_unpack(it->o_bg);
evas_object_hide(it->o_bg);
}
if (it->o_icon)
evas_object_hide(it->o_icon);
evry_item_free(it);
}
e_box_thaw(v->o_list);
evas_event_thaw(v->evas);
}
static void
_list_scroll_to(List_View *v, const Evry_Item *it)
{
int n, h, mh, i = 0;
Eina_List *l;
if (!it) return;
for(l = v->items; l; l = l->next, i++)
if (l->data == it) break;
n = eina_list_count(v->items);
/* fixme how to get size of part, set in theme ?*/
e_box_min_size_get(v->o_list, NULL, &mh);
evas_object_geometry_get(v->o_list, NULL, NULL, NULL, &h);
if (mh <= h)
{
e_box_align_set(v->o_list, 0.5, 0.0);
return;
}
if (n > 6)
{
v->scroll_align_to = (double)i / (double)(n - 1);
{
v->scroll_align = v->scroll_align_to;
e_box_align_set(v->o_list, 0.5, 1.0 - v->scroll_align);
}
}
else
e_box_align_set(v->o_list, 0.5, 0.0);
}
static int
_list_item_idler(void *data)
{
List_View *v = data;
Evry_Plugin *p = v->state->plugin;
Eina_List *l;
Evry_Item *it;
int cnt = 5;
if (!v->item_idler) return 0;
if (!p->icon_get) goto end;
e_box_freeze(v->o_list);
EINA_LIST_FOREACH(v->items, l, it)
{
if (it->o_icon) continue;
it->o_icon = p->icon_get(p, it, v->evas);
if (it->o_icon)
{
edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon);
evas_object_show(it->o_icon);
cnt--;
}
if (cnt == 0) break;
}
e_box_thaw(v->o_list);
if (cnt == 0) return 1;
end:
v->item_idler = NULL;
return 0;
}
static int
_list_update(const Evry_View *view)
{
List_View *v = (List_View *) view;
Evry_Item *it;
Eina_List *l;
int mw, mh, h;
int mw, mh;
Evas_Object *o;
_list_clear_list(s);
_list_clear(view);
if (!p) return;
if (!v->state->plugin)
return 1;
if (list->scroll_timer)
{
ecore_timer_del(list->scroll_timer);
list->scroll_timer = NULL;
}
if (list->scroll_animator)
{
ecore_animator_del(list->scroll_animator);
list->scroll_animator = NULL;
}
evas_event_freeze(v->evas);
e_box_freeze(v->o_list);
list->scroll_align = 0;
evas_event_freeze(list->evas);
e_box_freeze(list->o_list);
EINA_LIST_FOREACH(p->items, l, it)
EINA_LIST_FOREACH(v->state->plugin->items, l, it)
{
o = it->o_bg;
if (!o)
{
o = edje_object_add(list->evas);
o = edje_object_add(v->evas);
it->o_bg = o;
e_theme_edje_object_set(o, "base/theme/everything",
"e/widgets/everything/item");
edje_object_part_text_set(o, "e.text.title", it->label);
/* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
* _evry_cb_item_mouse_in, it);
* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
* _evry_cb_item_mouse_out, it); */
}
edje_object_size_min_calc(o, &mw, &mh);
e_box_pack_end(list->o_list, o);
e_box_pack_end(v->o_list, o);
e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh);
evas_object_show(o);
@ -92,7 +190,7 @@ _list_show_items(const Evry_State *s, Evry_Plugin *p)
evas_object_show(it->o_icon);
}
if (it == s->sel_item)
if (it == v->state->sel_item)
{
edje_object_signal_emit(it->o_bg, "e,state,selected", "e");
if (it->o_icon)
@ -104,153 +202,37 @@ _list_show_items(const Evry_State *s, Evry_Plugin *p)
{
edje_object_signal_emit(it->o_bg, "e,state,unselected", "e");
}
evry_item_ref(it);
list->items = eina_list_append(list->items, it);
v->items = eina_list_append(v->items, it);
}
e_box_thaw(list->o_list);
list->item_idler = ecore_idler_add(_list_item_idler, p);
e_box_thaw(v->o_list);
evas_event_thaw(v->evas);
e_box_min_size_get(list->o_list, NULL, &mh);
evas_object_geometry_get(list->o_list, NULL, NULL, NULL, &h);
if (mh <= h)
e_box_align_set(list->o_list, 0.5, 0.0);
else
e_box_align_set(list->o_list, 0.5, 1.0);
_list_scroll_to(v, v->state->sel_item);
evas_event_thaw(list->evas);
v->item_idler = ecore_idler_add(_list_item_idler, v);
_list_scroll_to(s->sel_item);
return 1;
}
static void
_list_clear_list(const Evry_State *s)
_list_item_sel(List_View *v, const Evry_Item *it)
{
Evry_Item *it;
if (list->item_idler)
if (v->state->sel_item)
{
ecore_idler_del(list->item_idler);
list->item_idler = NULL;
Evry_Item *it2 = v->state->sel_item;
if (it == it2) return;
if (it2->o_bg)
edje_object_signal_emit(it2->o_bg, "e,state,unselected", "e");
if (it2->o_icon)
edje_object_signal_emit(it2->o_icon, "e,state,unselected", "e");
}
if (list->items)
{
evas_event_freeze(list->evas);
e_box_freeze(list->o_list);
EINA_LIST_FREE(list->items, it)
{
if (it->o_bg)
{
e_box_unpack(it->o_bg);
evas_object_hide(it->o_bg);
}
if (it->o_icon)
evas_object_hide(it->o_icon);
evry_item_free(it);
}
}
e_box_thaw(list->o_list);
evas_event_thaw(list->evas);
/* } */
}
static int
_list_item_idler(void *data)
{
Evry_Plugin *p = data;
int cnt = 5;
Eina_List *l;
Evry_Item *it;
if (!list->item_idler) return 0;
if (!p->icon_get) goto end;
e_box_freeze(list->o_list);
EINA_LIST_FOREACH(list->items, l, it)
{
if (it->o_icon) continue;
it->o_icon = p->icon_get(p, it, list->evas);
if (it->o_icon)
{
edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon);
evas_object_show(it->o_icon);
cnt--;
}
if (cnt == 0) break;
}
e_box_thaw(list->o_list);
if (cnt == 0) return 1;
end:
list->item_idler = NULL;
return 0;
}
/* static int
* _list_scroll_timer(void *data __UNUSED__)
* {
* if (list->scroll_animator)
* {
* double spd;
* spd = evry_conf->scroll_speed;
* list->scroll_align = (list->scroll_align * (1.0 - spd)) +
* (list->scroll_align_to * spd);
* return 1;
* }
* list->scroll_timer = NULL;
* return 0;
* }
*
* static int
* _list_animator(void *data __UNUSED__)
* {
* double da;
* Eina_Bool scroll_to = 1;
*
* da = list->scroll_align - list->scroll_align_to;
* if (da < 0.0) da = -da;
* if (da < 0.01)
* {
* list->scroll_align = list->scroll_align_to;
* scroll_to = 0;
* }
* e_box_align_set(list->o_list, 0.5, 1.0 - list->scroll_align);
* if (scroll_to) return 1;
* list->scroll_animator = NULL;
* return 0;
* } */
static void
_list_item_desel(const Evry_State *s, Evry_Item *it)
{
if (s->sel_item)
{
it = s->sel_item;
if (it->o_bg)
edje_object_signal_emit(it->o_bg, "e,state,unselected", "e");
if (it->o_icon)
edje_object_signal_emit(it->o_icon, "e,state,unselected", "e");
}
}
static void
_list_item_sel(const Evry_State *s, Evry_Item *it)
{
if (s->sel_item == it) return;
_list_item_desel(s, NULL);
if (it->o_bg)
edje_object_signal_emit(it->o_bg, "e,state,selected", "e");
if (it->o_icon)
@ -258,190 +240,151 @@ _list_item_sel(const Evry_State *s, Evry_Item *it)
if (it->browseable)
edje_object_signal_emit(it->o_bg, "e,state,arrow_show", "e");
_list_scroll_to(it);
evry_item_select(s, it);
_list_scroll_to(v, it);
}
static void
_list_scroll_to(Evry_Item *it)
{
int n, h, mh, i = 0;
Eina_List *l;
if (!it) return;
for(l = list->items; l; l = l->next, i++)
if (l->data == it) break;
n = eina_list_count(list->items);
e_box_min_size_get(list->o_list, NULL, &mh);
evas_object_geometry_get(list->o_list, NULL, NULL, NULL, &h);
if (i >= n || mh <= h)
{
e_box_align_set(list->o_list, 0.5, 0.0);
return;
}
if (n > 1)
{
list->scroll_align_to = (double)i / (double)(n - 1);
/* if (evry_conf->scroll_animate)
* {
* if (!list->scroll_timer)
* list->scroll_timer = ecore_timer_add(0.01, _list_scroll_timer, NULL);
* if (!list->scroll_animator)
* list->scroll_animator = ecore_animator_add(_list_animator, NULL);
* }
* else */
{
list->scroll_align = list->scroll_align_to;
e_box_align_set(list->o_list, 0.5, 1.0 - list->scroll_align);
}
}
else
e_box_align_set(list->o_list, 0.5, 1.0);
}
static void
_list_item_next(const Evry_State *s)
_list_item_next(List_View *v)
{
Eina_List *l;
Evry_Item *it;
if (!list->items) return;
if (!v->items) return;
EINA_LIST_FOREACH (list->items, l, it)
EINA_LIST_FOREACH (v->items, l, it)
{
if (it == s->sel_item)
{
if (l->next)
{
_list_item_sel(s, l->next->data);
}
if (it != v->state->sel_item) continue;
break;
if (l->next)
{
it = l->next->data;
_list_item_sel(v, it);
evry_item_select(v->state, it);
}
break;
}
}
static void
_list_item_prev(const Evry_State *s)
_list_item_prev(List_View *v)
{
Eina_List *l;
Evry_Item *it;
if (!list->items) return;
if (!v->items) return;
if (!s->sel_item) return;
if (!v->state->sel_item) return;
EINA_LIST_FOREACH (list->items, l, it)
EINA_LIST_FOREACH (v->items, l, it)
{
if (it == s->sel_item)
if (it != v->state->sel_item) continue;
if (l->prev)
{
if (l->prev)
{
_list_item_sel(s, l->prev->data);
return;
}
break;
it = l->prev->data;
_list_item_sel(v, it);
evry_item_select(v->state, it);
return;
}
break;
}
evry_list_win_hide();
}
static void
_list_item_first(const Evry_State *s)
_list_item_first(List_View *v)
{
if (!list->items) return;
Evry_Item *it;
_list_item_sel(s, list->items->data);
if (!v->items) return;
it = v->items->data;
_list_item_sel(v, it);
evry_item_select(v->state, it);
}
static void
_list_item_last(const Evry_State *s)
_list_item_last(List_View *v)
{
if (!list->items) return;
Evry_Item *it;
_list_item_sel(s, eina_list_last(list->items)->data);
if (!v->items) return;
it = eina_list_last(v->items)->data;
_list_item_sel(v, it);
evry_item_select(v->state, it);
}
static int
_cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
_cb_key_down(const Evry_View *view, const Ecore_Event_Key *ev)
{
List_View *v = (List_View *) view;
const char *key = ev->key;
if (!strcmp(key, "Up"))
_list_item_prev(v->state);
_list_item_prev(v);
else if (!strcmp(key, "Down"))
_list_item_next(v->state);
_list_item_next(v);
else if (!strcmp(key, "End"))
_list_item_last(v->state);
_list_item_last(v);
else if (!strcmp(key, "Home"))
_list_item_first(v->state);
_list_item_first(v);
else return 0;
return 1;
}
static Evas_Object *
_begin(Evry_View *v, const Evry_State *s, const Evas_Object *swallow)
_list_object(const Evry_View *view)
{
Evas_Object *o;
list->evas = evas_object_evas_get(swallow);
o = e_box_add(list->evas);
list->o_list = o;
e_box_orientation_set(o, 0);
e_box_homogenous_set(o, 1);
return o;
return ((List_View*) view)->o_list;
}
static void
_cleanup(Evry_View *v)
static Evry_View *
_create(const Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
{
if (list->scroll_timer)
ecore_timer_del(list->scroll_timer);
if (list->scroll_animator)
ecore_animator_del(list->scroll_animator);
if (list->item_idler)
ecore_idler_del(list->item_idler);
List_View *v;
evas_object_del(list->o_list);
}
static void
_clear(Evry_View *v, const Evry_State *s)
{
_list_clear_list(s);
}
static int
_update(Evry_View *v, const Evry_State *s)
{
v = E_NEW(List_View, 1);
v->view = *view;
v->evas = evas_object_evas_get(swallow);
v->state = s;
_list_show_items(s, s->plugin);
return 1;
v->o_list = e_box_add(v->evas);
e_box_orientation_set(v->o_list, 0);
e_box_homogenous_set(v->o_list, 1);
return &v->view;
}
static void
_destroy(const Evry_View *view)
{
List_View *v = (List_View *) view;
_list_clear(view);
evas_object_del(v->o_list);
E_FREE(v);
}
static Eina_Bool
_init(void)
{
view = E_NEW(Evry_View, 1);
view->id = view;
view->name = "List View";
view->begin = &_begin;
view->update = &_update;
view->clear = &_clear;
view->create = &_create;
view->destroy = &_destroy;
view->object = &_list_object;
view->update = &_list_update;
view->clear = &_list_clear;
view->cb_key_down = &_cb_key_down;
view->cleanup = &_cleanup;
evry_view_register(view, 1);
list = E_NEW(List_View, 1);
return EINA_TRUE;
}
@ -450,9 +393,54 @@ _shutdown(void)
{
evry_view_unregister(view);
E_FREE(view);
E_FREE(list);
}
EINA_MODULE_INIT(_init);
EINA_MODULE_SHUTDOWN(_shutdown);
/* static int
* _list_scroll_timer(void *data __UNUSED__)
* {
* if (v->scroll_animator)
* {
* double spd;
* spd = evry_conf->scroll_speed;
* v->scroll_align = (v->scroll_align * (1.0 - spd)) +
* (v->scroll_align_to * spd);
* return 1;
* }
* v->scroll_timer = NULL;
* return 0;
* }
*
* static int
* _list_animator(void *data __UNUSED__)
* {
* double da;
* Eina_Bool scroll_to = 1;
*
* da = v->scroll_align - v->scroll_align_to;
* if (da < 0.0) da = -da;
* if (da < 0.01)
* {
* v->scroll_align = v->scroll_align_to;
* scroll_to = 0;
* }
* e_box_align_set(v->o_list, 0.5, 1.0 - v->scroll_align);
* if (scroll_to) return 1;
* v->scroll_animator = NULL;
* return 0;
* } */
/* if (evry_conf->scroll_animate)
* {
* if (!v->scroll_timer)
* v->scroll_timer = ecore_timer_add(0.01, _list_scroll_timer, NULL);
* if (!v->scroll_animator)
* v->scroll_animator = ecore_animator_add(_list_animator, NULL);
* }
* else */