ATTN: JEFFDAMETH!

YOUR CODE FORMATTING IS BROKEN! PLEASE FIX THIS IN YOUR EDITOR ASAP!


SVN revision: 65704
This commit is contained in:
Mike Blumenkrantz 2011-11-30 03:32:54 +00:00
parent 03411559de
commit 0cc0f8c658
21 changed files with 4939 additions and 4885 deletions

View File

@ -26,10 +26,10 @@ E_Module *_mod_evry = NULL;
/* module setup */ /* module setup */
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, E_MODULE_API_VERSION,
"Everything" "Everything"
}; };
EAPI void * EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
@ -41,7 +41,7 @@ e_modapi_init(E_Module *m)
_e_module_evry_log_dom = eina_log_domain_register _e_module_evry_log_dom = eina_log_domain_register
("e_module_everything", EINA_LOG_DEFAULT_COLOR); ("e_module_everything", EINA_LOG_DEFAULT_COLOR);
if(_e_module_evry_log_dom < 0) if (_e_module_evry_log_dom < 0)
{ {
EINA_LOG_ERR EINA_LOG_ERR
("impossible to create a log domain for everything module"); ("impossible to create a log domain for everything module");
@ -140,7 +140,7 @@ e_modapi_init(E_Module *m)
evry_plug_calc_init(m); evry_plug_calc_init(m);
e_datastore_set("evry_api", evry); e_datastore_set("evry_api", evry);
EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em) EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
em->active = em->init(evry); em->active = em->init(evry);
evry_plug_collection_init(); evry_plug_collection_init();
@ -167,7 +167,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
Eina_List *l; Eina_List *l;
Evry_Module *em; Evry_Module *em;
EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em) EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
{ {
if (em->active) if (em->active)
em->shutdown(); em->shutdown();
@ -196,7 +196,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
_config_free(); _config_free();
evry_history_free(); evry_history_free();
EINA_LIST_FREE(_evry_types, t) EINA_LIST_FREE (_evry_types, t)
eina_stringshare_del(t); eina_stringshare_del(t);
e_configure_registry_item_del("launcher/run_everything"); e_configure_registry_item_del("launcher/run_everything");
@ -231,7 +231,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
#ifdef CHECK_REFS #ifdef CHECK_REFS
Evry_Item *it; Evry_Item *it;
EINA_LIST_FREE(_refd, it) EINA_LIST_FREE (_refd, it)
printf("%d %s\n", it->ref, it->label); printf("%d %s\n", it->ref, it->label);
#endif #endif
@ -257,12 +257,11 @@ e_modapi_save(E_Module *m __UNUSED__)
/***************************************************************************/ /***************************************************************************/
Ecore_Event_Handler * Ecore_Event_Handler *
evry_event_handler_add(int type, Eina_Bool (*func) (void *data, int type, void *event), const void *data) evry_event_handler_add(int type, Eina_Bool (*func)(void *data, int type, void *event), const void *data)
{ {
return ecore_event_handler_add(_evry_events[type], func, data); return ecore_event_handler_add(_evry_events[type], func, data);
} }
Evry_Type Evry_Type
evry_type_register(const char *type) evry_type_register(const char *type)
{ {
@ -271,13 +270,13 @@ evry_type_register(const char *type)
const char *i; const char *i;
Eina_List *l; Eina_List *l;
EINA_LIST_FOREACH(_evry_types, l, i) EINA_LIST_FOREACH (_evry_types, l, i)
{ {
if (i == t) break; if (i == t) break;
ret++; ret++;
} }
if(!l) if (!l)
{ {
_evry_types = eina_list_append(_evry_types, t); _evry_types = eina_list_append(_evry_types, t);
return ret; return ret;
@ -304,7 +303,8 @@ evry_type_get(Evry_Type type)
return ret; return ret;
} }
int evry_api_version_check(int version) int
evry_api_version_check(int version)
{ {
if (EVRY_API_VERSION == version) if (EVRY_API_VERSION == version)
return 1; return 1;
@ -314,7 +314,6 @@ int evry_api_version_check(int version)
return 0; return 0;
} }
static int static int
_evry_cb_view_sort(const void *data1, const void *data2) _evry_cb_view_sort(const void *data1, const void *data2)
{ {
@ -323,7 +322,6 @@ _evry_cb_view_sort(const void *data1, const void *data2)
return v1->priority - v2->priority; return v1->priority - v2->priority;
} }
void void
evry_view_register(Evry_View *view, int priority) evry_view_register(Evry_View *view, int priority)
{ {
@ -499,32 +497,32 @@ _config_free(void)
Plugin_Config *pc, *pc2; Plugin_Config *pc, *pc2;
Gadget_Config *gc; Gadget_Config *gc;
EINA_LIST_FREE(evry_conf->collections, pc) EINA_LIST_FREE (evry_conf->collections, pc)
EINA_LIST_FREE(pc->plugins, pc2) EINA_LIST_FREE (pc->plugins, pc2)
{ {
IF_RELEASE(pc2->name); IF_RELEASE(pc2->name);
IF_RELEASE(pc2->trigger); IF_RELEASE(pc2->trigger);
E_FREE(pc2); E_FREE(pc2);
} }
EINA_LIST_FREE(evry_conf->conf_subjects, pc) EINA_LIST_FREE (evry_conf->conf_subjects, pc)
{ {
IF_RELEASE(pc->name); IF_RELEASE(pc->name);
IF_RELEASE(pc->trigger); IF_RELEASE(pc->trigger);
E_FREE(pc); E_FREE(pc);
} }
EINA_LIST_FREE(evry_conf->conf_actions, pc) EINA_LIST_FREE (evry_conf->conf_actions, pc)
{ {
IF_RELEASE(pc->name); IF_RELEASE(pc->name);
IF_RELEASE(pc->trigger); IF_RELEASE(pc->trigger);
E_FREE(pc); E_FREE(pc);
} }
EINA_LIST_FREE(evry_conf->conf_objects, pc) EINA_LIST_FREE (evry_conf->conf_objects, pc)
{ {
IF_RELEASE(pc->name); IF_RELEASE(pc->name);
IF_RELEASE(pc->trigger); IF_RELEASE(pc->trigger);
E_FREE(pc); E_FREE(pc);
} }
EINA_LIST_FREE(evry_conf->gadgets, gc) EINA_LIST_FREE (evry_conf->gadgets, gc)
{ {
IF_RELEASE(gc->id); IF_RELEASE(gc->id);
IF_RELEASE(gc->plugin); IF_RELEASE(gc->plugin);
@ -612,3 +610,4 @@ _e_mod_menu_add(void *data __UNUSED__, E_Menu *m)
e_util_menu_item_theme_icon_set(mi, "system-run"); e_util_menu_item_theme_icon_set(mi, "system-run");
e_menu_item_callback_set(mi, _e_mod_run_cb, NULL); e_menu_item_callback_set(mi, _e_mod_run_cb, NULL);
} }

View File

@ -60,7 +60,6 @@ static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev);
static void _evry_view_show(Evry_Window *win, Evry_View *v, int slide); static void _evry_view_show(Evry_Window *win, Evry_View *v, int slide);
static void _evry_view_hide(Evry_Window *win, Evry_View *v, int slide); static void _evry_view_hide(Evry_Window *win, Evry_View *v, int slide);
static void _evry_item_desel(Evry_State *s); static void _evry_item_desel(Evry_State *s);
static void _evry_item_sel(Evry_State *s, Evry_Item *it); static void _evry_item_sel(Evry_State *s, Evry_Item *it);
@ -93,7 +92,7 @@ evry_init(void)
int int
evry_shutdown(void) evry_shutdown(void)
{ {
while(windows) while (windows)
evry_hide(windows->data, 0); evry_hide(windows->data, 0);
return 1; return 1;
@ -185,7 +184,7 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup)
if (params) if (params)
win->plugin_dedicated = EINA_TRUE; win->plugin_dedicated = EINA_TRUE;
win->sel_list = E_NEW(Evry_Selector*, 4); win->sel_list = E_NEW(Evry_Selector *, 4);
win->sel_list[3] = NULL; win->sel_list[3] = NULL;
win->selectors = win->sel_list; win->selectors = win->sel_list;
_evry_selector_new(win, EVRY_PLUGIN_SUBJECT); _evry_selector_new(win, EVRY_PLUGIN_SUBJECT);
@ -339,7 +338,7 @@ evry_hide(Evry_Window *win, int clear)
E_FREE(win->sel_list); E_FREE(win->sel_list);
EINA_LIST_FREE(win->handlers, ev) EINA_LIST_FREE (win->handlers, ev)
ecore_event_handler_del(ev); ecore_event_handler_del(ev);
if (win->grab) if (win->grab)
@ -357,7 +356,7 @@ evry_hide(Evry_Window *win, int clear)
int _cnt = eina_list_count(_refd); int _cnt = eina_list_count(_refd);
Eina_List *_l; Eina_List *_l;
printf("__________________________"); printf("__________________________");
EINA_LIST_FOREACH(_refd, _l, _it) EINA_LIST_FOREACH (_refd, _l, _it)
printf("%d %s\n", _it->ref, _it->label); printf("%d %s\n", _it->ref, _it->label);
printf("sum: %d", _cnt); printf("sum: %d", _cnt);
#endif #endif
@ -376,7 +375,7 @@ _evry_selectors_shift(Evry_Window *win, int dir)
for (i = 1; i < 3; i++) for (i = 1; i < 3; i++)
_evry_selector_item_clear(win->selectors[i]); _evry_selector_item_clear(win->selectors[i]);
if (!(new_sel = realloc(win->sel_list, sizeof(Evry_Selector*) * 6))) if (!(new_sel = realloc(win->sel_list, sizeof(Evry_Selector *) * 6)))
return 0; return 0;
win->sel_list = new_sel; win->sel_list = new_sel;
@ -433,8 +432,8 @@ _evry_selectors_shift(Evry_Window *win, int dir)
Evry_Item * Evry_Item *
evry_item_new(Evry_Item *it, Evry_Plugin *p, const char *label, evry_item_new(Evry_Item *it, Evry_Plugin *p, const char *label,
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e), Evas_Object *(*icon_get)(Evry_Item * it, Evas * e),
void (*cb_free) (Evry_Item *item)) void (*cb_free)(Evry_Item *item))
{ {
if (!it) if (!it)
{ {
@ -500,7 +499,6 @@ evry_item_ref(Evry_Item *it)
#ifdef PRINT_REFS #ifdef PRINT_REFS
printf("%d, %d\t ref : %s\n", it->ref, _item_cnt, it->label); printf("%d, %d\t ref : %s\n", it->ref, _item_cnt, it->label);
#endif #endif
} }
static int static int
@ -685,7 +683,6 @@ evry_plugin_update(Evry_Plugin *p, int action)
_evry_clear(SUBJ_SEL); _evry_clear(SUBJ_SEL);
} }
} }
} }
else if (action == EVRY_UPDATE_REFRESH) else if (action == EVRY_UPDATE_REFRESH)
{ {
@ -818,8 +815,8 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge)
if (edge == E_ZONE_EDGE_NONE) if (edge == E_ZONE_EDGE_NONE)
{ {
mw += offset_s*2; mw += offset_s * 2;
mh += offset_s*2; mh += offset_s * 2;
x = (zone->x + (zone->w * evry_conf->rel_x)) - (mw / 2); x = (zone->x + (zone->w * evry_conf->rel_x)) - (mw / 2);
y = (zone->y + (zone->h * evry_conf->rel_y)) - (mh / 2); y = (zone->y + (zone->h * evry_conf->rel_y)) - (mh / 2);
@ -834,22 +831,25 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge)
x = to_side - offset_s; x = to_side - offset_s;
y = to_side - offset_s; y = to_side - offset_s;
break; break;
case E_ZONE_EDGE_TOP_RIGHT: case E_ZONE_EDGE_TOP_RIGHT:
x = zone->w - (mw + offset_s + to_side); x = zone->w - (mw + offset_s + to_side);
y = to_side - offset_s; y = to_side - offset_s;
break; break;
case E_ZONE_EDGE_BOTTOM_RIGHT: case E_ZONE_EDGE_BOTTOM_RIGHT:
x = zone->w - (mw + offset_s + to_side); x = zone->w - (mw + offset_s + to_side);
y = zone->h - (mh + offset_s + to_side); y = zone->h - (mh + offset_s + to_side);
break; break;
case E_ZONE_EDGE_BOTTOM_LEFT: case E_ZONE_EDGE_BOTTOM_LEFT:
x = to_side - offset_s; x = to_side - offset_s;
y = zone->h - (mh + offset_s + to_side); y = zone->h - (mh + offset_s + to_side);
break; break;
default: default:
mw += offset_s*2; mw += offset_s * 2;
mh += offset_s*2; mh += offset_s * 2;
x = (zone->w * evry_conf->rel_x) - (mw / 2); x = (zone->w * evry_conf->rel_x) - (mw / 2);
y = (zone->h * evry_conf->rel_y) - (mh / 2); y = (zone->h * evry_conf->rel_y) - (mh / 2);
break; break;
@ -858,8 +858,8 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge)
x += zone->x; x += zone->x;
y += zone->y; y += zone->y;
mw += offset_s*2; mw += offset_s * 2;
mh += offset_s*2; mh += offset_s * 2;
} }
e_win_move_resize(win->ewin, x, y, mw, mh); e_win_move_resize(win->ewin, x, y, mw, mh);
@ -888,6 +888,7 @@ _evry_cb_drag_finished(E_Drag *drag, int dropped)
{ {
E_FREE(drag->data); E_FREE(drag->data);
} }
#endif #endif
static Eina_Bool static Eina_Bool
@ -1056,7 +1057,6 @@ _evry_selector_cb_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__
else else
_evry_selectors_switch(win, 1); _evry_selectors_switch(win, 1);
} }
else if (sel == ACTN_SEL) else if (sel == ACTN_SEL)
{ {
if (CUR_SEL == SUBJ_SEL) if (CUR_SEL == SUBJ_SEL)
@ -1108,7 +1108,7 @@ _evry_selector_new(Evry_Window *win, int type)
_evry_selector_cb_wheel, sel); _evry_selector_cb_wheel, sel);
} }
EINA_LIST_FOREACH(pcs, l, pc) EINA_LIST_FOREACH (pcs, l, pc)
{ {
if (!pc->plugin) continue; if (!pc->plugin) continue;
if (pc->plugin == sel->aggregator) continue; if (pc->plugin == sel->aggregator) continue;
@ -1318,7 +1318,7 @@ _evry_selector_item_update(Evry_Selector *sel)
if ((!s) || !(s->cur_item)) if ((!s) || !(s->cur_item))
{ {
/* no items for this state - clear selector */ /* no items for this state - clear selector */
_evry_selector_label_set(sel, "e.text.label",""); _evry_selector_label_set(sel, "e.text.label", "");
if (sel == CUR_SEL && s && s->plugin) if (sel == CUR_SEL && s && s->plugin)
_evry_selector_label_set(sel, "e.text.plugin", _evry_selector_label_set(sel, "e.text.plugin",
@ -1430,7 +1430,7 @@ _evry_selector_plugins_get(Evry_Selector *sel, Evry_Item *it, const char *plugin
if (it && CHECK_TYPE(it, EVRY_TYPE_ACTION)) if (it && CHECK_TYPE(it, EVRY_TYPE_ACTION))
act = (Evry_Action *)it; act = (Evry_Action *)it;
EINA_LIST_FOREACH(sel->plugins, l, p) EINA_LIST_FOREACH (sel->plugins, l, p)
{ {
if (!p->config->enabled && !win->plugin_dedicated) if (!p->config->enabled && !win->plugin_dedicated)
continue; continue;
@ -1475,7 +1475,7 @@ _evry_state_new(Evry_Selector *sel, Eina_List *plugins)
s->plugins = eina_list_append(s->plugins, p); s->plugins = eina_list_append(s->plugins, p);
s->aggregator = p; s->aggregator = p;
EINA_LIST_FOREACH(s->plugins, l, p) EINA_LIST_FOREACH (s->plugins, l, p)
p->state = s; p->state = s;
return s; return s;
@ -1527,7 +1527,7 @@ _evry_state_pop(Evry_Selector *sel, int immediate)
sel->states = eina_list_remove_list(sel->states, sel->states); sel->states = eina_list_remove_list(sel->states, sel->states);
prev = eina_list_data_get(sel->states); prev = eina_list_data_get(sel->states);
EINA_LIST_FREE(s->plugins, p) EINA_LIST_FREE (s->plugins, p)
{ {
/* skip non top-level plugins */ /* skip non top-level plugins */
if (prev && eina_list_data_find(prev->plugins, p)) if (prev && eina_list_data_find(prev->plugins, p))
@ -1564,7 +1564,7 @@ evry_state_push(Evry_Selector *sel, Eina_List *plugins)
return 0; return 0;
} }
EINA_LIST_FOREACH(plugins, l, p) EINA_LIST_FOREACH (plugins, l, p)
p->state = new_state; p->state = new_state;
if (s && s->view) if (s && s->view)
@ -1637,7 +1637,7 @@ evry_browse_item(Evry_Item *it)
/* items of type NONE can only be browsed by their own plugin */ /* items of type NONE can only be browsed by their own plugin */
if (!CHECK_TYPE(it, EVRY_TYPE_NONE)) if (!CHECK_TYPE(it, EVRY_TYPE_NONE))
{ {
EINA_LIST_FOREACH(sel->plugins, l, p) EINA_LIST_FOREACH (sel->plugins, l, p)
{ {
if (!p->browse) if (!p->browse)
continue; continue;
@ -1784,7 +1784,7 @@ evry_selectors_switch(Evry_Window *win, int dir, int slide)
if (!s || !(it = s->cur_item) || !(CHECK_TYPE(it, EVRY_TYPE_ACTION))) if (!s || !(it = s->cur_item) || !(CHECK_TYPE(it, EVRY_TYPE_ACTION)))
return 0; return 0;
GET_ACTION(act,it); GET_ACTION(act, it);
if (!act->it2.type) if (!act->it2.type)
return 0; return 0;
@ -1851,7 +1851,6 @@ _evry_input_complete(Evry_State *s)
static int static int
_evry_cheat_history(Evry_State *s, int promote, int delete) _evry_cheat_history(Evry_State *s, int promote, int delete)
{ {
History_Entry *he; History_Entry *he;
History_Item *hi; History_Item *hi;
History_Types *ht; History_Types *ht;
@ -1866,7 +1865,7 @@ _evry_cheat_history(Evry_State *s, int promote, int delete)
if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label)))) if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label))))
return 1; return 1;
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi) EINA_LIST_FOREACH_SAFE (he->items, l, ll, hi)
{ {
if (hi->plugin != it->plugin->name) if (hi->plugin != it->plugin->name)
continue; continue;
@ -1985,7 +1984,7 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event)
Eina_List *ll; Eina_List *ll;
Evry_Plugin *p; Evry_Plugin *p;
EINA_LIST_FOREACH((SUBJ_SEL)->plugins, ll, p) EINA_LIST_FOREACH ((SUBJ_SEL)->plugins, ll, p)
if (!strcmp(bind->params, p->name)) break; if (!strcmp(bind->params, p->name)) break;
if (p) if (p)
@ -2183,7 +2182,7 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event)
} }
} }
end: end:
ev->key = old; ev->key = old;
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
@ -2421,7 +2420,7 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
if (!(act->it1.item && CHECK_TYPE(act->it1.item, EVRY_TYPE_PLUGIN))) if (!(act->it1.item && CHECK_TYPE(act->it1.item, EVRY_TYPE_PLUGIN)))
act->it1.item = it_subj; act->it1.item = it_subj;
EINA_LIST_FOREACH(s_obj->sel_items, l, it) EINA_LIST_FOREACH (s_obj->sel_items, l, it)
{ {
if (it->type != act->it2.type) if (it->type != act->it2.type)
continue; continue;
@ -2432,7 +2431,7 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
} }
else if (s_subj->sel_items && !(act->it1.accept_list)) else if (s_subj->sel_items && !(act->it1.accept_list))
{ {
EINA_LIST_FOREACH(s_subj->sel_items, l, it) EINA_LIST_FOREACH (s_subj->sel_items, l, it)
{ {
if (it->type != act->it1.type) if (it->type != act->it1.type)
continue; continue;
@ -2661,7 +2660,6 @@ _evry_view_create(Evry_State *s)
return 0; return 0;
} }
static int static int
_evry_view_update(Evry_Window *win, Evry_State *s) _evry_view_update(Evry_Window *win, Evry_State *s)
{ {
@ -2708,7 +2706,7 @@ evry_view_toggle(Evry_State *s, const char *trigger)
if (trigger) if (trigger)
{ {
EINA_LIST_FOREACH(evry_conf->views, ll, view) EINA_LIST_FOREACH (evry_conf->views, ll, view)
{ {
if (view->trigger && !strncmp(trigger, view->trigger, 1) && if (view->trigger && !strncmp(trigger, view->trigger, 1) &&
(!s->view || (view->id != s->view->id)) && (!s->view || (view->id != s->view->id)) &&
@ -2735,7 +2733,7 @@ evry_view_toggle(Evry_State *s, const char *trigger)
else else
l = evry_conf->views; l = evry_conf->views;
EINA_LIST_FOREACH(l, ll, view) EINA_LIST_FOREACH (l, ll, view)
{ {
if ((!view->trigger) && if ((!view->trigger) &&
((!s->view || (view->id != s->view->id)) && ((!s->view || (view->id != s->view->id)) &&
@ -2744,7 +2742,7 @@ evry_view_toggle(Evry_State *s, const char *trigger)
} }
} }
found: found:
if (!v) return 0; if (!v) return 0;
_evry_list_win_show(win); _evry_list_win_show(win);
@ -2804,7 +2802,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
{ {
s->plugin_auto_selected = EINA_FALSE; s->plugin_auto_selected = EINA_FALSE;
EINA_LIST_FOREACH(s->cur_plugins, l, p) EINA_LIST_FOREACH (s->cur_plugins, l, p)
{ {
p->request = s->request; p->request = s->request;
p->fetch(p, s->input); p->fetch(p, s->input);
@ -2812,14 +2810,14 @@ _evry_matches_update(Evry_Selector *sel, int async)
goto found; goto found;
} }
EINA_LIST_FREE(s->cur_plugins, p); EINA_LIST_FREE (s->cur_plugins, p) ;
/* check if input matches plugin trigger */ /* check if input matches plugin trigger */
if (input) if (input)
{ {
int len_trigger = 0; int len_trigger = 0;
EINA_LIST_FOREACH(s->plugins, l, p) EINA_LIST_FOREACH (s->plugins, l, p)
{ {
if (!p->config->trigger) continue; if (!p->config->trigger) continue;
int len = strlen(p->config->trigger); int len = strlen(p->config->trigger);
@ -2833,7 +2831,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
len_trigger = len; len_trigger = len;
s->cur_plugins = eina_list_append(s->cur_plugins, p); s->cur_plugins = eina_list_append(s->cur_plugins, p);
p->request = s->request; p->request = s->request;
if(len_inp == len) if (len_inp == len)
p->fetch(p, NULL); p->fetch(p, NULL);
else else
p->fetch(p, s->input + len); p->fetch(p, s->input + len);
@ -2860,7 +2858,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
} }
/* query all other plugins for this state */ /* query all other plugins for this state */
EINA_LIST_FOREACH(s->plugins, l, p) EINA_LIST_FOREACH (s->plugins, l, p)
{ {
p->request = s->request; p->request = s->request;
@ -2899,12 +2897,12 @@ _evry_matches_update(Evry_Selector *sel, int async)
continue; continue;
} }
next: next:
if (s->plugin == p) if (s->plugin == p)
s->plugin = NULL; s->plugin = NULL;
} }
found: found:
_evry_aggregator_fetch(s); _evry_aggregator_fetch(s);
if (s->plugin_auto_selected) if (s->plugin_auto_selected)
@ -2915,7 +2913,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
if (!s->plugin) if (!s->plugin)
return; return;
EINA_LIST_FOREACH(s->plugin->items, l, it) EINA_LIST_FOREACH (s->plugin->items, l, it)
if (it->marked) if (it->marked)
s->sel_items = eina_list_append(s->sel_items, it); s->sel_items = eina_list_append(s->sel_items, it);
} }
@ -2974,7 +2972,6 @@ _evry_plugin_select(Evry_State *s, Evry_Plugin *p)
_evry_view_show(s->selector->win, s->view, 0); _evry_view_show(s->selector->win, s->view, 0);
s->view->update(s->view); s->view->update(s->view);
} }
} }
} }
@ -3016,7 +3013,7 @@ _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p)
Eina_List *l; Eina_List *l;
Evry_Plugin *p2; Evry_Plugin *p2;
EINA_LIST_FOREACH(s->cur_plugins, l, p2) EINA_LIST_FOREACH (s->cur_plugins, l, p2)
{ {
if (p == p2) if (p == p2)
return; return;
@ -3060,3 +3057,4 @@ _evry_cb_selection_notify(void *data, int type __UNUSED__, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }

View File

@ -1,9 +1,9 @@
#include "e_mod_main.h" #include "e_mod_main.h"
static void *_create_data (E_Config_Dialog *cfd); static void *_create_data(E_Config_Dialog *cfd);
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
typedef struct _Plugin_Page Plugin_Page; typedef struct _Plugin_Page Plugin_Page;
@ -59,7 +59,6 @@ struct _E_Config_Dialog_Data
Plugin_Page page[3]; Plugin_Page page[3];
}; };
EAPI E_Config_Dialog * EAPI E_Config_Dialog *
evry_config_dialog(E_Container *con, const char *params __UNUSED__) evry_config_dialog(E_Container *con, const char *params __UNUSED__)
{ {
@ -200,7 +199,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, int enabled __UNUSED__)
e_widget_ilist_freeze(obj); e_widget_ilist_freeze(obj);
e_widget_ilist_clear(obj); e_widget_ilist_clear(obj);
EINA_LIST_FOREACH(plugins, l, pc) EINA_LIST_FOREACH (plugins, l, pc)
{ {
/* if (!(end = edje_object_add(evas))) break; */ /* if (!(end = edje_object_add(evas))) break; */
@ -256,7 +255,7 @@ _plugin_move(Plugin_Page *page, int dir)
_fill_list(page->configs, page->list, 0); _fill_list(page->configs, page->list, 0);
e_widget_ilist_selected_set(page->list, sel + dir); e_widget_ilist_selected_set(page->list, sel + dir);
EINA_LIST_FOREACH(page->configs, l1, pc) EINA_LIST_FOREACH (page->configs, l1, pc)
pc->priority = prio++; pc->priority = prio++;
} }
} }
@ -274,7 +273,7 @@ _plugin_move_down_cb(void *data, void *data2 __UNUSED__)
} }
static void static void
_list_select_cb (void *data, Evas_Object *obj) _list_select_cb(void *data, Evas_Object *obj)
{ {
int sel = e_widget_ilist_selected_get(obj); int sel = e_widget_ilist_selected_get(obj);
Plugin_Config *pc = NULL; Plugin_Config *pc = NULL;
@ -600,7 +599,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
return otb; return otb;
} }
/***************************************************************************/ /***************************************************************************/
static void *_cat_create_data(E_Config_Dialog *cfd); static void *_cat_create_data(E_Config_Dialog *cfd);
@ -652,7 +650,7 @@ _cat_create_data(E_Config_Dialog *cfd)
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
cfdata->page[0].collection = EINA_TRUE; cfdata->page[0].collection = EINA_TRUE;
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) EINA_LIST_FOREACH (evry_conf->conf_subjects, l, pc)
{ {
if (pc->name == p->name) if (pc->name == p->name)
continue; continue;
@ -665,7 +663,7 @@ _cat_create_data(E_Config_Dialog *cfd)
!strcmp(pc->name, "Plugins")) !strcmp(pc->name, "Plugins"))
continue; continue;
EINA_LIST_FOREACH(p->config->plugins, ll, pc2) EINA_LIST_FOREACH (p->config->plugins, ll, pc2)
if (pc->name == pc2->name) if (pc->name == pc2->name)
break; break;
@ -743,3 +741,4 @@ _cat_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *e, E_Config_Dia
return otb; return otb;
} }

View File

@ -64,7 +64,7 @@ _illume_running(void)
Eina_List *l; Eina_List *l;
E_Module *m; E_Module *m;
EINA_LIST_FOREACH(e_module_list(), l, m) EINA_LIST_FOREACH (e_module_list(), l, m)
if (!strcmp(m->name, "illume2") && m->enabled) if (!strcmp(m->name, "illume2") && m->enabled)
return EINA_TRUE; return EINA_TRUE;
@ -110,7 +110,6 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_button_cb_mouse_down, inst); _button_cb_mouse_down, inst);
if (_illume_running()) if (_illume_running())
{ {
inst->illume_mode = EINA_TRUE; inst->illume_mode = EINA_TRUE;
@ -135,7 +134,7 @@ _gc_shutdown(E_Gadcon_Client *gcc)
instances = eina_inlist_remove(instances, EINA_INLIST_GET(inst)); instances = eina_inlist_remove(instances, EINA_INLIST_GET(inst));
EINA_LIST_FREE(inst->handlers, h) EINA_LIST_FREE (inst->handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
if (inst->del_fn && inst->win) if (inst->del_fn && inst->win)
@ -210,8 +209,8 @@ _gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
/***************************************************************************/ /***************************************************************************/
static void
static void _del_func(void *data, void *obj __UNUSED__) _del_func(void *data, void *obj __UNUSED__)
{ {
Instance *inst = data; Instance *inst = data;
@ -293,7 +292,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event)
ev = event; ev = event;
EINA_INLIST_FOREACH(instances, inst) EINA_INLIST_FOREACH (instances, inst)
if (inst == data) break; if (inst == data) break;
if ((!inst) || (!inst->win)) if ((!inst) || (!inst->win))
@ -309,6 +308,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static void static void
_gadget_popup_show(Instance *inst) _gadget_popup_show(Instance *inst)
{ {
@ -332,24 +332,28 @@ _gadget_popup_show(Instance *inst)
e_win_move(ewin, x, y + h); e_win_move(ewin, x, y + h);
inst->hide_y = -1; inst->hide_y = -1;
break; break;
case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BR:
case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BL:
e_win_move(ewin, x, y - ph); e_win_move(ewin, x, y - ph);
inst->hide_y = 1; inst->hide_y = 1;
break; break;
case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT: case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_LB:
e_win_move(ewin, x + w, y); e_win_move(ewin, x + w, y);
inst->hide_x = -1; inst->hide_x = -1;
break; break;
case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB: case E_GADCON_ORIENT_CORNER_RB:
e_win_move(ewin, x - pw, y); e_win_move(ewin, x - pw, y);
inst->hide_x = 1; inst->hide_x = 1;
break; break;
case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_VERT:
@ -362,7 +366,6 @@ _gadget_popup_show(Instance *inst)
if (ewin->y + ph > inst->win->zone->h) if (ewin->y + ph > inst->win->zone->h)
e_win_move(ewin, ewin->x, inst->win->zone->h - ph); e_win_move(ewin, ewin->x, inst->win->zone->h - ph);
} }
static void static void
@ -389,35 +392,39 @@ _gadget_window_show(Instance *inst)
case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL: case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR: case E_GADCON_ORIENT_CORNER_TR:
pw = zw/2; pw = zw / 2;
ph = zh/2; ph = zh / 2;
inst->hide_y = -1; inst->hide_y = -1;
e_win_move(ewin, zx, gy + gh); e_win_move(ewin, zx, gy + gh);
break; break;
case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BR:
case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BL:
pw = zw/2; pw = zw / 2;
ph = zh/2; ph = zh / 2;
inst->hide_y = 1; inst->hide_y = 1;
e_win_move(ewin, zx, gy - ph); e_win_move(ewin, zx, gy - ph);
break; break;
case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT: case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_LB:
pw = zw/2.5; pw = zw / 2.5;
ph = zh; ph = zh;
inst->hide_x = -1; inst->hide_x = -1;
e_win_move(ewin, gx + gw, zy); e_win_move(ewin, gx + gw, zy);
break; break;
case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB: case E_GADCON_ORIENT_CORNER_RB:
pw = zw/2.5; pw = zw / 2.5;
ph = zh; ph = zh;
inst->hide_x = 1; inst->hide_x = 1;
e_win_move(ewin, gx - pw, zy); e_win_move(ewin, gx - pw, zy);
break; break;
case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_VERT:
@ -537,7 +544,6 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
* inst->mouse_down = 1; * inst->mouse_down = 1;
* } */ * } */
int int
evry_gadget_init(void) evry_gadget_init(void)
{ {
@ -647,7 +653,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, E_Config_Dialog_Data *cfdata)
e_widget_ilist_append(obj, NULL, _("All"), NULL, NULL, NULL); e_widget_ilist_append(obj, NULL, _("All"), NULL, NULL, NULL);
EINA_LIST_FOREACH(plugins, l, pc) EINA_LIST_FOREACH (plugins, l, pc)
{ {
if (!pc->plugin) continue; if (!pc->plugin) continue;
e_widget_ilist_append(obj, NULL, pc->plugin->base.label, NULL, NULL, pc->name); e_widget_ilist_append(obj, NULL, pc->plugin->base.label, NULL, NULL, pc->name);
@ -674,8 +680,8 @@ _list_select_cb(void *data __UNUSED__, Evas_Object *obj)
int sel = e_widget_ilist_selected_get(obj); int sel = e_widget_ilist_selected_get(obj);
e_widget_ilist_nth_data_get(obj, sel); e_widget_ilist_nth_data_get(obj, sel);
} }
#endif #endif
static Evas_Object * static Evas_Object *
@ -748,3 +754,4 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
return 1; return 1;
} }

View File

@ -72,7 +72,7 @@ _hist_entry_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__
History_Entry *he = data; History_Entry *he = data;
History_Item *hi; History_Item *hi;
EINA_LIST_FREE(he->items, hi) EINA_LIST_FREE (he->items, hi)
{ {
if (hi->input) if (hi->input)
eina_stringshare_del(hi->input); eina_stringshare_del(hi->input);
@ -114,12 +114,12 @@ _hist_entry_cleanup_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *
History_Item *hi; History_Item *hi;
Eina_List *l, *ll; Eina_List *l, *ll;
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi) EINA_LIST_FOREACH_SAFE (he->items, l, ll, hi)
{ {
if (hi->last_used < d->time - SEVEN_DAYS) if (hi->last_used < d->time - SEVEN_DAYS)
{ {
hi->count--; hi->count--;
hi->last_used = d->time - SEVEN_DAYS/2.0; hi->last_used = d->time - SEVEN_DAYS / 2.0;
} }
/* item is transient or too old */ /* item is transient or too old */
@ -158,12 +158,13 @@ _hist_cleanup_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data,
{ {
eina_hash_foreach(ht->types, _hist_entry_cleanup_cb, fdata); eina_hash_foreach(ht->types, _hist_entry_cleanup_cb, fdata);
EINA_LIST_FREE(d->keys, key) EINA_LIST_FREE (d->keys, key)
eina_hash_del_by_key(ht->types, key); eina_hash_del_by_key(ht->types, key);
} }
return EINA_TRUE; return EINA_TRUE;
} }
void void
evry_history_free(void) evry_history_free(void)
{ {
@ -214,7 +215,6 @@ evry_history_load(void)
evry_hist->subjects = eina_hash_string_superfast_new(NULL); evry_hist->subjects = eina_hash_string_superfast_new(NULL);
} }
void void
evry_history_unload(void) evry_history_unload(void)
{ {
@ -305,7 +305,7 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input)
} }
else else
{ {
EINA_LIST_FOREACH(he->items, l, hi) EINA_LIST_FOREACH (he->items, l, hi)
if ((hi->plugin == it->plugin->name) && if ((hi->plugin == it->plugin->name) &&
(!rem_ctxt || (ctxt == hi->context))) (!rem_ctxt || (ctxt == hi->context)))
break; break;
@ -399,7 +399,7 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
rem_ctxt = 0; rem_ctxt = 0;
} }
EINA_LIST_FOREACH(he->items, l, hi) EINA_LIST_FOREACH (he->items, l, hi)
{ {
if (hi->plugin != it->plugin->name) if (hi->plugin != it->plugin->name)
continue; continue;
@ -456,7 +456,7 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
it->usage = hi->last_used; it->usage = hi->last_used;
} }
if (it->fuzzy_match > 0) if (it->fuzzy_match > 0)
it->usage /= (double) it->fuzzy_match; it->usage /= (double)it->fuzzy_match;
else else
it->usage /= 100.0; it->usage /= 100.0;
@ -467,3 +467,4 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
return 0; return 0;
} }

View File

@ -23,7 +23,7 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->actions, act); EINA_LIST_FREE (p->actions, act) ;
E_FREE(p); E_FREE(p);
} }
@ -57,7 +57,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN)))
{ {
EINA_LIST_FOREACH(evry_conf->actions, l, act) EINA_LIST_FOREACH (evry_conf->actions, l, act)
{ {
if (!((!act->it1.type) || if (!((!act->it1.type) ||
(CHECK_TYPE(it, act->it1.type)) || (CHECK_TYPE(it, act->it1.type)) ||
@ -77,7 +77,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
if (it->plugin) if (it->plugin)
{ {
EINA_LIST_FOREACH(it->plugin->actions, l, act) EINA_LIST_FOREACH (it->plugin->actions, l, act)
{ {
act->base.plugin = EVRY_PLUGIN(p); act->base.plugin = EVRY_PLUGIN(p);
@ -119,7 +119,6 @@ _cb_sort(const void *data1, const void *data2)
} }
if (it1->fuzzy_match || it2->fuzzy_match) if (it1->fuzzy_match || it2->fuzzy_match)
if (it1->fuzzy_match || it2->fuzzy_match) if (it1->fuzzy_match || it2->fuzzy_match)
{ {
if (it1->fuzzy_match && !it2->fuzzy_match) if (it1->fuzzy_match && !it2->fuzzy_match)
@ -129,11 +128,11 @@ _cb_sort(const void *data1, const void *data2)
return 1; return 1;
if (it1->fuzzy_match - it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
} }
if (it1->priority - it2->priority) if (it1->priority - it2->priority)
return (it1->priority - it2->priority); return it1->priority - it2->priority;
return 0; return 0;
} }
@ -148,7 +147,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FOREACH(p->actions, l, it) EINA_LIST_FOREACH (p->actions, l, it)
{ {
match = evry_fuzzy_match(it->label, input); match = evry_fuzzy_match(it->label, input);
@ -189,11 +188,10 @@ evry_plug_actions_shutdown()
evry_plugin_free(_plug); evry_plugin_free(_plug);
/* bypass unregister, because it modifies the list */ /* bypass unregister, because it modifies the list */
EINA_LIST_FREE(evry_conf->actions, it) EINA_LIST_FREE (evry_conf->actions, it)
evry_item_free(it); evry_item_free(it);
} }
void void
evry_action_register(Evry_Action *act, int priority) evry_action_register(Evry_Action *act, int priority)
{ {
@ -224,8 +222,8 @@ Evry_Action *
evry_action_new(const char *name, const char *label, evry_action_new(const char *name, const char *label,
Evry_Type type_in1, Evry_Type type_in2, Evry_Type type_in1, Evry_Type type_in2,
const char *icon, const char *icon,
int (*action) (Evry_Action *act), int (*action)(Evry_Action *act),
int (*check_item) (Evry_Action *act, const Evry_Item *it)) int (*check_item)(Evry_Action *act, const Evry_Item *it))
{ {
Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _plug, label, Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _plug, label,
NULL, _action_free_cb); NULL, _action_free_cb);
@ -251,7 +249,6 @@ evry_action_free(Evry_Action *act)
evry_item_free(EVRY_ITEM(act)); evry_item_free(EVRY_ITEM(act));
} }
/* TODO assign actions to plugins othersie there will be too liitle /* TODO assign actions to plugins othersie there will be too liitle
names soon */ names soon */
Evry_Action * Evry_Action *
@ -262,7 +259,7 @@ evry_action_find(const char *name)
const char *n = eina_stringshare_add(name); const char *n = eina_stringshare_add(name);
EINA_LIST_FOREACH(evry_conf->actions, l, act) EINA_LIST_FOREACH (evry_conf->actions, l, act)
if (act->name == n) if (act->name == n)
break; break;
@ -270,3 +267,4 @@ evry_action_find(const char *name)
return act; return act;
} }

View File

@ -17,7 +17,7 @@ struct _Plugin
static int static int
_fetch(Evry_Plugin *plugin, const char *input) _fetch(Evry_Plugin *plugin, const char *input)
{ {
Plugin *p = (Plugin *) plugin; Plugin *p = (Plugin *)plugin;
Evry_Plugin *pp; Evry_Plugin *pp;
Eina_List *l, *ll, *lp = NULL; Eina_List *l, *ll, *lp = NULL;
Evry_Item *it, *it2; Evry_Item *it, *it2;
@ -58,7 +58,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
EVRY_PLUGIN_ITEMS_FREE(p); EVRY_PLUGIN_ITEMS_FREE(p);
/* collect plugins to be shown in aggregator */ /* collect plugins to be shown in aggregator */
EINA_LIST_FOREACH(s->cur_plugins, l, pp) EINA_LIST_FOREACH (s->cur_plugins, l, pp)
{ {
/* dont show in aggregator */ /* dont show in aggregator */
if (!pp->config->aggregate) if (!pp->config->aggregate)
@ -75,7 +75,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
/* show non-top-level plugins as item */ /* show non-top-level plugins as item */
if ((top_level) && (!s->trigger_active)) if ((top_level) && (!s->trigger_active))
{ {
EINA_LIST_FOREACH(s->plugins, l, pp) EINA_LIST_FOREACH (s->plugins, l, pp)
{ {
int min_fuzz = 0; int min_fuzz = 0;
double max_usage = 0.0; double max_usage = 0.0;
@ -90,7 +90,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
continue; continue;
/* give plugin item the highest priority of its items */ /* give plugin item the highest priority of its items */
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if (it->usage >= 0) if (it->usage >= 0)
evry_history_item_usage_set(it, input, context); evry_history_item_usage_set(it, input, context);
@ -130,7 +130,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
{ {
eina_list_free(items); eina_list_free(items);
items = NULL; items = NULL;
EINA_LIST_FOREACH(pp->items, l, it) EINA_LIST_FOREACH (pp->items, l, it)
{ {
if (it->usage >= 0) if (it->usage >= 0)
evry_history_item_usage_set(it, input, context); evry_history_item_usage_set(it, input, context);
@ -145,13 +145,13 @@ _fetch(Evry_Plugin *plugin, const char *input)
/* append all plugins as items (which were not added above) */ /* append all plugins as items (which were not added above) */
if (inp_len >= plugin->config->min_query) if (inp_len >= plugin->config->min_query)
{ {
EINA_LIST_FOREACH(s->plugins, l, pp) EINA_LIST_FOREACH (s->plugins, l, pp)
{ {
if (!strcmp(pp->name, "Actions")) if (!strcmp(pp->name, "Actions"))
continue; continue;
/* items MUST only conatin plugins here ! */ /* items MUST only conatin plugins here ! */
EINA_LIST_FOREACH(items, ll, pp2) EINA_LIST_FOREACH (items, ll, pp2)
if (pp2->name == pp->name) break; if (pp2->name == pp->name) break;
if (pp2) if (pp2)
continue; continue;
@ -183,9 +183,9 @@ _fetch(Evry_Plugin *plugin, const char *input)
/* if there is input append all items that match */ /* if there is input append all items that match */
if (input) if (input)
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH (lp, l, pp)
{ {
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if (it->fuzzy_match == 0) if (it->fuzzy_match == 0)
it->fuzzy_match = evry_fuzzy_match(it->label, input); it->fuzzy_match = evry_fuzzy_match(it->label, input);
@ -204,10 +204,10 @@ _fetch(Evry_Plugin *plugin, const char *input)
/* no input: append all items that are in history */ /* no input: append all items that are in history */
else else
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH (lp, l, pp)
{ {
int cnt = 1; int cnt = 1;
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if ((!subj_sel) || (it->usage < 0) || if ((!subj_sel) || (it->usage < 0) ||
(evry_history_item_usage_set(it, input, context))) (evry_history_item_usage_set(it, input, context)))
@ -222,9 +222,9 @@ _fetch(Evry_Plugin *plugin, const char *input)
if ((!top_level) && (eina_list_count(items) < MAX_ITEMS)) if ((!top_level) && (eina_list_count(items) < MAX_ITEMS))
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH (lp, l, pp)
{ {
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if (eina_list_data_find_list(items, it)) if (eina_list_data_find_list(items, it))
continue; continue;
@ -236,13 +236,13 @@ _fetch(Evry_Plugin *plugin, const char *input)
evry_util_items_sort(&items, 0 /* !input */); evry_util_items_sort(&items, 0 /* !input */);
EINA_LIST_FOREACH(items, l, it) EINA_LIST_FOREACH (items, l, it)
{ {
/* remove duplicates provided by different plugins. e.g. /* remove duplicates provided by different plugins. e.g.
files / places and tracker can find the same files */ files / places and tracker can find the same files */
if (it->id) if (it->id)
{ {
EINA_LIST_FOREACH(p->base.items, ll, it2) EINA_LIST_FOREACH (p->base.items, ll, it2)
{ {
if ((it->plugin->name != it2->plugin->name) && if ((it->plugin->name != it2->plugin->name) &&
(it->type == it2->type) && (it->type == it2->type) &&
@ -259,7 +259,6 @@ _fetch(Evry_Plugin *plugin, const char *input)
if (cnt++ > MAX_ITEMS) if (cnt++ > MAX_ITEMS)
break; break;
} }
if (lp) eina_list_free(lp); if (lp) eina_list_free(lp);
@ -269,7 +268,6 @@ _fetch(Evry_Plugin *plugin, const char *input)
eina_list_free(items); eina_list_free(items);
return EVRY_PLUGIN_HAS_ITEMS(p); return EVRY_PLUGIN_HAS_ITEMS(p);
} }
/* 'text' and 'actions' are always loaded */ /* 'text' and 'actions' are always loaded */
else if ((subj_sel) && (eina_list_count(s->plugins) == 2)) else if ((subj_sel) && (eina_list_count(s->plugins) == 2))
{ {
@ -332,3 +330,4 @@ evry_aggregator_new(int type)
return p; return p;
} }

View File

@ -30,7 +30,7 @@ struct _Plugin
Eina_List *menu_items; Eina_List *menu_items;
Eina_Hash *added; Eina_Hash *added;
Efreet_Menu *menu;; Efreet_Menu *menu;
Evry_Item_App *command; Evry_Item_App *command;
}; };
@ -59,7 +59,7 @@ struct _Item_Menu
{ {
Evry_Item base; Evry_Item base;
Efreet_Menu *menu;; Efreet_Menu *menu;
}; };
static const Evry_API *evry = NULL; static const Evry_API *evry = NULL;
@ -81,12 +81,12 @@ static Eina_List *exe_list2 = NULL;
static Eina_List *apps_cache = NULL; static Eina_List *apps_cache = NULL;
static void _scan_executables(); static void _scan_executables();
#define GET_MENU(_m, _it) Item_Menu * _m = (Item_Menu *)_it
#define GET_MENU(_m, _it) Item_Menu *_m = (Item_Menu *)_it
/***************************************************************************/ /***************************************************************************/
static void _hash_free(void *data) static void
_hash_free(void *data)
{ {
GET_APP(app, data); GET_APP(app, data);
EVRY_ITEM_FREE(app); EVRY_ITEM_FREE(app);
@ -154,7 +154,7 @@ _cb_sort(const void *data1, const void *data2)
const Evry_Item *it2 = data2; const Evry_Item *it2 = data2;
if (it1->usage && it2->usage) if (it1->usage && it2->usage)
return (it1->usage > it2->usage ? -1 : 1); return it1->usage > it2->usage ? -1 : 1;
if (it1->usage && !it2->usage) if (it1->usage && !it2->usage)
return -1; return -1;
if (it2->usage && !it1->usage) if (it2->usage && !it1->usage)
@ -169,7 +169,7 @@ _cb_sort(const void *data1, const void *data2)
return 1; return 1;
if (it1->fuzzy_match - it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
} }
return strcasecmp(it1->label, it2->label); return strcasecmp(it1->label, it2->label);
@ -211,7 +211,7 @@ _hist_exe_get_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data,
int match; int match;
const char *exe = key; const char *exe = key;
EINA_LIST_FOREACH(he->items, l, hi) EINA_LIST_FOREACH (he->items, l, hi)
{ {
app = NULL; app = NULL;
@ -266,7 +266,7 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
if ((!exe_list) && (!exe_scan_idler)) if ((!exe_list) && (!exe_scan_idler))
_scan_executables(); _scan_executables();
EINA_LIST_FOREACH(exe_list, l, tmp) EINA_LIST_FOREACH (exe_list, l, tmp)
{ {
tmp_len = strlen(tmp); tmp_len = strlen(tmp);
@ -304,7 +304,7 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
} }
} }
EINA_LIST_FOREACH(plugin->items, l, it) EINA_LIST_FOREACH (plugin->items, l, it)
{ {
evry->history_item_usage_set(it, input, NULL); evry->history_item_usage_set(it, input, NULL);
if (input && (it->usage > max) && !strncmp(input, it->label, len)) if (input && (it->usage > max) && !strncmp(input, it->label, len))
@ -356,7 +356,7 @@ _finish_exe(Evry_Plugin *plugin)
closedir(exe_dir); closedir(exe_dir);
exe_dir = NULL; exe_dir = NULL;
} }
EINA_LIST_FREE(exe_path, str) EINA_LIST_FREE (exe_path, str)
free(str); free(str);
if (exe_scan_idler) if (exe_scan_idler)
@ -364,9 +364,9 @@ _finish_exe(Evry_Plugin *plugin)
ecore_idler_del(exe_scan_idler); ecore_idler_del(exe_scan_idler);
exe_scan_idler = NULL; exe_scan_idler = NULL;
} }
EINA_LIST_FREE(exe_list, str) EINA_LIST_FREE (exe_list, str)
free(str); free(str);
EINA_LIST_FREE(exe_list2, str) EINA_LIST_FREE (exe_list2, str)
free(str); free(str);
E_FREE(p); E_FREE(p);
@ -414,7 +414,7 @@ _desktop_list_add(Plugin *p, Eina_List *apps, const char *input)
const char *exec, *end; const char *exec, *end;
char buf[PATH_MAX]; char buf[PATH_MAX];
EINA_LIST_FOREACH(apps, l, desktop) EINA_LIST_FOREACH (apps, l, desktop)
{ {
if (eina_list_count(p->base.items) >= MAX_ITEMS) break; if (eina_list_count(p->base.items) >= MAX_ITEMS) break;
@ -457,7 +457,7 @@ _desktop_list_get(void)
/* remove screensaver */ /* remove screensaver */
cat_ss = efreet_util_desktop_category_list("Screensaver"); cat_ss = efreet_util_desktop_category_list("Screensaver");
EINA_LIST_FOREACH(cat_ss, l, d) EINA_LIST_FOREACH (cat_ss, l, d)
{ {
if ((ll = eina_list_data_find_list(apps, d))) if ((ll = eina_list_data_find_list(apps, d)))
{ {
@ -482,7 +482,7 @@ _hist_items_get_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data
Eina_List *l, *ll; Eina_List *l, *ll;
const char *exec = key; const char *exec = key;
EINA_LIST_FOREACH(he->items, l, hi) EINA_LIST_FOREACH (he->items, l, hi)
{ {
d = NULL; d = NULL;
@ -492,7 +492,7 @@ _hist_items_get_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data
if (strcmp(hi->plugin, EVRY_PLUGIN(p)->name)) if (strcmp(hi->plugin, EVRY_PLUGIN(p)->name))
continue; continue;
EINA_LIST_FOREACH(apps_cache, ll, d) EINA_LIST_FOREACH (apps_cache, ll, d)
if (d->exec && !strcmp(d->exec, exec)) break; if (d->exec && !strcmp(d->exec, exec)) break;
if (!d) if (!d)
@ -500,7 +500,7 @@ _hist_items_get_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data
if (!p->apps_all) if (!p->apps_all)
p->apps_all = _desktop_list_get(); p->apps_all = _desktop_list_get();
EINA_LIST_FOREACH(p->apps_all, ll, d) EINA_LIST_FOREACH (p->apps_all, ll, d)
if (d->exec && !strcmp(d->exec, exec)) break; if (d->exec && !strcmp(d->exec, exec)) break;
if (d) if (d)
@ -582,15 +582,15 @@ _finish(Evry_Plugin *plugin)
if ((!p->browse) && (p->menu)) if ((!p->browse) && (p->menu))
efreet_menu_free(p->menu); efreet_menu_free(p->menu);
EINA_LIST_FREE(p->apps_all, desktop) EINA_LIST_FREE (p->apps_all, desktop)
efreet_desktop_free(desktop); efreet_desktop_free(desktop);
EINA_LIST_FREE(p->apps_hist, desktop); EINA_LIST_FREE (p->apps_hist, desktop) ;
EINA_LIST_FREE(p->apps_mime, desktop) EINA_LIST_FREE (p->apps_mime, desktop)
efreet_desktop_free(desktop); efreet_desktop_free(desktop);
EINA_LIST_FREE(p->menu_items, it) EINA_LIST_FREE (p->menu_items, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
E_FREE(p); E_FREE(p);
@ -634,7 +634,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
_desktop_list_add(p, p->apps_hist, NULL); _desktop_list_add(p, p->apps_hist, NULL);
} }
EINA_LIST_FOREACH(plugin->items, l, it) EINA_LIST_FOREACH (plugin->items, l, it)
evry->history_item_usage_set(it, input, NULL); evry->history_item_usage_set(it, input, NULL);
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort); EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
@ -642,7 +642,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
if ((p->menu) && (!p->menu_items)) if ((p->menu) && (!p->menu_items))
{ {
EINA_LIST_FOREACH(p->menu->entries, l, entry) EINA_LIST_FOREACH (p->menu->entries, l, entry)
{ {
if (entry->type == EFREET_MENU_ENTRY_DESKTOP) if (entry->type == EFREET_MENU_ENTRY_DESKTOP)
{ {
@ -659,8 +659,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
} }
} }
EINA_LIST_FOREACH (p->menu_items, l, it)
EINA_LIST_FOREACH(p->menu_items, l, it)
{ {
if (!input) if (!input)
{ {
@ -723,7 +722,7 @@ _begin_mime(Evry_Plugin *plugin, const Evry_Item *item)
{ {
l = efreet_util_desktop_mime_list("text/plain"); l = efreet_util_desktop_mime_list("text/plain");
EINA_LIST_FREE(l, d) EINA_LIST_FREE (l, d)
{ {
if (!eina_list_data_find_list(p->apps_mime, d)) if (!eina_list_data_find_list(p->apps_mime, d))
p->apps_mime = eina_list_append(p->apps_mime, d); p->apps_mime = eina_list_append(p->apps_mime, d);
@ -736,7 +735,7 @@ _begin_mime(Evry_Plugin *plugin, const Evry_Item *item)
{ {
l = efreet_util_desktop_mime_list("x-directory/normal"); l = efreet_util_desktop_mime_list("x-directory/normal");
EINA_LIST_FREE(l, d) EINA_LIST_FREE (l, d)
{ {
if (!eina_list_data_find_list(p->apps_mime, d)) if (!eina_list_data_find_list(p->apps_mime, d))
p->apps_mime = eina_list_append(p->apps_mime, d); p->apps_mime = eina_list_append(p->apps_mime, d);
@ -774,7 +773,7 @@ _finish_mime(Evry_Plugin *plugin)
if (p->added) if (p->added)
eina_hash_free(p->added); eina_hash_free(p->added);
EINA_LIST_FREE(p->apps_mime, desktop) EINA_LIST_FREE (p->apps_mime, desktop)
efreet_desktop_free(desktop); efreet_desktop_free(desktop);
E_FREE(p); E_FREE(p);
@ -792,7 +791,7 @@ _fetch_mime(Evry_Plugin *plugin, const char *input)
/* add apps for a given mimetype */ /* add apps for a given mimetype */
_desktop_list_add(p, p->apps_mime, input); _desktop_list_add(p, p->apps_mime, input);
EINA_LIST_FOREACH(plugin->items, l, it) EINA_LIST_FOREACH (plugin->items, l, it)
evry->history_item_usage_set(it, input, NULL); evry->history_item_usage_set(it, input, NULL);
if (input) if (input)
@ -801,7 +800,6 @@ _fetch_mime(Evry_Plugin *plugin, const char *input)
return 1; return 1;
} }
static int static int
_complete(Evry_Plugin *plugin __UNUSED__, const Evry_Item *it, char **input) _complete(Evry_Plugin *plugin __UNUSED__, const Evry_Item *it, char **input)
{ {
@ -1074,7 +1072,7 @@ _desktop_cache_update(void *data __UNUSED__, int type __UNUSED__, void *event __
{ {
Efreet_Desktop *d; Efreet_Desktop *d;
EINA_LIST_FREE(apps_cache, d) EINA_LIST_FREE (apps_cache, d)
efreet_desktop_unref(d); efreet_desktop_unref(d);
return EINA_TRUE; return EINA_TRUE;
@ -1101,7 +1099,6 @@ _plugins_init(const Evry_API *api)
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1); evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1);
_plugins = eina_list_append(_plugins, p); _plugins = eina_list_append(_plugins, p);
p = EVRY_PLUGIN_BASE("Exebuf", _module_icon, EVRY_TYPE_APP, p = EVRY_PLUGIN_BASE("Exebuf", _module_icon, EVRY_TYPE_APP,
_begin_exe, _finish_exe, _fetch_exe); _begin_exe, _finish_exe, _fetch_exe);
p->complete = &_complete; p->complete = &_complete;
@ -1184,7 +1181,7 @@ _plugins_init(const Evry_API *api)
_check_executable); _check_executable);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
EINA_LIST_FOREACH(_actions, l, act) EINA_LIST_FOREACH (_actions, l, act)
evry->action_register(act, prio++); evry->action_register(act, prio++);
handlers = eina_list_append handlers = eina_list_append
@ -1202,16 +1199,16 @@ _plugins_shutdown(void)
Efreet_Desktop *d; Efreet_Desktop *d;
Ecore_Event_Handler *h; Ecore_Event_Handler *h;
EINA_LIST_FREE(apps_cache, d) EINA_LIST_FREE (apps_cache, d)
efreet_desktop_unref(d); efreet_desktop_unref(d);
EINA_LIST_FREE(_plugins, p) EINA_LIST_FREE (_plugins, p)
EVRY_PLUGIN_FREE(p); EVRY_PLUGIN_FREE(p);
EINA_LIST_FREE(_actions, act) EINA_LIST_FREE (_actions, act)
EVRY_ACTION_FREE(act); EVRY_ACTION_FREE(act);
EINA_LIST_FREE(handlers, h) EINA_LIST_FREE (handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
} }
@ -1298,7 +1295,6 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *e, E_Config_Dialog_Data *cf
static void static void
_fill_data(E_Config_Dialog_Data *cfdata) _fill_data(E_Config_Dialog_Data *cfdata)
{ {
#define CP(_name) cfdata->_name = strdup(_conf->_name); #define CP(_name) cfdata->_name = strdup(_conf->_name);
#define C(_name) cfdata->_name = _conf->_name; #define C(_name) cfdata->_name = _conf->_name;
CP(cmd_terminal); CP(cmd_terminal);
@ -1383,7 +1379,6 @@ _conf_init(E_Module *m)
_conf = e_config_domain_load("module.everything-apps", conf_edd); _conf = e_config_domain_load("module.everything-apps", conf_edd);
if (_conf && !e_util_module_config_check(_("Everything Applications"), if (_conf && !e_util_module_config_check(_("Everything Applications"),
_conf->version, _conf->version,
MOD_CONFIG_FILE_VERSION)) MOD_CONFIG_FILE_VERSION))
@ -1449,7 +1444,6 @@ evry_plug_apps_save(void)
/***************************************************************************/ /***************************************************************************/
/* taken from e_exebuf.c */ /* taken from e_exebuf.c */
static Eina_Bool static Eina_Bool
_scan_idler(void *data __UNUSED__) _scan_idler(void *data __UNUSED__)
@ -1578,7 +1572,7 @@ _scan_executables()
{ {
E_Exe *ee; E_Exe *ee;
EINA_LIST_FREE(el->list, ee) EINA_LIST_FREE (el->list, ee)
{ {
exe_list = eina_list_append(exe_list, strdup(ee->path)); exe_list = eina_list_append(exe_list, strdup(ee->path));
eina_stringshare_del(ee->path); eina_stringshare_del(ee->path);
@ -1607,3 +1601,4 @@ _scan_executables()
exe_scan_idler = ecore_idler_add(_scan_idler, NULL); exe_scan_idler = ecore_idler_add(_scan_idler, NULL);
} }

View File

@ -41,7 +41,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
{ {
const char *result; const char *result;
EINA_LIST_FREE(history, result) EINA_LIST_FREE (history, result)
{ {
it = EVRY_ITEM_NEW(Evry_Item, p, result, NULL, NULL); it = EVRY_ITEM_NEW(Evry_Item, p, result, NULL, NULL);
it->context = eina_stringshare_ref(p->base.name); it->context = eina_stringshare_ref(p->base.name);
@ -89,7 +89,7 @@ _finish(Evry_Plugin *plugin)
Evry_Item *it; Evry_Item *it;
int items = 0; int items = 0;
EINA_LIST_FREE(p->base.items, it) EINA_LIST_FREE (p->base.items, it)
{ {
if ((items++ > 1) && (items < 10)) if ((items++ > 1) && (items < 10))
history = eina_list_prepend(history, eina_stringshare_add(it->label)); history = eina_list_prepend(history, eina_stringshare_add(it->label));
@ -97,7 +97,7 @@ _finish(Evry_Plugin *plugin)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
} }
EINA_LIST_FREE(handlers, h) EINA_LIST_FREE (handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
if (exe) if (exe)
@ -130,7 +130,7 @@ _cb_action_performed(__UNUSED__ void *data, __UNUSED__ int type, void *event)
{ {
it = p->items->data; it = p->items->data;
EINA_LIST_FOREACH(p->items->next, l, it2) EINA_LIST_FOREACH (p->items->next, l, it2)
{ {
if (!strcmp(it->label, it2->label)) if (!strcmp(it->label, it2->label))
{ {
@ -203,7 +203,8 @@ _cb_data(void *data, int type __UNUSED__, void *event)
p->items = eina_list_prepend(p->items, cur_item); p->items = eina_list_prepend(p->items, cur_item);
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
} }
else if (it) evry->item_changed(it, 0, 0); else if (it)
evry->item_changed(it, 0, 0);
} }
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -295,3 +296,4 @@ evry_plug_calc_shutdown(void)
void void
evry_plug_calc_save(void){} evry_plug_calc_save(void){}

View File

@ -17,7 +17,7 @@ _action(Evry_Action *act)
static int static int
_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) _check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
{ {
return (it && it->label && (strlen(it->label) > 0)); return it && it->label && (strlen(it->label) > 0);
} }
Eina_Bool Eina_Bool
@ -48,3 +48,4 @@ evry_plug_clipboard_shutdown(void)
ecore_x_window_free(clipboard_win); ecore_x_window_free(clipboard_win);
evry_action_free(act); evry_action_free(act);
} }

View File

@ -1,6 +1,5 @@
#include "e_mod_main.h" #include "e_mod_main.h"
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
@ -75,7 +74,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
EINA_LIST_FOREACH(plugin->config->plugins, l, pc) EINA_LIST_FOREACH (plugin->config->plugins, l, pc)
_add_item(p, pc); _add_item(p, pc);
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
@ -90,7 +89,7 @@ _begin_all(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) EINA_LIST_FOREACH (evry_conf->conf_subjects, l, pc)
{ {
if (!strcmp(pc->name, "All") || if (!strcmp(pc->name, "All") ||
!strcmp(pc->name, "Actions") || !strcmp(pc->name, "Actions") ||
@ -113,7 +112,7 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->plugins, it) EINA_LIST_FREE (p->plugins, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
E_FREE(p); E_FREE(p);
@ -181,7 +180,7 @@ evry_plug_collection_init(void)
p->config->view_mode = VIEW_MODE_THUMB; p->config->view_mode = VIEW_MODE_THUMB;
} }
EINA_LIST_FOREACH(evry_conf->collections, l, pc) EINA_LIST_FOREACH (evry_conf->collections, l, pc)
{ {
p = _add_plugin(pc->name); p = _add_plugin(pc->name);
EVRY_ITEM_ICON_SET(p, "start-here"); EVRY_ITEM_ICON_SET(p, "start-here");
@ -200,7 +199,7 @@ evry_plug_collection_shutdown(void)
{ {
Evry_Plugin *p; Evry_Plugin *p;
EINA_LIST_FREE(plugins, p) EINA_LIST_FREE (plugins, p)
{ {
if (p->config_path) if (p->config_path)
{ {
@ -211,3 +210,4 @@ evry_plug_collection_shutdown(void)
EVRY_PLUGIN_FREE(p); EVRY_PLUGIN_FREE(p);
} }
} }

View File

@ -1,8 +1,8 @@
/*************************************************** /***************************************************
TODO option for maximum items to cache TODO option for maximum items to cache
TODO keep common list for recent file instances TODO keep common list for recent file instances
FIXME FIXME
*/ */
#include "e.h" #include "e.h"
#include "evry_api.h" #include "evry_api.h"
@ -126,7 +126,6 @@ _item_fill(Evry_Item_File *file)
if (!EVRY_ITEM(file)->detail) if (!EVRY_ITEM(file)->detail)
evry->util_file_detail_set(file); evry->util_file_detail_set(file);
evry->util_file_detail_set(file); evry->util_file_detail_set(file);
} }
@ -144,7 +143,7 @@ _cb_sort(const void *data1, const void *data2)
if (it1->fuzzy_match && it2->fuzzy_match) if (it1->fuzzy_match && it2->fuzzy_match)
if (it1->fuzzy_match - it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
return strcasecmp(it1->label, it2->label); return strcasecmp(it1->label, it2->label);
} }
@ -181,7 +180,7 @@ _scan_func(void *data, Ecore_Thread *thread)
if (!(ls = eina_file_stat_ls(d->directory))) if (!(ls = eina_file_stat_ls(d->directory)))
return; return;
EINA_ITERATOR_FOREACH(ls, info) EINA_ITERATOR_FOREACH (ls, info)
{ {
if ((d->plugin->show_hidden) != (*(info->path + info->name_start) == '.')) if ((d->plugin->show_hidden) != (*(info->path + info->name_start) == '.'))
continue; continue;
@ -210,7 +209,7 @@ _scan_mime_func(void *data, Ecore_Thread *thread)
Eina_List *l; Eina_List *l;
int cnt = 0; int cnt = 0;
EINA_LIST_FOREACH(d->files, l, file) EINA_LIST_FOREACH (d->files, l, file)
{ {
if (ecore_thread_check(thread)) if (ecore_thread_check(thread))
break; break;
@ -247,7 +246,7 @@ _files_filter(Plugin *p)
return 0; return 0;
} }
EINA_LIST_FOREACH(p->files, l, it) EINA_LIST_FOREACH (p->files, l, it)
{ {
if (cnt >= MAX_SHOWN) break; if (cnt >= MAX_SHOWN) break;
@ -283,7 +282,7 @@ _scan_cancel_func(void *data, Ecore_Thread *thread __UNUSED__)
/* EINA_LIST_FREE(p->files, file) /* EINA_LIST_FREE(p->files, file)
* EVRY_ITEM_FREE(file); */ * EVRY_ITEM_FREE(file); */
EINA_LIST_FREE(d->files, file) EINA_LIST_FREE (d->files, file)
{ {
if (file->base.label) free((char *)(file->base.label)); if (file->base.label) free((char *)(file->base.label));
if (file->path) free((char *)file->path); if (file->path) free((char *)file->path);
@ -308,7 +307,7 @@ _cache_mime_get(History_Types *ht, Evry_Item_File *file)
if ((he = eina_hash_find(ht->types, file->path))) if ((he = eina_hash_find(ht->types, file->path)))
{ {
EINA_LIST_FOREACH(he->items, l, hi) EINA_LIST_FOREACH (he->items, l, hi)
{ {
if (!hi->data) if (!hi->data)
continue; continue;
@ -331,7 +330,7 @@ _cache_dir_add(Eina_List *files)
History_Item *hi; History_Item *hi;
int cnt = 0; int cnt = 0;
EINA_LIST_REVERSE_FOREACH(files, l, item) EINA_LIST_REVERSE_FOREACH (files, l, item)
{ {
GET_FILE(file, item); GET_FILE(file, item);
@ -339,7 +338,7 @@ _cache_dir_add(Eina_List *files)
(hi = evry->history_item_add(item, NULL, NULL))) (hi = evry->history_item_add(item, NULL, NULL)))
{ {
hi->last_used = SIX_DAYS_AGO; hi->last_used = SIX_DAYS_AGO;
hi->usage = MIN_USAGE * (double) cnt++; hi->usage = MIN_USAGE * (double)cnt++;
hi->data = eina_stringshare_ref(file->mime); hi->data = eina_stringshare_ref(file->mime);
item->hi = hi; item->hi = hi;
} }
@ -347,7 +346,7 @@ _cache_dir_add(Eina_List *files)
(item->hi->last_used < SIX_DAYS_AGO)) (item->hi->last_used < SIX_DAYS_AGO))
{ {
item->hi->last_used = SIX_DAYS_AGO; item->hi->last_used = SIX_DAYS_AGO;
item->hi->usage = MIN_USAGE * (double) cnt++; item->hi->usage = MIN_USAGE * (double)cnt++;
} }
} }
} }
@ -358,7 +357,7 @@ _file_add(Plugin *p, Evry_Item *item)
GET_FILE(file, item); GET_FILE(file, item);
char *filename = (char *)item->label; char *filename = (char *)item->label;
char *path = (char *) file->path; char *path = (char *)file->path;
file->path = eina_stringshare_add(path); file->path = eina_stringshare_add(path);
file->mime = eina_stringshare_ref(file->mime); file->mime = eina_stringshare_ref(file->mime);
@ -390,7 +389,7 @@ _scan_end_func(void *data, Ecore_Thread *thread __UNUSED__)
if (!d->run_cnt) /* _scan_func finished */ if (!d->run_cnt) /* _scan_func finished */
{ {
EINA_LIST_FOREACH_SAFE(d->files, l, ll, item) EINA_LIST_FOREACH_SAFE (d->files, l, ll, item)
{ {
GET_FILE(file, item); GET_FILE(file, item);
@ -412,10 +411,10 @@ _scan_end_func(void *data, Ecore_Thread *thread __UNUSED__)
} }
else /* _scan_mime_func finished */ else /* _scan_mime_func finished */
{ {
EINA_LIST_FREE(d->files, file) EINA_LIST_FREE (d->files, file)
{ {
if (!file->mime) break; if (!file->mime) break;
_file_add(p, (Evry_Item*) file); _file_add(p, (Evry_Item *)file);
} }
} }
@ -457,7 +456,7 @@ _dir_watcher(void *data, Ecore_File_Monitor *em __UNUSED__, Ecore_File_Event eve
switch (event) switch (event)
{ {
case ECORE_FILE_EVENT_DELETED_SELF: case ECORE_FILE_EVENT_DELETED_SELF:
EINA_LIST_FREE(p->files, file) EINA_LIST_FREE (p->files, file)
evry->item_free(EVRY_ITEM(file)); evry->item_free(EVRY_ITEM(file));
break; break;
@ -479,7 +478,7 @@ _dir_watcher(void *data, Ecore_File_Monitor *em __UNUSED__, Ecore_File_Event eve
case ECORE_FILE_EVENT_DELETED_DIRECTORY: case ECORE_FILE_EVENT_DELETED_DIRECTORY:
label = eina_stringshare_add(path); label = eina_stringshare_add(path);
EINA_LIST_FOREACH_SAFE(p->files, l, ll, file) EINA_LIST_FOREACH_SAFE (p->files, l, ll, file)
{ {
if (file->path != label) continue; if (file->path != label) continue;
@ -627,7 +626,7 @@ _free_files(Plugin *p)
ecore_thread_cancel(p->thread); ecore_thread_cancel(p->thread);
p->thread = NULL; p->thread = NULL;
EINA_LIST_FREE(p->files, file) EINA_LIST_FREE (p->files, file)
EVRY_ITEM_FREE(file); EVRY_ITEM_FREE(file);
if (p->dir_mon) if (p->dir_mon)
@ -690,7 +689,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
return 0; return 0;
} }
int len = strlen(p->directory); int len = strlen(p->directory);
len = (len == 1) ? len : len+1; len = (len == 1) ? len : len + 1;
p->input = eina_stringshare_add(input + len); p->input = eina_stringshare_add(input + len);
} }
@ -780,11 +779,11 @@ _cb_sort_recent(const void *data1, const void *data2)
return 1; return 1;
if (it1->hi && it2->hi) if (it1->hi && it2->hi)
return (it1->hi->last_used > it2->hi->last_used ? -1 : 1); return it1->hi->last_used > it2->hi->last_used ? -1 : 1;
if (it1->fuzzy_match && it2->fuzzy_match) if (it1->fuzzy_match && it2->fuzzy_match)
if (it1->fuzzy_match - it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
return strcasecmp(it1->label, it2->label); return strcasecmp(it1->label, it2->label);
} }
@ -799,7 +798,7 @@ _recentf_files_filter(Plugin *p)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FOREACH(p->files, l, it) EINA_LIST_FOREACH (p->files, l, it)
{ {
if (p->dirs_only && !it->browseable) if (p->dirs_only && !it->browseable)
continue; continue;
@ -833,7 +832,7 @@ _recentf_files_filter(Plugin *p)
new = eina_list_sort(new, -1, _cb_sort_recent); new = eina_list_sort(new, -1, _cb_sort_recent);
EINA_LIST_FREE(new, it) EINA_LIST_FREE (new, it)
{ {
if (cnt++ < MAX_SHOWN) if (cnt++ < MAX_SHOWN)
EVRY_PLUGIN_ITEM_APPEND(p, it); EVRY_PLUGIN_ITEM_APPEND(p, it);
@ -842,7 +841,6 @@ _recentf_files_filter(Plugin *p)
return cnt; return cnt;
} }
#if 0 #if 0
/* use thread only to not block ui for ecore_file_exists ... */ /* use thread only to not block ui for ecore_file_exists ... */
@ -853,7 +851,7 @@ _recentf_func(void *data)
Eina_List *l; Eina_List *l;
Evry_Item_File *file; Evry_Item_File *file;
EINA_LIST_FOREACH(d->files, l, file) EINA_LIST_FOREACH (d->files, l, file)
{ {
if ((!evry->file_path_get(file)) || if ((!evry->file_path_get(file)) ||
(!ecore_file_exists(file->path))) (!ecore_file_exists(file->path)))
@ -871,7 +869,7 @@ _recentf_cancel_func(void *data)
Plugin *p = d->plugin; Plugin *p = d->plugin;
Evry_Item_File *file; Evry_Item_File *file;
EINA_LIST_FREE(d->files, file) EINA_LIST_FREE (d->files, file)
EVRY_ITEM_FREE(file); EVRY_ITEM_FREE(file);
E_FREE(d); E_FREE(d);
@ -887,7 +885,7 @@ _recentf_end_func(void *data)
Plugin *p = d->plugin; Plugin *p = d->plugin;
Evry_Item *it; Evry_Item *it;
EINA_LIST_FREE(d->files, it) EINA_LIST_FREE (d->files, it)
{ {
GET_FILE(file, it); GET_FILE(file, it);
@ -912,6 +910,7 @@ _recentf_end_func(void *data)
p->thread = NULL; p->thread = NULL;
E_FREE(d); E_FREE(d);
} }
#endif #endif
static Eina_Bool static Eina_Bool
@ -928,7 +927,7 @@ _recentf_items_add_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *d
const char *path; const char *path;
int match = 0; int match = 0;
EINA_LIST_FOREACH(he->items, l, hi2) EINA_LIST_FOREACH (he->items, l, hi2)
if (hi2->last_used > last_used) if (hi2->last_used > last_used)
{ {
last_used = hi2->last_used; last_used = hi2->last_used;
@ -962,14 +961,14 @@ _recentf_items_add_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *d
return EINA_TRUE; return EINA_TRUE;
} }
path = (const char *) key; path = (const char *)key;
if (!(label = ecore_file_file_get(path))) if (!(label = ecore_file_file_get(path)))
return EINA_TRUE; return EINA_TRUE;
path = eina_stringshare_add(path); path = eina_stringshare_add(path);
EINA_LIST_FOREACH(p->files, ll, file) EINA_LIST_FOREACH (p->files, ll, file)
{ {
if (file->path == path) if (file->path == path)
{ {
@ -1105,7 +1104,7 @@ _recentf_fetch(Evry_Plugin *plugin, const char *input)
Data *d = E_NEW(Data, 1); Data *d = E_NEW(Data, 1);
d->plugin = p; d->plugin = p;
eina_hash_foreach(ht->types, _recentf_items_add_cb, d); eina_hash_foreach(ht->types, _recentf_items_add_cb, d);
EINA_LIST_FREE(d->files, file) EINA_LIST_FREE (d->files, file)
p->files = eina_list_append(p->files, file); p->files = eina_list_append(p->files, file);
E_FREE(d); E_FREE(d);
@ -1130,7 +1129,7 @@ _recentf_fetch(Evry_Plugin *plugin, const char *input)
static int static int
_open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it) _open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it)
{ {
return (it->browseable && e_action_find("fileman")); return it->browseable && e_action_find("fileman");
} }
static int static int
@ -1185,7 +1184,7 @@ _file_trash_action(Evry_Action *act)
efreet_uri_free(euri); efreet_uri_free(euri);
} }
return (ok > 0); return ok > 0;
} }
static int static int
@ -1234,7 +1233,7 @@ _sort_by_date(Plugin *p)
Evry_Item_File *file; Evry_Item_File *file;
struct stat s; struct stat s;
EINA_LIST_FOREACH(p->files, l, file) EINA_LIST_FOREACH (p->files, l, file)
{ {
if (file->modified) if (file->modified)
continue; continue;
@ -1249,22 +1248,21 @@ _sort_by_date(Plugin *p)
_files_filter(p); _files_filter(p);
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
} }
static void static void
_sort_by_name(Plugin *p) _sort_by_name(Plugin *p)
{ {
Eina_List *l; Eina_List *l;
Evry_Item *it; Evry_Item *it;
EINA_LIST_FOREACH(p->files, l, it) EINA_LIST_FOREACH (p->files, l, it)
it->usage = 0; it->usage = 0;
p->files = eina_list_sort(p->files, -1, _cb_sort); p->files = eina_list_sort(p->files, -1, _cb_sort);
_files_filter(p); _files_filter(p);
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
} }
static int static int
@ -1304,7 +1302,6 @@ _cb_key_down(Evry_Plugin *plugin, const Ecore_Event_Key *ev)
return 0; return 0;
} }
static int static int
_plugins_init(const Evry_API *api) _plugins_init(const Evry_API *api)
{ {
@ -1356,7 +1353,6 @@ _plugins_init(const Evry_API *api)
#undef ACTION_NEW #undef ACTION_NEW
p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE, p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE,
_begin, _finish, _fetch); _begin, _finish, _fetch);
p->input_type = EVRY_TYPE_FILE; p->input_type = EVRY_TYPE_FILE;
@ -1370,7 +1366,6 @@ _plugins_init(const Evry_API *api)
if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 2)) if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 2))
p->config->min_query = 1; p->config->min_query = 1;
p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE, p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE,
_begin, _finish, _fetch); _begin, _finish, _fetch);
p->cb_key_down = &_cb_key_down; p->cb_key_down = &_cb_key_down;
@ -1421,18 +1416,17 @@ _plugins_shutdown(void)
eina_stringshare_del(_mime_mount); eina_stringshare_del(_mime_mount);
eina_stringshare_del(_mime_unknown); eina_stringshare_del(_mime_unknown);
EINA_LIST_FREE(_plugins, p) EINA_LIST_FREE (_plugins, p)
{ {
if (p->actions) if (p->actions)
eina_list_free(p->actions); eina_list_free(p->actions);
EVRY_PLUGIN_FREE(p); EVRY_PLUGIN_FREE(p);
} }
EINA_LIST_FREE(_actions, act) EINA_LIST_FREE (_actions, act)
evry->action_free(act); evry->action_free(act);
} }
/***************************************************************************/ /***************************************************************************/
static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_edd = NULL;
@ -1516,20 +1510,19 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
NULL, NULL); NULL, NULL);
e_widget_framelist_object_append(of, ow); e_widget_framelist_object_append(of, ow);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
return o; return o;
} }
static void * static void *
_create_data(E_Config_Dialog *cfd __UNUSED__) _create_data(E_Config_Dialog *cfd __UNUSED__)
{ {
E_Config_Dialog_Data *cfdata = NULL; E_Config_Dialog_Data *cfdata = NULL;
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
_fill_data(cfdata); _fill_data(cfdata);
return cfdata; return cfdata;
} }
static void static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
@ -1664,3 +1657,4 @@ evry_plug_files_save(void)
{ {
e_config_domain_save("module.everything-files", conf_edd, _conf); e_config_domain_save("module.everything-files", conf_edd, _conf);
} }

View File

@ -34,10 +34,10 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->items, it) EINA_LIST_FREE (p->items, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
EINA_LIST_FREE(p->categories, it) EINA_LIST_FREE (p->categories, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
E_FREE(p); E_FREE(p);
@ -46,7 +46,7 @@ _finish(Evry_Plugin *plugin)
static Evas_Object * static Evas_Object *
_icon_get(Evry_Item *item, Evas *e __UNUSED__) _icon_get(Evry_Item *item, Evas *e __UNUSED__)
{ {
Settings_Item *it = (Settings_Item *) item; Settings_Item *it = (Settings_Item *)item;
if (!item->icon) if (!item->icon)
{ {
@ -69,14 +69,14 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item)
if (!CHECK_TYPE(item, E_SETTINGS)) if (!CHECK_TYPE(item, E_SETTINGS))
return NULL; return NULL;
it = (Settings_Item *) item; it = (Settings_Item *)item;
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
p->parent = EINA_TRUE; p->parent = EINA_TRUE;
GET_PLUGIN(parent, item->plugin); GET_PLUGIN(parent, item->plugin);
EINA_LIST_FOREACH(parent->items, l, it2) EINA_LIST_FOREACH (parent->items, l, it2)
{ {
if (it2->ecat == it->ecat) if (it2->ecat == it->ecat)
{ {
@ -117,7 +117,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
E_Configure_Cat *ecat; E_Configure_Cat *ecat;
E_Configure_It *eci; E_Configure_It *eci;
EINA_LIST_FOREACH(e_configure_registry, l, ecat) EINA_LIST_FOREACH (e_configure_registry, l, ecat)
{ {
if ((ecat->pri < 0) || (!ecat->items)) continue; if ((ecat->pri < 0) || (!ecat->items)) continue;
if (!strcmp(ecat->cat, "system")) continue; if (!strcmp(ecat->cat, "system")) continue;
@ -127,7 +127,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
EVRY_ITEM(it)->browseable = EINA_TRUE; EVRY_ITEM(it)->browseable = EINA_TRUE;
p->categories = eina_list_append(p->categories, it); p->categories = eina_list_append(p->categories, it);
EINA_LIST_FOREACH(ecat->items, ll, eci) EINA_LIST_FOREACH (ecat->items, ll, eci)
{ {
if (eci->pri < 0) continue; if (eci->pri < 0) continue;
@ -152,7 +152,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
static int static int
_action_check(Evry_Action *act __UNUSED__, const Evry_Item *item) _action_check(Evry_Action *act __UNUSED__, const Evry_Item *item)
{ {
return !!(((Settings_Item*)item)->eci); return !!(((Settings_Item *)item)->eci);
} }
static int static int
@ -161,7 +161,7 @@ _action(Evry_Action *act)
char buf[1024]; char buf[1024];
Settings_Item *it; Settings_Item *it;
it = (Settings_Item *) act->it1.item; it = (Settings_Item *)act->it1.item;
snprintf(buf, sizeof(buf), "%s/%s", it->ecat->cat, it->eci->item); snprintf(buf, sizeof(buf), "%s/%s", it->ecat->cat, it->eci->item);
@ -200,7 +200,6 @@ _plugins_shutdown(void)
EVRY_ACTION_FREE(act); EVRY_ACTION_FREE(act);
} }
/***************************************************************************/ /***************************************************************************/
Eina_Bool Eina_Bool
@ -221,3 +220,4 @@ evry_plug_settings_shutdown(void)
void void
evry_plug_settings_save(void){} evry_plug_settings_save(void){}

View File

@ -91,3 +91,4 @@ evry_plug_text_shutdown(void)
EVRY_PLUGIN_FREE(p1); EVRY_PLUGIN_FREE(p1);
EVRY_PLUGIN_FREE(p2); EVRY_PLUGIN_FREE(p2);
} }

View File

@ -33,8 +33,7 @@ static Evas_Object *_icon_get(Evry_Item *it, Evas *e);
/***************************************************************************/ /***************************************************************************/
#define GET_BORDER(_bd, _it) Border_Item *_bd = (Border_Item *)_it; #define GET_BORDER(_bd, _it) Border_Item * _bd = (Border_Item *)_it;
static void static void
_border_item_free(Evry_Item *it) _border_item_free(Evry_Item *it)
@ -81,7 +80,7 @@ _cb_border_remove(void *data, __UNUSED__ int type, void *event)
Eina_List *l; Eina_List *l;
Plugin *p = data; Plugin *p = data;
EINA_LIST_FOREACH(p->borders, l, bi) EINA_LIST_FOREACH (p->borders, l, bi)
if (bi->border == ev->border) if (bi->border == ev->border)
break; break;
@ -98,6 +97,7 @@ _cb_border_remove(void *data, __UNUSED__ int type, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static Eina_Bool static Eina_Bool
_cb_border_add(void *data, __UNUSED__ int type, void *event) _cb_border_add(void *data, __UNUSED__ int type, void *event)
{ {
@ -116,7 +116,6 @@ _cb_border_add(void *data, __UNUSED__ int type, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static Evry_Plugin * static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
{ {
@ -134,7 +133,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
(p->handlers, ecore_event_handler_add (p->handlers, ecore_event_handler_add
(E_EVENT_BORDER_ADD, _cb_border_add, p)); (E_EVENT_BORDER_ADD, _cb_border_add, p));
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) EINA_LIST_FOREACH (e_border_focus_stack_get(), l, bd)
_border_item_add(p, bd); _border_item_add(p, bd);
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
@ -152,10 +151,10 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->borders, bi) EINA_LIST_FREE (p->borders, bi)
EVRY_ITEM_FREE(bi); EVRY_ITEM_FREE(bi);
EINA_LIST_FREE(p->handlers, h) EINA_LIST_FREE (p->handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
E_FREE(p); E_FREE(p);
@ -243,7 +242,7 @@ _icon_get(Evry_Item *it, Evas *e)
if (o) return o; if (o) return o;
} }
_use_netwm_icon: _use_netwm_icon:
if (bd->client.netwm.icons) if (bd->client.netwm.icons)
{ {
int i, size, tmp, found = 0; int i, size, tmp, found = 0;
@ -276,7 +275,6 @@ _icon_get(Evry_Item *it, Evas *e)
return o; return o;
} }
/***************************************************************************/ /***************************************************************************/
static int static int
@ -369,6 +367,7 @@ _act_border(Evry_Action *act)
e_border_desk_set(bd, e_desk_current_get(zone)); e_border_desk_set(bd, e_desk_current_get(zone));
focus = 1; focus = 1;
break; break;
default: default:
break; break;
} }
@ -474,7 +473,7 @@ _plugins_shutdown(void)
EVRY_PLUGIN_FREE(_plug); EVRY_PLUGIN_FREE(_plug);
EINA_LIST_FREE(_actions, act) EINA_LIST_FREE (_actions, act)
EVRY_ACTION_FREE(act); EVRY_ACTION_FREE(act);
} }
@ -496,3 +495,4 @@ evry_plug_windows_shutdown(void)
void void
evry_plug_windows_save(void){} evry_plug_windows_save(void){}

View File

@ -13,11 +13,10 @@ evry_plugins_shutdown(void)
{ {
Evry_Action *act; Evry_Action *act;
EINA_LIST_FREE(actions, act) EINA_LIST_FREE (actions, act)
evry_action_free(act); evry_action_free(act);
} }
static int static int
_evry_cb_plugin_sort(const void *data1, const void *data2) _evry_cb_plugin_sort(const void *data1, const void *data2)
{ {
@ -47,10 +46,10 @@ _evry_plugin_free(Evry_Item *it)
Evry_Plugin * Evry_Plugin *
evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, evry_plugin_new(Evry_Plugin *base, const char *name, const char *label,
const char *icon, Evry_Type item_type, const char *icon, Evry_Type item_type,
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item), Evry_Plugin *(*begin)(Evry_Plugin * p, const Evry_Item * item),
void (*finish) (Evry_Plugin *p), void (*finish)(Evry_Plugin *p),
int (*fetch) (Evry_Plugin *p, const char *input), int (*fetch)(Evry_Plugin *p, const char *input),
void (*cb_free) (Evry_Plugin *p)) void (*cb_free)(Evry_Plugin *p))
{ {
Evry_Plugin *p; Evry_Plugin *p;
Evry_Item *it; Evry_Item *it;
@ -134,7 +133,7 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
else if (type == EVRY_PLUGIN_OBJECT) else if (type == EVRY_PLUGIN_OBJECT)
conf = evry_conf->conf_objects; conf = evry_conf->conf_objects;
EINA_LIST_FOREACH(conf, l, pc) EINA_LIST_FOREACH (conf, l, pc)
if (pc->name && p->name && !strcmp(pc->name, p->name)) if (pc->name && p->name && !strcmp(pc->name, p->name))
break; break;
@ -227,7 +226,7 @@ evry_plugin_find(const char *name)
Eina_List *l; Eina_List *l;
const char *n = eina_stringshare_add(name); const char *n = eina_stringshare_add(name);
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) EINA_LIST_FOREACH (evry_conf->conf_subjects, l, pc)
{ {
if (!pc->plugin) continue; if (!pc->plugin) continue;
if (pc->name == n) if (pc->name == n)
@ -240,3 +239,4 @@ evry_plugin_find(const char *name)
return pc->plugin; return pc->plugin;
} }

View File

@ -73,14 +73,14 @@ evry_fuzzy_match(const char *str, const char *match)
return 0; return 0;
/* remove white spaces at the beginning */ /* remove white spaces at the beginning */
for (; (*match != 0) && isspace(*match); match++); for (; (*match != 0) && isspace(*match); match++) ;
for (; (*str != 0) && isspace(*str); str++); for (; (*str != 0) && isspace(*str); str++) ;
/* count words in match */ /* count words in match */
for (m = match; (*m != 0) && (m_num < MAX_WORDS);) for (m = match; (*m != 0) && (m_num < MAX_WORDS); )
{ {
for (; (*m != 0) && !isspace(*m); m++); for (; (*m != 0) && !isspace(*m); m++) ;
for (; (*m != 0) && isspace(*m); m++); for (; (*m != 0) && isspace(*m); m++) ;
m_min[m_num++] = MAX_FUZZ; m_min[m_num++] = MAX_FUZZ;
} }
for (m = match; ip && (*m != 0); m++) for (m = match; ip && (*m != 0); m++)
@ -94,7 +94,7 @@ evry_fuzzy_match(const char *str, const char *match)
next = str; next = str;
m = match; m = match;
while((m_cnt < m_num) && (*next != 0)) while ((m_cnt < m_num) && (*next != 0))
{ {
/* reset match */ /* reset match */
if (m_cnt == 0) m = match; if (m_cnt == 0) m = match;
@ -117,15 +117,15 @@ evry_fuzzy_match(const char *str, const char *match)
if (m_cnt < m_num - 1) if (m_cnt < m_num - 1)
{ {
/* test next match */ /* test next match */
for (; (*m != 0) && !isspace(*m); m++); for (; (*m != 0) && !isspace(*m); m++) ;
for (; (*m != 0) && isspace(*m); m++); for (; (*m != 0) && isspace(*m); m++) ;
m_cnt++; m_cnt++;
break; break;
} }
else else
{ {
/* go to next word */ /* go to next word */
for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++) ;
cnt++; cnt++;
next = p; next = p;
m_cnt = 0; m_cnt = 0;
@ -172,21 +172,21 @@ evry_fuzzy_match(const char *str, const char *match)
else else
{ {
/* go to next match */ /* go to next match */
for (; (*m != 0) && !isspace(*m); m++); for (; (*m != 0) && !isspace(*m); m++) ;
} }
if (m_cnt < m_num - 1) if (m_cnt < m_num - 1)
{ {
/* test next match */ /* test next match */
for (; (*m != 0) && isspace(*m); m++); for (; (*m != 0) && isspace(*m); m++) ;
m_cnt++; m_cnt++;
break; break;
} }
else if(*p != 0) else if (*p != 0)
{ {
/* go to next word */ /* go to next word */
for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++); for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++) ;
for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++) ;
cnt++; cnt++;
next = p; next = p;
m_cnt = 0; m_cnt = 0;
@ -228,7 +228,7 @@ _evry_fuzzy_match_sort_cb(const void *data1, const void *data2)
const Evry_Item *it2 = data2; const Evry_Item *it2 = data2;
if (it1->priority - it2->priority) if (it1->priority - it2->priority)
return (it1->priority - it2->priority); return it1->priority - it2->priority;
if (it1->fuzzy_match || it2->fuzzy_match) if (it1->fuzzy_match || it2->fuzzy_match)
{ {
@ -239,7 +239,7 @@ _evry_fuzzy_match_sort_cb(const void *data1, const void *data2)
return 1; return 1;
if (it1->fuzzy_match - it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
} }
return 0; return 0;
@ -251,7 +251,6 @@ evry_fuzzy_match_sort(Eina_List *items)
return eina_list_sort(items, -1, _evry_fuzzy_match_sort_cb); return eina_list_sort(items, -1, _evry_fuzzy_match_sort_cb);
} }
static int _sort_flags = 0; static int _sort_flags = 0;
static int static int
@ -311,7 +310,7 @@ _evry_items_sort_func(const void *data1, const void *data2)
int prio2 = it2->plugin->config->priority; int prio2 = it2->plugin->config->priority;
if (prio1 - prio2) if (prio1 - prio2)
return (prio1 - prio2); return prio1 - prio2;
} }
} }
@ -326,26 +325,26 @@ _evry_items_sort_func(const void *data1, const void *data2)
return 1; return 1;
if (abs (it1->fuzzy_match - it2->fuzzy_match) > 5) if (abs (it1->fuzzy_match - it2->fuzzy_match) > 5)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
} }
/* sort recently/most frequently used items first */ /* sort recently/most frequently used items first */
if (it1->usage > 0.0 || it2->usage > 0.0) if (it1->usage > 0.0 || it2->usage > 0.0)
{ {
return (it1->usage > it2->usage ? -1 : 1); return it1->usage > it2->usage ? -1 : 1;
} }
/* sort items which match input better first */ /* sort items which match input better first */
if (it1->fuzzy_match > 0 || it2->fuzzy_match > 0) if (it1->fuzzy_match > 0 || it2->fuzzy_match > 0)
{ {
if (it1->fuzzy_match - it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match); return it1->fuzzy_match - it2->fuzzy_match;
} }
/* sort itemswith higher priority first */ /* sort itemswith higher priority first */
if ((it1->plugin == it2->plugin) && if ((it1->plugin == it2->plugin) &&
(it1->priority - it2->priority)) (it1->priority - it2->priority))
return (it1->priority - it2->priority); return it1->priority - it2->priority;
/* sort items with higher plugin priority first */ /* sort items with higher plugin priority first */
if (it1->type != EVRY_TYPE_ACTION && if (it1->type != EVRY_TYPE_ACTION &&
@ -355,7 +354,7 @@ _evry_items_sort_func(const void *data1, const void *data2)
int prio2 = it2->plugin->config->priority; int prio2 = it2->plugin->config->priority;
if (prio1 - prio2) if (prio1 - prio2)
return (prio1 - prio2); return prio1 - prio2;
} }
return strcasecmp(it1->label, it2->label); return strcasecmp(it1->label, it2->label);
@ -377,7 +376,7 @@ evry_util_plugin_items_add(Evry_Plugin *p, Eina_List *items, const char *input,
Evry_Item *it; Evry_Item *it;
int match = 0; int match = 0;
EINA_LIST_FOREACH(items, l, it) EINA_LIST_FOREACH (items, l, it)
{ {
it->fuzzy_match = 0; it->fuzzy_match = 0;
@ -438,7 +437,6 @@ evry_icon_theme_get(const char *icon, Evas *e)
return o; return o;
} }
Evas_Object * Evas_Object *
evry_util_icon_get(Evry_Item *it, Evas *e) evry_util_icon_get(Evry_Item *it, Evas *e)
{ {
@ -470,7 +468,7 @@ evry_util_icon_get(Evry_Item *it, Evas *e)
} }
if ((!it->icon) && (file->mime) && if ((!it->icon) && (file->mime) &&
(/*(!strncmp(file->mime, "image/", 6)) || */ ( /*(!strncmp(file->mime, "image/", 6)) || */
(!strncmp(file->mime, "video/", 6)) || (!strncmp(file->mime, "video/", 6)) ||
(!strncmp(file->mime, "application/pdf", 15))) && (!strncmp(file->mime, "application/pdf", 15))) &&
(evry_file_url_get(file))) (evry_file_url_get(file)))
@ -559,7 +557,7 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
opens folders, pass only the dir */ opens folders, pass only the dir */
if (!IS_BROWSEABLE(file)) if (!IS_BROWSEABLE(file))
{ {
EINA_LIST_FOREACH(app->desktop->mime_types, l, mime) EINA_LIST_FOREACH (app->desktop->mime_types, l, mime)
{ {
if (!mime) if (!mime)
continue; continue;
@ -619,7 +617,7 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
} }
else else
{ {
exe = (char *) app->file; exe = (char *)app->file;
e_exec(zone, NULL, exe, NULL, NULL); e_exec(zone, NULL, exe, NULL, NULL);
} }
} }
@ -637,24 +635,24 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
* If length == 0, the length is assumed to be strlen(string). * If length == 0, the length is assumed to be strlen(string).
* If olen == NULL, no output length is stored. * If olen == NULL, no output length is stored.
*/ */
#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) #define ISXDIGIT(x) (isxdigit((int)((unsigned char)x)))
char * char *
evry_util_url_unescape(const char *string, int length) evry_util_url_unescape(const char *string, int length)
{ {
int alloc = (length?length:(int)strlen(string))+1; int alloc = (length ? length : (int)strlen(string)) + 1;
char *ns = malloc(alloc); char *ns = malloc(alloc);
unsigned char in; unsigned char in;
int strindex=0; int strindex = 0;
unsigned long hex; unsigned long hex;
if( !ns ) if ( !ns )
return NULL; return NULL;
while(--alloc > 0) while (--alloc > 0)
{ {
in = *string; in = *string;
if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) if (('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2]))
{ {
/* this is two hexadecimal digits following a '%' */ /* this is two hexadecimal digits following a '%' */
char hexstr[3]; char hexstr[3];
@ -664,17 +662,17 @@ evry_util_url_unescape(const char *string, int length)
hexstr[2] = 0; hexstr[2] = 0;
hex = strtoul(hexstr, &ptr, 16); hex = strtoul(hexstr, &ptr, 16);
in = (unsigned char)(hex & (unsigned long) 0xFF); in = (unsigned char)(hex & (unsigned long)0xFF);
// in = ultouc(hex); /* this long is never bigger than 255 anyway */ // in = ultouc(hex); /* this long is never bigger than 255 anyway */
string+=2; string += 2;
alloc-=2; alloc -= 2;
} }
ns[strindex++] = in; ns[strindex++] = in;
string++; string++;
} }
ns[strindex]=0; /* terminate it */ ns[strindex] = 0; /* terminate it */
return ns; return ns;
} }
@ -686,19 +684,70 @@ _isalnum(unsigned char in)
{ {
switch (in) switch (in)
{ {
case '0': case '1': case '2': case '3': case '4': case '0':
case '5': case '6': case '7': case '8': case '9': case '1':
case 'a': case 'b': case 'c': case 'd': case 'e': case '2':
case 'f': case 'g': case 'h': case 'i': case 'j': case '3':
case 'k': case 'l': case 'm': case 'n': case 'o': case '4':
case 'p': case 'q': case 'r': case 's': case 't': case '5':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '6':
case 'A': case 'B': case 'C': case 'D': case 'E': case '7':
case 'F': case 'G': case 'H': case 'I': case 'J': case '8':
case 'K': case 'L': case 'M': case 'N': case 'O': case '9':
case 'P': case 'Q': case 'R': case 'S': case 'T': case 'a':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
return EINA_TRUE; return EINA_TRUE;
default: default:
break; break;
} }
@ -708,38 +757,38 @@ _isalnum(unsigned char in)
char * char *
evry_util_url_escape(const char *string, int inlength) evry_util_url_escape(const char *string, int inlength)
{ {
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1; size_t alloc = (inlength ? (size_t)inlength : strlen(string)) + 1;
char *ns; char *ns;
char *testing_ptr = NULL; char *testing_ptr = NULL;
unsigned char in; /* we need to treat the characters unsigned */ unsigned char in; /* we need to treat the characters unsigned */
size_t newlen = alloc; size_t newlen = alloc;
int strindex=0; int strindex = 0;
size_t length; size_t length;
ns = malloc(alloc); ns = malloc(alloc);
if(!ns) if (!ns)
return NULL; return NULL;
length = alloc-1; length = alloc - 1;
while(length--) while (length--)
{ {
in = *string; in = *string;
if (_isalnum(in)) if (_isalnum(in))
{ {
/* just copy this */ /* just copy this */
ns[strindex++]=in; ns[strindex++] = in;
} }
else { else {
/* encode it */ /* encode it */
newlen += 2; /* the size grows with two, since this'll become a %XX */ newlen += 2; /* the size grows with two, since this'll become a %XX */
if(newlen > alloc) if (newlen > alloc)
{ {
alloc *= 2; alloc *= 2;
testing_ptr = realloc(ns, alloc); testing_ptr = realloc(ns, alloc);
if(!testing_ptr) if (!testing_ptr)
{ {
free( ns ); free(ns);
return NULL; return NULL;
} }
else else
@ -750,15 +799,15 @@ evry_util_url_escape(const char *string, int inlength)
snprintf(&ns[strindex], 4, "%%%02X", in); snprintf(&ns[strindex], 4, "%%%02X", in);
strindex+=3; strindex += 3;
} }
string++; string++;
} }
ns[strindex]=0; /* terminate it */ ns[strindex] = 0; /* terminate it */
return ns; return ns;
} }
const char* const char *
evry_file_path_get(Evry_Item_File *file) evry_file_path_get(Evry_Item_File *file)
{ {
const char *tmp; const char *tmp;
@ -784,7 +833,7 @@ evry_file_path_get(Evry_Item_File *file)
return file->path; return file->path;
} }
const char* const char *
evry_file_url_get(Evry_Item_File *file) evry_file_url_get(Evry_Item_File *file)
{ {
char dest[PATH_MAX * 3 + 7]; char dest[PATH_MAX * 3 + 7];
@ -850,7 +899,7 @@ evry_util_md5_sum(const char *str)
int n; int n;
char md5out[(2 * MD5_HASHBYTES) + 1]; char md5out[(2 * MD5_HASHBYTES) + 1];
MD5Init (&ctx); MD5Init (&ctx);
MD5Update (&ctx, (unsigned char const*)str, MD5Update (&ctx, (unsigned char const *)str,
(unsigned)strlen (str)); (unsigned)strlen (str));
MD5Final (hash, &ctx); MD5Final (hash, &ctx);
@ -863,3 +912,4 @@ evry_util_md5_sum(const char *str)
return strdup(md5out); return strdup(md5out);
} }

View File

@ -7,7 +7,6 @@ typedef struct _Item Item;
#define SIZE_LIST 28 #define SIZE_LIST 28
#define SIZE_DETAIL 36 #define SIZE_DETAIL 36
struct _View struct _View
{ {
Evry_View view; Evry_View view;
@ -317,7 +316,7 @@ _item_show(View *v, Item *it, Evas_Object *list)
e_icon_size_get(it->image, &it->max_w, &it->max_h); e_icon_size_get(it->image, &it->max_w, &it->max_h);
if ((it->max_w > 0) && (it->max_h > 0)) if ((it->max_w > 0) && (it->max_h > 0))
evas_object_size_hint_max_set(it->image, it->max_w*2, it->max_h*2); evas_object_size_hint_max_set(it->image, it->max_w * 2, it->max_h * 2);
else else
it->max_w = -1; it->max_w = -1;
@ -334,7 +333,6 @@ _item_show(View *v, Item *it, Evas_Object *list)
else it->have_thumb = EINA_TRUE; else it->have_thumb = EINA_TRUE;
} }
if ((it->get_thumb) || (CHECK_TYPE(it->item, EVRY_TYPE_FILE) && _check_item(it->item))) if ((it->get_thumb) || (CHECK_TYPE(it->item, EVRY_TYPE_FILE) && _check_item(it->item)))
{ {
char *suffix; char *suffix;
@ -386,7 +384,6 @@ _item_hide(Item *it)
it->visible = EINA_FALSE; it->visible = EINA_FALSE;
} }
static int static int
_place_items(Smart_Data *sd) _place_items(Smart_Data *sd)
{ {
@ -419,7 +416,7 @@ _place_items(Smart_Data *sd)
div = sd->w / w; div = sd->w / w;
if (div < 1) div = 1; if (div < 1) div = 1;
ww = w + (sd->w - div * w) / div; ww = w + (sd->w - div * w) / div;
hh = ((double)h/(double)w * (double)ww); hh = ((double)h / (double)w * (double)ww);
} }
else else
{ {
@ -443,7 +440,7 @@ _place_items(Smart_Data *sd)
} }
} }
EINA_LIST_FOREACH(sd->items, l, it) EINA_LIST_FOREACH (sd->items, l, it)
{ {
it->x = x; it->x = x;
it->y = y; it->y = y;
@ -519,13 +516,13 @@ _e_smart_reconfigure_do(void *data)
time = ecore_time_get(); time = ecore_time_get();
EINA_LIST_FOREACH(sd->items, l, it) EINA_LIST_FOREACH (sd->items, l, it)
{ {
xx = sd->x - sd->cx + it->x; xx = sd->x - sd->cx + it->x;
yy = sd->y - sd->cy + it->y; yy = sd->y - sd->cy + it->y;
if (E_INTERSECTS(xx, yy, it->w, it->h, 0, sd->y - it->h*3, if (E_INTERSECTS(xx, yy, it->w, it->h, 0, sd->y - it->h * 3,
sd->x + sd->w, sd->y + sd->h + it->h*6)) sd->x + sd->w, sd->y + sd->h + it->h * 6))
{ {
if (!it->visible) if (!it->visible)
_item_show(sd->view, it, obj); _item_show(sd->view, it, obj);
@ -613,7 +610,7 @@ static void
_e_smart_color_set(Evas_Object *obj __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__){} _e_smart_color_set(Evas_Object *obj __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__){}
static void static void
_e_smart_clip_set(Evas_Object *obj __UNUSED__, Evas_Object * clip __UNUSED__){} _e_smart_clip_set(Evas_Object *obj __UNUSED__, Evas_Object *clip __UNUSED__){}
static void static void
_e_smart_clip_unset(Evas_Object *obj __UNUSED__){} _e_smart_clip_unset(Evas_Object *obj __UNUSED__){}
@ -754,8 +751,8 @@ _animator(void *data)
if (!sd) return ECORE_CALLBACK_CANCEL; if (!sd) return ECORE_CALLBACK_CANCEL;
double da; double da;
double spd = ((25.0/ (double)e_config->framerate) / double spd = ((25.0 / (double)e_config->framerate) /
(double) (1 + sd->view->zoom)); (double)(1 + sd->view->zoom));
if (spd > 0.9) spd = 0.9; if (spd > 0.9) spd = 0.9;
int wait = 0; int wait = 0;
@ -782,7 +779,6 @@ _animator(void *data)
_animator_del(data); _animator_del(data);
return ECORE_CALLBACK_CANCEL; return ECORE_CALLBACK_CANCEL;
} }
static int static int
@ -892,14 +888,14 @@ _clear_items(Evas_Object *obj)
_animator_del(obj); _animator_del(obj);
EINA_LIST_FOREACH(sd->items, l, it) EINA_LIST_FOREACH (sd->items, l, it)
_item_hide(it); _item_hide(it);
} }
static void static void
_view_clear(Evry_View *view) _view_clear(Evry_View *view)
{ {
View *v = (View*) view; View *v = (View *)view;
Smart_Data *sd = evas_object_smart_data_get(v->span); Smart_Data *sd = evas_object_smart_data_get(v->span);
Item *it; Item *it;
if (!sd) return; if (!sd) return;
@ -913,7 +909,7 @@ _view_clear(Evry_View *view)
if (sd->items) if (sd->items)
{ {
EINA_LIST_FREE(sd->items, it) EINA_LIST_FREE (sd->items, it)
{ {
evry_item_free(it->item); evry_item_free(it->item);
E_FREE(it); E_FREE(it);
@ -997,14 +993,14 @@ _view_update(Evry_View *view)
} }
/* go through current view items */ /* go through current view items */
EINA_LIST_FOREACH(sd->items, l, v_it) EINA_LIST_FOREACH (sd->items, l, v_it)
{ {
last_pos = v_it->pos; last_pos = v_it->pos;
v_it->pos = 0; v_it->pos = 0;
pos = 1; pos = 1;
/* go through plugins current items */ /* go through plugins current items */
EINA_LIST_FOREACH(p->items, ll, p_it) EINA_LIST_FOREACH (p->items, ll, p_it)
{ {
if (v_it->item == p_it) if (v_it->item == p_it)
{ {
@ -1022,7 +1018,7 @@ _view_update(Evry_View *view)
{ {
if (v_it->selected && v_it->frame) if (v_it->selected && v_it->frame)
edje_object_signal_emit edje_object_signal_emit
(v_it->frame,"e,state,unselected", "e"); (v_it->frame, "e,state,unselected", "e");
v_it->selected = EINA_FALSE; v_it->selected = EINA_FALSE;
} }
break; break;
@ -1051,12 +1047,12 @@ _view_update(Evry_View *view)
} }
} }
EINA_LIST_FREE(v_remove, v_it) EINA_LIST_FREE (v_remove, v_it)
_pan_item_remove(v->span, v_it); _pan_item_remove(v->span, v_it);
/* go through plugins current items */ /* go through plugins current items */
pos = 1; pos = 1;
EINA_LIST_FOREACH(p->items, l, p_it) EINA_LIST_FOREACH (p->items, l, p_it)
{ {
/* item is not already in view */ /* item is not already in view */
if (!eina_list_data_find_list(v_items, p_it)) if (!eina_list_data_find_list(v_items, p_it))
@ -1096,7 +1092,7 @@ _view_update(Evry_View *view)
static int static int
_cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
{ {
View *v = (View *) view; View *v = (View *)view;
Smart_Data *sd = evas_object_smart_data_get(v->span); Smart_Data *sd = evas_object_smart_data_get(v->span);
Eina_List *l = NULL, *ll; Eina_List *l = NULL, *ll;
Item *it = NULL; Item *it = NULL;
@ -1188,7 +1184,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
(!strcmp(key, "plus"))) (!strcmp(key, "plus")))
{ {
EINA_LIST_FOREACH(sd->items, ll, it) EINA_LIST_FOREACH (sd->items, ll, it)
{ {
if (!it->item->marked) if (!it->item->marked)
{ {
@ -1202,7 +1198,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
(!strcmp(key, "minus"))) (!strcmp(key, "minus")))
{ {
EINA_LIST_FOREACH(sd->items, ll, it) EINA_LIST_FOREACH (sd->items, ll, it)
{ {
if (it->item->marked) if (it->item->marked)
{ {
@ -1290,7 +1286,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
(!evry_conf->cycle_mode) && (!evry_conf->cycle_mode) &&
(sd->cur_item)) (sd->cur_item))
{ {
EINA_LIST_FOREACH(l, ll, it) EINA_LIST_FOREACH (l, ll, it)
{ {
if (it->y > sd->cur_item->y && if (it->y > sd->cur_item->y &&
it->x >= sd->cur_item->x) it->x >= sd->cur_item->x)
@ -1314,7 +1310,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
(!evry_conf->cycle_mode) && (!evry_conf->cycle_mode) &&
(sd->cur_item)) (sd->cur_item))
{ {
for(ll = l; ll; ll = ll->prev) for (ll = l; ll; ll = ll->prev)
{ {
it = ll->data; it = ll->data;
@ -1341,7 +1337,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
if (sd->cur_item) if (sd->cur_item)
cur = sd->cur_item->y; cur = sd->cur_item->y;
EINA_LIST_FOREACH(sd->items, l, it) EINA_LIST_FOREACH (sd->items, l, it)
{ {
if (next) if (next)
{ {
@ -1377,7 +1373,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
return 0; return 0;
end: end:
return 1; return 1;
} }
@ -1391,7 +1387,7 @@ _cb_item_changed(void *data, int type __UNUSED__, void *event)
Smart_Data *sd = evas_object_smart_data_get(v->span); Smart_Data *sd = evas_object_smart_data_get(v->span);
if (!sd) return ECORE_CALLBACK_PASS_ON; if (!sd) return ECORE_CALLBACK_PASS_ON;
EINA_LIST_FOREACH(sd->items, l, it) EINA_LIST_FOREACH (sd->items, l, it)
if (it->item == ev->item) if (it->item == ev->item)
break; break;
@ -1437,9 +1433,8 @@ _cb_action_performed(void *data, int type __UNUSED__, void *event)
sd = evas_object_smart_data_get(v->span); sd = evas_object_smart_data_get(v->span);
if (!sd) return ECORE_CALLBACK_PASS_ON; if (!sd) return ECORE_CALLBACK_PASS_ON;
EINA_LIST_FOREACH(sd->items, l, it) EINA_LIST_FOREACH (sd->items, l, it)
{ {
if ((it->item == ev->it1) || if ((it->item == ev->it1) ||
(it->item == ev->it2)) (it->item == ev->it2))
break; break;
@ -1515,7 +1510,7 @@ _view_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
diff_x = abs(ev->cur.canvas.x - sd->mouse_x); diff_x = abs(ev->cur.canvas.x - sd->mouse_x);
diff_y = abs(ev->cur.canvas.y - sd->mouse_y); diff_y = abs(ev->cur.canvas.y - sd->mouse_y);
if (diff_y > 15 + (diff_x/2)) if (diff_y > 15 + (diff_x / 2))
{ {
edje_object_signal_emit(sd->view->bg, "e,action,hide,into", "e"); edje_object_signal_emit(sd->view->bg, "e,action,hide,into", "e");
edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e"); edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e");
@ -1572,19 +1567,22 @@ _view_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
} }
return; return;
end: end:
sd->it_down = NULL; sd->it_down = NULL;
sd->mouse_x = 0; sd->mouse_x = 0;
sd->mouse_y = 0; sd->mouse_y = 0;
} }
static void _cb_list_hide(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
static void
_cb_list_hide(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{ {
View *v = data; View *v = data;
v->hiding = EINA_TRUE; v->hiding = EINA_TRUE;
} }
static void _cb_list_show(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) static void
_cb_list_show(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{ {
View *v = data; View *v = data;
@ -1687,7 +1685,7 @@ _view_destroy(Evry_View *view)
evry_tab_view_free(v->tabs); evry_tab_view_free(v->tabs);
EINA_LIST_FREE(v->handlers, h) EINA_LIST_FREE (v->handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
E_FREE(v); E_FREE(v);
@ -1723,3 +1721,4 @@ evry_view_shutdown(void)
evry_view_unregister(EVRY_VIEW(view)); evry_view_unregister(EVRY_VIEW(view));
E_FREE(view); E_FREE(view);
} }

View File

@ -32,7 +32,7 @@ _cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
if (!h) h = 1; if (!h) h = 1;
e_box_align_get(o, NULL, &align); e_box_align_get(o, NULL, &align);
align = align - 10.0/(double)h; align = align - 10.0 / (double)h;
if (align < 0.0) align = 0.0; if (align < 0.0) align = 0.0;
e_box_align_set(v->o_list, 0.5, align); e_box_align_set(v->o_list, 0.5, align);
@ -46,7 +46,7 @@ _cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
if (!h) h = 1; if (!h) h = 1;
e_box_align_get(o, NULL, &align); e_box_align_get(o, NULL, &align);
align = align + 10.0/(double)h; align = align + 10.0 / (double)h;
if (align > 1.0) align = 1.0; if (align > 1.0) align = 1.0;
e_box_align_set(v->o_list, 0.5, align); e_box_align_set(v->o_list, 0.5, align);
@ -141,3 +141,4 @@ evry_view_help_shutdown(void)
evry_view_unregister(view); evry_view_unregister(view);
E_FREE(view); E_FREE(view);
} }

View File

@ -1,6 +1,5 @@
#include "e_mod_main.h" #include "e_mod_main.h"
typedef struct _Tab Tab; typedef struct _Tab Tab;
struct _Tab struct _Tab
@ -54,6 +53,7 @@ _tab_cb_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev
evry_browse_back(v->state->selector); evry_browse_back(v->state->selector);
} }
} }
static void static void
_tabs_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) _tabs_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{ {
@ -71,6 +71,7 @@ _tabs_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void
v->view->update(v->view); v->view->update(v->view);
} }
} }
static Tab * static Tab *
_add_tab(Tab_View *v, Evry_Plugin *p) _add_tab(Tab_View *v, Evry_Plugin *p)
{ {
@ -132,7 +133,7 @@ _tabs_update(Tab_View *v)
/* remove tabs for not active plugins */ /* remove tabs for not active plugins */
e_box_freeze(v->o_tabs); e_box_freeze(v->o_tabs);
EINA_LIST_FOREACH(v->tabs, l, tab) EINA_LIST_FOREACH (v->tabs, l, tab)
{ {
if (!tab->plugin) if (!tab->plugin)
continue; continue;
@ -153,11 +154,11 @@ _tabs_update(Tab_View *v)
o = tab->o_tab; o = tab->o_tab;
evas_object_show(o); evas_object_show(o);
e_box_pack_end(v->o_tabs, o); e_box_pack_end(v->o_tabs, o);
e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w/4, 10, w/3, 9999); e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w / 4, 10, w / 3, 9999);
} }
} }
for(l = s->cur_plugins; l; l = l->next, cur++) for (l = s->cur_plugins; l; l = l->next, cur++)
if (l->data == s->plugin) break; if (l->data == s->plugin) break;
if (cur > 2) if (cur > 2)
@ -173,9 +174,9 @@ _tabs_update(Tab_View *v)
} }
/* show/update tabs of active plugins */ /* show/update tabs of active plugins */
EINA_LIST_FOREACH(plugins, l, p) EINA_LIST_FOREACH (plugins, l, p)
{ {
EINA_LIST_FOREACH(v->tabs, ll, tab) EINA_LIST_FOREACH (v->tabs, ll, tab)
if (tab->plugin == p) break; if (tab->plugin == p) break;
if (!tab && !(tab = _add_tab(v, p))) if (!tab && !(tab = _add_tab(v, p)))
@ -184,7 +185,7 @@ _tabs_update(Tab_View *v)
o = tab->o_tab; o = tab->o_tab;
evas_object_show(o); evas_object_show(o);
e_box_pack_end(v->o_tabs, o); e_box_pack_end(v->o_tabs, o);
e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w/4, 10, w/3, 9999); e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w / 4, 10, w / 3, 9999);
if (s->plugin == p) if (s->plugin == p)
edje_object_signal_emit(o, "e,state,selected", "e"); edje_object_signal_emit(o, "e,state,selected", "e");
@ -198,7 +199,6 @@ _tabs_update(Tab_View *v)
e_box_thaw(v->o_tabs); e_box_thaw(v->o_tabs);
} }
static void static void
_tabs_clear(Tab_View *v) _tabs_clear(Tab_View *v)
{ {
@ -206,7 +206,7 @@ _tabs_clear(Tab_View *v)
Tab *tab; Tab *tab;
e_box_freeze(v->o_tabs); e_box_freeze(v->o_tabs);
EINA_LIST_FOREACH(v->tabs, l, tab) EINA_LIST_FOREACH (v->tabs, l, tab)
{ {
if (!tab->plugin) if (!tab->plugin)
continue; continue;
@ -254,7 +254,7 @@ _plugin_next_by_name(Tab_View *v, const char *key)
if (!s->plugin) return; if (!s->plugin) return;
EINA_LIST_FOREACH(s->cur_plugins, l, p) EINA_LIST_FOREACH (s->cur_plugins, l, p)
{ {
/* if (!p) /* if (!p)
* { * {
@ -306,7 +306,6 @@ _plugin_prev(Tab_View *v)
if (p) _plugin_select(v, p); if (p) _plugin_select(v, p);
} }
static int static int
_tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev) _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev)
{ {
@ -349,7 +348,6 @@ _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev)
return 0; return 0;
} }
Tab_View * Tab_View *
evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e) evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e)
{ {
@ -379,7 +377,7 @@ evry_tab_view_free(Tab_View *v)
{ {
Tab *tab; Tab *tab;
EINA_LIST_FREE(v->tabs, tab) EINA_LIST_FREE (v->tabs, tab)
{ {
e_box_unpack(tab->o_tab); e_box_unpack(tab->o_tab);
evas_object_del(tab->o_tab); evas_object_del(tab->o_tab);
@ -396,3 +394,4 @@ evry_tab_view_free(Tab_View *v)
E_FREE(v); E_FREE(v);
} }

View File

@ -30,23 +30,26 @@ void byteReverse(unsigned char *buf, unsigned longs);
/* /*
* Note: this code is harmless on little-endian machines. * Note: this code is harmless on little-endian machines.
*/ */
void byteReverse(unsigned char *buf, unsigned longs) void
byteReverse(unsigned char *buf, unsigned longs)
{ {
uint32_t t; uint32_t t;
do { do {
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | t = (uint32_t)((unsigned)buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]); ((unsigned)buf[1] << 8 | buf[0]);
*(uint32_t *) buf = t; *(uint32_t *)buf = t;
buf += 4; buf += 4;
} while (--longs); } while (--longs);
} }
#endif #endif
/* /*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants. * initialization constants.
*/ */
void MD5Init(MD5_CTX *ctx) void
MD5Init(MD5_CTX *ctx)
{ {
ctx->buf[0] = 0x67452301; ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89; ctx->buf[1] = 0xefcdab89;
@ -61,14 +64,15 @@ void MD5Init(MD5_CTX *ctx)
* Update context to reflect the concatenation of another buffer full * Update context to reflect the concatenation of another buffer full
* of bytes. * of bytes.
*/ */
void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len) void
MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
{ {
uint32_t t; uint32_t t;
/* Update bitcount */ /* Update bitcount */
t = ctx->bits[0]; t = ctx->bits[0];
if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) if ((ctx->bits[0] = t + ((uint32_t)len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29; ctx->bits[1] += len >> 29;
@ -76,17 +80,19 @@ void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
/* Handle any leading odd-sized chunks */ /* Handle any leading odd-sized chunks */
if (t) { if (t)
unsigned char *p = (unsigned char *) ctx->in + t; {
unsigned char *p = (unsigned char *)ctx->in + t;
t = 64 - t; t = 64 - t;
if (len < t) { if (len < t)
{
memcpy(p, buf, len); memcpy(p, buf, len);
return; return;
} }
memcpy(p, buf, t); memcpy(p, buf, t);
byteReverse(ctx->in, 16); byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *)ctx->in);
buf += t; buf += t;
len -= t; len -= t;
} }
@ -95,7 +101,7 @@ void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
while (len >= 64) { while (len >= 64) {
memcpy(ctx->in, buf, 64); memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16); byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *)ctx->in);
buf += 64; buf += 64;
len -= 64; len -= 64;
} }
@ -109,7 +115,8 @@ void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
* Final wrapup - pad to 64-byte boundary with the bit pattern * Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first) * 1 0* (64-bit count of bits processed, MSB-first)
*/ */
void MD5Final(unsigned char digest[16], MD5_CTX *ctx) void
MD5Final(unsigned char digest[16], MD5_CTX *ctx)
{ {
unsigned count; unsigned count;
unsigned char *p; unsigned char *p;
@ -126,28 +133,30 @@ void MD5Final(unsigned char digest[16], MD5_CTX *ctx)
count = 64 - 1 - count; count = 64 - 1 - count;
/* Pad out to 56 mod 64 */ /* Pad out to 56 mod 64 */
if (count < 8) { if (count < 8)
{
/* Two lots of padding: Pad the first block to 64 bytes */ /* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count); memset(p, 0, count);
byteReverse(ctx->in, 16); byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *)ctx->in);
/* Now fill the next block with 56 bytes */ /* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56); memset(ctx->in, 0, 56);
} else { }
else {
/* Pad block to 56 bytes */ /* Pad block to 56 bytes */
memset(p, 0, count - 8); memset(p, 0, count - 8);
} }
byteReverse(ctx->in, 14); byteReverse(ctx->in, 14);
/* Append length in bits and transform */ /* Append length in bits and transform */
((uint32_t *) ctx->in)[14] = ctx->bits[0]; ((uint32_t *)ctx->in)[14] = ctx->bits[0];
((uint32_t *) ctx->in)[15] = ctx->bits[1]; ((uint32_t *)ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *)ctx->in);
byteReverse((unsigned char *) ctx->buf, 4); byteReverse((unsigned char *)ctx->buf, 4);
memcpy(digest, ctx->buf, 16); memcpy(digest, ctx->buf, 16);
memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */ memset((char *)ctx, 0, sizeof(ctx)); /* In case it's sensitive */
} }
/* The four core functions - F1 is optimized somewhat */ /* The four core functions - F1 is optimized somewhat */
@ -160,14 +169,15 @@ void MD5Final(unsigned char digest[16], MD5_CTX *ctx)
/* This is the central step in the MD5 algorithm. */ /* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \ #define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)
/* /*
* The core of the MD5 algorithm, this alters an existing MD5 hash to * The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks * reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine. * the data and converts bytes into longwords for this routine.
*/ */
void MD5Transform(uint32_t buf[4], uint32_t const in[16]) void
MD5Transform(uint32_t buf[4], uint32_t const in[16])
{ {
register uint32_t a, b, c, d; register uint32_t a, b, c, d;
@ -249,3 +259,4 @@ void MD5Transform(uint32_t buf[4], uint32_t const in[16])
buf[2] += c; buf[2] += c;
buf[3] += d; buf[3] += d;
} }