diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index 45f11be93..8baae578a 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -96,9 +96,9 @@ e_modapi_init(E_Module *m) plugins = eina_module_list_get(NULL, m->dir, 1, &list_cb, NULL); if (plugins) printf("plugins loaded\n"); - else + else printf("could not find plugins in %s\n", m->dir); - + /* add module supplied action */ act = e_action_add("everything"); if (act) @@ -112,7 +112,7 @@ e_modapi_init(E_Module *m) e_configure_registry_category_add("extensions", 80, _("Extensions"), NULL, "preferences-extensions"); e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog); - + e_module_delayed_set(m, 1); return m; @@ -122,7 +122,7 @@ EAPI int e_modapi_shutdown(E_Module *m __UNUSED__) { E_Config_Dialog *cfd; - + /* remove module-supplied menu additions */ if (maug) { @@ -145,9 +145,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__) eina_module_list_unload(plugins); eina_module_list_flush(plugins); eina_array_free(plugins); - + eina_module_shutdown(); - + while ((cfd = e_config_dialog_get("E", "_config_everything_dialog"))) e_object_del(E_OBJECT(cfd)); e_configure_registry_item_del("extensions/run_everything"); e_configure_registry_category_del("extensions"); @@ -233,7 +233,7 @@ evry_plugin_register(Evry_Plugin *plugin) Eina_List *l; Plugin_Config *pc; Eina_Bool found = 0; - + evry_conf->plugins = eina_list_append(evry_conf->plugins, plugin); EINA_LIST_FOREACH(evry_conf->plugins_conf, l, pc) @@ -252,18 +252,18 @@ evry_plugin_register(Evry_Plugin *plugin) pc->enabled = 1; pc->priority = eina_list_count(evry_conf->plugins); - evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc); + evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc); } /* if (plugin->trigger && !pc->trigger) * pc->trigger = eina_stringshare_add(plugin->trigger); */ - + plugin->config = pc; evry_conf->plugins = eina_list_sort(evry_conf->plugins, eina_list_count(evry_conf->plugins), _evry_cb_plugin_sort); - + /* TODO sorting, initialization, etc */ } diff --git a/src/modules/everything/e_mod_main.h b/src/modules/everything/e_mod_main.h index 06b6b13c1..e6f1aa76a 100644 --- a/src/modules/everything/e_mod_main.h +++ b/src/modules/everything/e_mod_main.h @@ -42,7 +42,7 @@ struct _Config int auto_select_first; Eina_Hash *key_bindings; - + /**/ Eina_List *plugins; Eina_List *actions; @@ -53,10 +53,10 @@ struct _Config struct _Plugin_Config { const char *name; - + int loaded; int enabled; - + /* minimum input chars to query this source */ int min_query; @@ -69,14 +69,14 @@ struct _Plugin_Config struct _Evry_Item { Evry_Plugin *plugin; - + const char *label; const char *uri; const char *mime; Eina_Bool browseable; - + /* these are only for internally use by plugins */ /* used e.g. as pointer for item data (Efreet_Desktop) or */ /* for internal stuff, like priority hints for sorting, etc */ @@ -87,89 +87,89 @@ struct _Evry_Item Evas_Object *o_icon; Evas_Object *o_bg; }; - + struct _Evry_Plugin { const char *name; const char *icon; enum {type_subject, type_action, type_object } type; - + const char *type_in; const char *type_out; const char *trigger; - + /* sync/async ?*/ Eina_Bool async_query; /* whether candidates can be shown without input * e.g. borders, app history */ - Eina_Bool need_query; + Eina_Bool need_query; Eina_Bool browseable; - + /* run when plugin is activated. */ int (*begin) (Evry_Plugin *p, const Evry_Item *item); int (*browse) (Evry_Plugin *p, const Evry_Item *item); - + /* get candidates matching string, fills 'candidates' list */ int (*fetch) (Evry_Plugin *p, const char *input); /* run before new query and when hiding 'everything' */ void (*cleanup) (Evry_Plugin *p); - Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e); + Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e); /* provide more information for a candidate */ /* int (*candidate_info) (Evas *evas, Evry_Item *item); */ /* optional: default action for this plugins items */ int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input); Evry_Action *act; - + /* optional: create list of items when shown (e.g. for sorting) */ void (*realize_items) (Evry_Plugin *p, Evas *e); Eina_List *items; - + Evas_Object *(*config_page) (void); void (*config_apply) (void); /* only for internal use by plugin */ void *private; - + /* not to be set by plugin! */ Evas_Object *tab; Plugin_Config *config; -}; +}; struct _Evry_Action { const char *name; - + const char *type_in1; const char *type_in2; const char *type_out; - + int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input); - int (*check_item) (Evry_Action *act, const Evry_Item *it); + int (*check_item) (Evry_Action *act, const Evry_Item *it); - Evas_Object *(*icon_get) (Evry_Action *act, Evas *e); + Evas_Object *(*icon_get) (Evry_Action *act, Evas *e); /* use icon name from theme */ const char *icon; - + Eina_Bool is_default; - + /* only for internal use by plugin */ void *private; /* not to be set by plugin! */ Evas_Object *o_icon; -}; +}; struct _Evry_App { diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 02cd4e225..dc272aedc 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -3,7 +3,7 @@ /* TODO */ /* - animations - * - mouse handlers + * - mouse handlers * - show item descriptions * - keybinding configuration * - shortcuts for plugins @@ -33,7 +33,7 @@ struct _Evry_State Evry_Item *sel_item; /* Eina_List *sel_items; */ - + /* this is for the case when the current plugin was not selected manually and a higher priority (async) plugin retrieves candidates, the higher priority plugin is made current */ @@ -78,7 +78,7 @@ struct _Evry_List_Window Evas_Object *o_list; Evas_Object *o_tabs; Eina_List *items; - + int ev_last_is_mouse; Evry_Item *item_mouseover; Ecore_Animator *scroll_animator; @@ -93,14 +93,14 @@ struct _Evry_List_Window /* struct _Evry_List_Item * { * Evry_Item *item; - * + * * Evas_Object *o_icon; * Evas_Object *o_bg; - * + * * const char *label; * }; */ - + static int _evry_cb_key_down(void *data, int type, void *event); /* static int _evry_cb_mouse_down(void *data, int type, void *event); * static int _evry_cb_mouse_up(void *data, int type, void *event); @@ -169,10 +169,8 @@ static int _evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input); static int _evry_plug_aggregator_action(Evry_Plugin *p, const Evry_Item *item, const char *input); static void _evry_plug_aggregator_cleanup(Evry_Plugin *p); static Evas_Object *_evry_plug_aggregator_item_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e); -/* static int _evry_cb_plugin_sort_by_trigger(const void *data1, const void *data2); */ /* local subsystem globals */ - static Evry_Window *win = NULL; static Evry_List_Window *list = NULL; static Ecore_X_Window input_window = 0; @@ -180,7 +178,6 @@ static Eina_List *handlers = NULL; static Ecore_Timer *update_timer = NULL; static Evry_Selector *selectors[3]; static Evry_Selector *selector = NULL; - static Evry_Plugin *action_selector = NULL; /* externally accessible functions */ @@ -188,7 +185,7 @@ EAPI int evry_init(void) { _evry_plug_actions_init(); - + return 1; } @@ -204,10 +201,10 @@ EAPI int evry_show(E_Zone *zone) { if (win) return 0; - + E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - + input_window = ecore_x_window_input_new(zone->container->win, zone->x, zone->y, zone->w, zone->h); ecore_x_window_show(input_window); @@ -221,7 +218,7 @@ evry_show(E_Zone *zone) if (!list) goto error; list->visible = EINA_FALSE; - + /* TODO check NULL */ selectors[0] = _evry_selector_new(type_subject); selectors[1] = _evry_selector_new(type_action); @@ -232,17 +229,17 @@ evry_show(E_Zone *zone) _evry_selector_update(selector); e_popup_layer_set(list->popup, 255); - e_popup_layer_set(win->popup, 255); - e_popup_show(win->popup); + e_popup_layer_set(win->popup, 255); + e_popup_show(win->popup); e_popup_show(list->popup); - + if (list->visible) { e_popup_show(list->popup); _evry_list_update(selector->state); } e_box_align_set(list->o_tabs, 0.0, 0.5); - + handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL)); @@ -285,7 +282,7 @@ EAPI void evry_hide(void) { Ecore_Event *ev; - + if (!win) return; _evry_list_clear_list(selector->state); @@ -301,17 +298,17 @@ evry_hide(void) selectors[1] = NULL; selectors[2] = NULL; selector = NULL; - + _evry_list_win_free(list); list = NULL; - + _evry_window_free(win); win = NULL; EINA_LIST_FREE(handlers, ev) ecore_event_handler_del(ev); handlers = NULL; - + ecore_x_window_free(input_window); e_grabinput_release(input_window, input_window); input_window = 0; @@ -322,7 +319,7 @@ EAPI void evry_clear_input(void) { Evry_State *s = selector->state; - + if (s->input[0] != 0) { s->input[0] = 0; @@ -333,13 +330,13 @@ EAPI Evry_Item * evry_item_new(Evry_Plugin *p, const char *label) { Evry_Item *it; - + it = E_NEW(Evry_Item, 1); if (!it) return NULL; - + it->plugin = p; if (label) it->label = eina_stringshare_add(label); - + return it; } @@ -350,12 +347,6 @@ evry_item_free(Evry_Item *it) E_FREE(it); } -/* static void - * _evry_list_cb_list_shown(void *data, Evas_Object *obj, const char *emission, const char *source) - * { - * _evry_list_scroll_to(selector->state, selector->state->sel_item); - * } */ - static Evry_List_Window * _evry_list_win_new(E_Zone *zone) { @@ -363,10 +354,10 @@ _evry_list_win_new(E_Zone *zone) Evry_List_Window *list_win; E_Popup *popup; Evas_Object *o; - + x = (zone->w / 2) - (win->popup->w / 3); y = (zone->h / 2); - + popup = e_popup_new(zone, x + 50, y - 4, /*XXX get from theme ?*/ win->popup->w * 2/3 - 100, evry_conf->height); @@ -444,7 +435,7 @@ _evry_list_win_show(void) if (list->visible) return; list->visible = EINA_TRUE; - + _evry_list_update(selector->state); edje_object_signal_emit(list->o_main, "e,state,list_show", "e"); @@ -455,14 +446,14 @@ _evry_list_win_hide(void) { Eina_List *l; Evry_Plugin *p; - + if (!list->visible) return; list->visible = EINA_FALSE; EINA_LIST_FOREACH(selector->plugins, l, p) { - e_box_unpack(p->tab); + e_box_unpack(p->tab); evas_object_del(p->tab); p->tab = NULL; } @@ -490,7 +481,7 @@ _evry_window_new(E_Zone *zone) e_object_del(E_OBJECT(popup)); return NULL; } - + win->popup = popup; o = edje_object_add(popup->evas); @@ -504,7 +495,7 @@ _evry_window_new(E_Zone *zone) y = (zone->h / 2) - mh; e_popup_move_resize(popup, x, y, mw, mh); - + o = win->o_main; e_popup_edje_bg_object_set(win->popup, o); evas_object_move(o, 0, 0); @@ -512,7 +503,7 @@ _evry_window_new(E_Zone *zone) evas_object_show(o); ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY); - + return win; } @@ -558,7 +549,7 @@ _evry_selector_new(int type) } if (type == type_action) sel->plugins = eina_list_append(sel->plugins, action_selector); - + return sel; } @@ -567,7 +558,7 @@ _evry_selector_free(Evry_Selector *sel) { Evry_State *s; Evry_Plugin *p; - + if (sel->o_icon) evas_object_del(sel->o_icon); evas_object_del(sel->o_main); @@ -576,11 +567,11 @@ _evry_selector_free(Evry_Selector *sel) { _evry_list_clear_list(sel->state); } - + EINA_LIST_FREE(sel->states, s) { free(s->input); - + EINA_LIST_FREE(s->plugins, p) { p->cleanup(p); @@ -589,7 +580,7 @@ _evry_selector_free(Evry_Selector *sel) } E_FREE(s); } - + _evry_plug_aggregator_free(sel->aggregator); if (sel->plugins) eina_list_free(sel->plugins); @@ -606,35 +597,35 @@ _evry_selector_activate(Evry_Selector *sel) Eina_List *l; _evry_list_clear_list(s); - + edje_object_signal_emit(selector->o_main, "e,state,unselected", "e"); edje_object_part_text_set(selector->o_main, "e.text.plugin", ""); - + if (update_timer) { if (s->plugin && !s->plugin->async_query) { _evry_matches_update(selector); - _evry_selector_update(selector); + _evry_selector_update(selector); } ecore_timer_del(update_timer); update_timer = NULL; } - + EINA_LIST_FOREACH(selector->plugins, l, p) { - e_box_unpack(p->tab); + e_box_unpack(p->tab); evas_object_del(p->tab); p->tab = NULL; } _evry_list_win_hide(); } - + selector = sel; edje_object_signal_emit(sel->o_main, "e,state,selected", "e"); - + if (sel->state) { _evry_update_text_label(sel->state); @@ -642,8 +633,8 @@ _evry_selector_activate(Evry_Selector *sel) if (sel->state->sel_item) edje_object_part_text_set(sel->o_main, "e.text.plugin", sel->state->sel_item->plugin->name); - - if (list->visible && sel->state->plugin) + + if (list->visible && sel->state->plugin) { _evry_list_tabs_update(sel->state); _evry_list_show_items(sel->state, sel->state->plugin); @@ -657,9 +648,9 @@ _evry_selector_icon_set(Evry_Selector *sel) Evry_State *s = sel->state; Evry_Item *it; Evas_Object *o; - + if (!edje_object_part_exists(sel->o_main, "e.swallow.icons")) return; - + if (sel->o_icon) { evas_object_del(sel->o_icon); @@ -679,7 +670,7 @@ _evry_selector_icon_set(Evry_Selector *sel) evas_object_show(o); sel->o_icon = o; } - } + } else if (s->plugin && s->plugin->icon) { o = e_icon_add(win->popup->evas); @@ -709,7 +700,7 @@ _evry_selector_update(Evry_Selector *sel) s->plugin = NULL; s->sel_item = NULL; } - + it = s->sel_item; if (s->plugin && (!it || s->item_auto_selected)) @@ -723,9 +714,9 @@ _evry_selector_update(Evry_Selector *sel) } } } - + _evry_selector_icon_set(sel); - + if (it) { edje_object_part_text_set(sel->o_main, "e.text.label", it->label); @@ -739,12 +730,12 @@ _evry_selector_update(Evry_Selector *sel) { /* no items for this state - clear selector */ edje_object_part_text_set(sel->o_main, "e.text.label", ""); - if (sel == selector && s && s->plugin) + if (sel == selector && s && s->plugin) edje_object_part_text_set(sel->o_main, "e.text.plugin", s->plugin->name); else edje_object_part_text_set(sel->o_main, "e.text.plugin", ""); } - + if (sel == selectors[0]) { _evry_selector_actions_get(it); @@ -757,8 +748,8 @@ _evry_list_update(Evry_State *s) { if (!list->visible) return; if (!s->plugin) return; - - _evry_list_clear_list(s); + + _evry_list_clear_list(s); _evry_list_tabs_update(s); _evry_list_show_items(s, s->plugin); _evry_list_scroll_to(s, s->sel_item); @@ -785,7 +776,7 @@ _evry_selector_subjects_get(void) if (!plugins) return 0; _evry_state_new(sel, plugins); - + _evry_matches_update(sel); return 1; @@ -806,7 +797,7 @@ _evry_selector_actions_get(Evry_Item *it) _evry_state_new(sel, plugins); return 1; } - + EINA_LIST_FOREACH(sel->plugins, l, p) { if (strcmp(p->type_in, it->plugin->type_out) && @@ -823,9 +814,9 @@ _evry_selector_actions_get(Evry_Item *it) } if (!plugins) return 0; - + _evry_state_new(sel, plugins); - + _evry_matches_update(sel); return 1; @@ -838,14 +829,12 @@ _evry_selector_objects_get(const char *type) Evry_Plugin *p; Evry_Selector *sel = selectors[2]; Evry_Item *it; - + while (sel->state) _evry_state_pop(sel); - // TODO let 'object' plugins take subject and action - // into account. selectors[0]->state->sel_item; it = selectors[0]->state->sel_item; - + EINA_LIST_FOREACH(sel->plugins, l, p) { if (strcmp(p->type_out, type) && @@ -859,7 +848,7 @@ _evry_selector_objects_get(const char *type) else plugins = eina_list_append(plugins, p); } - + if (!plugins) return 0; _evry_state_new(sel, plugins); @@ -883,7 +872,7 @@ _evry_state_new(Evry_Selector *sel, Eina_List *plugins) sel->states = eina_list_prepend(sel->states, s); sel->state = s; - + return s; } @@ -895,11 +884,11 @@ _evry_state_pop(Evry_Selector *sel) free(sel->state->input); EINA_LIST_FREE(sel->state->plugins, p) p->cleanup(p); - + E_FREE(sel->state); - + sel->states = eina_list_remove_list(sel->states, sel->states); - + if (sel->states) sel->state = sel->states->data; else @@ -915,7 +904,7 @@ _evry_browse_item(Evry_Selector *sel) Evry_Plugin *p; it = s->sel_item; - + if (!it || !it->browseable) return; _evry_list_clear_list(sel->state); @@ -928,7 +917,7 @@ _evry_browse_item(Evry_Selector *sel) if (p->browse(p, it)) plugins = eina_list_append(plugins, p); } - + if (plugins) { _evry_state_new(sel, plugins); @@ -945,9 +934,9 @@ static void _evry_browse_back(Evry_Selector *sel) { Evry_State *s = sel->state; - + if (!s || !sel->states->next) return; - + _evry_list_clear_list(s); _evry_state_pop(sel); _evry_selector_update(sel); @@ -960,7 +949,7 @@ static void _evry_selectors_switch(void) { Evry_State *s = selector->state; - + if (selector == selectors[0]) { if (s->sel_item) @@ -969,7 +958,7 @@ _evry_selectors_switch(void) else if (selector == selectors[1]) { int next_selector = 0; - + if (s->plugin == action_selector) { Evry_Action *act; @@ -982,19 +971,19 @@ _evry_selectors_switch(void) plugin_action, update_timer !!! */ if (!s->plugin->async_query) { - _evry_list_clear_list(s); + _evry_list_clear_list(s); _evry_matches_update(selector); - _evry_selector_update(selector); + _evry_selector_update(selector); } ecore_timer_del(update_timer); update_timer = NULL; } act = s->sel_item->data[0]; - + if (act && act->type_in2) { - + sel = selectors[2]; _evry_selector_objects_get(act->type_in2); _evry_selector_update(sel); @@ -1014,7 +1003,7 @@ _evry_selectors_switch(void) while (selector->states) _evry_state_pop(selector); - + _evry_selector_activate(selectors[0]); } } @@ -1030,11 +1019,9 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) ev = event; if (ev->event_window != input_window) return 1; - if (!strcmp(ev->key, "Up")) - /* if (!strcmp(ev->key, "K")) */ + if (!strcmp(ev->key, "Up")) _evry_list_item_prev(s); else if (!strcmp(ev->key, "Down")) - /* else if (!strcmp(ev->key, "J")) */ _evry_list_item_next(s); else if (!strcmp(ev->key, "Right") && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) @@ -1043,11 +1030,9 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) _evry_list_plugin_prev(s); else if (!strcmp(ev->key, "Right")) - /* else if (!strcmp(ev->key, "L")) */ - _evry_browse_item(selector); + _evry_browse_item(selector); else if (!strcmp(ev->key, "Left")) - /* else if (!strcmp(ev->key, "H")) */ - _evry_browse_back(selector); + _evry_browse_back(selector); else if ((!strcmp(ev->key, "Return")) && ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) @@ -1079,7 +1064,6 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) ((strlen(s->input) < (INPUTLEN - strlen(ev->compose))))) { strcat(s->input, ev->compose); - /* _evry_update_timer(s); */ _evry_update(s); } return 1; @@ -1098,7 +1082,6 @@ _evry_backspace(Evry_State *s) { s->input[pos] = 0; _evry_update(s); - /* _evry_update_timer(s); */ } } } @@ -1110,7 +1093,7 @@ _evry_update_text_label(Evry_State *s) edje_object_signal_emit(list->o_main, "e,state,entry_show", "e"); else edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); - + edje_object_part_text_set(win->o_main, "e.text.label", s->input); edje_object_part_text_set(list->o_main, "e.text.label", s->input); @@ -1120,7 +1103,7 @@ static void _evry_update(Evry_State *s) { _evry_update_text_label(s); - + if (update_timer) ecore_timer_del(update_timer); update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, s); } @@ -1133,7 +1116,7 @@ _evry_update_timer(void *data) _evry_list_clear_list(s); _evry_matches_update(selector); _evry_selector_update(selector); - _evry_list_update(selector->state); + _evry_list_update(selector->state); update_timer = NULL; return 0; @@ -1152,7 +1135,7 @@ _evry_clear(Evry_State *s) static void _evry_plugin_action(Evry_Selector *sel, int finished) -{ +{ Evry_State *s_subject, *s_action, *s_object; s_subject = selectors[0]->state; @@ -1163,13 +1146,12 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if (update_timer) { - /* XXX what if an async plugin is selected */ if (!selector->state->plugin->async_query) { _evry_matches_update(selector); - _evry_selector_update(selector); + _evry_selector_update(selector); } - + ecore_timer_del(update_timer); update_timer = NULL; } @@ -1185,10 +1167,10 @@ _evry_plugin_action(Evry_Selector *sel, int finished) it_object = selector->state->sel_item; if (act->type_in2 && !it_object) return; - + act->action(act, s_subject->sel_item, it_object, NULL); } - else + else { Evry_Item *it = s_action->sel_item; s_action->plugin->action(s_action->plugin, it, selector->state->input); @@ -1202,7 +1184,7 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if (s_object && s_object->plugin->action) s_object->plugin->action(s_object->plugin, s_object->sel_item, - s_object->input); + s_object->input); if (finished) evry_hide(); } @@ -1216,7 +1198,7 @@ _evry_list_show_items(Evry_State *s, Evry_Plugin *p) Evas_Object *o; if (p->realize_items) p->realize_items(p, list->popup->evas); - + if (list->scroll_timer) { ecore_timer_del(list->scroll_timer); @@ -1229,16 +1211,16 @@ _evry_list_show_items(Evry_State *s, Evry_Plugin *p) } if (!list->visible) return; - + list->scroll_align = 0; - + evas_event_freeze(list->popup->evas); e_box_freeze(list->o_list); EINA_LIST_FOREACH(p->items, l, it) { if (!it->o_bg) - { + { o = edje_object_add(list->popup->evas); it->o_bg = o; e_theme_edje_object_set(o, "base/theme/everything", @@ -1252,11 +1234,11 @@ _evry_list_show_items(Evry_State *s, Evry_Plugin *p) * _evry_cb_item_mouse_out, it); */ evas_object_show(o); } - else + else { o = it->o_bg; } - + /* if (!it->o_icon && p->icon_get) p->icon_get(p, it, popup_list->evas); */ if (it->o_icon && edje_object_part_exists(o, "e.swallow.icons")) @@ -1264,7 +1246,7 @@ _evry_list_show_items(Evry_State *s, Evry_Plugin *p) edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); evas_object_show(it->o_icon); } - + edje_object_size_min_calc(o, &mw, &mh); e_box_pack_end(list->o_list, o); e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); @@ -1281,7 +1263,7 @@ _evry_list_show_items(Evry_State *s, Evry_Plugin *p) e_box_thaw(list->o_list); list->item_idler = ecore_idler_add(_evry_list_item_idler, p); - + e_box_min_size_get(list->o_list, NULL, &mh); evas_object_geometry_get(list->o_list, NULL, NULL, NULL, &h); if (mh <= h) @@ -1307,13 +1289,13 @@ _evry_list_item_idler(void *data) if (!p->icon_get) goto end; e_box_freeze(list->o_list); - + EINA_LIST_FOREACH(p->items, l, it) { if (!it->o_icon) { it->o_icon = p->icon_get(p, it, list->popup->evas); - + if (it->o_icon) { edje_object_part_swallow(it->o_bg, "e.swallow.icons", it->o_icon); @@ -1426,11 +1408,11 @@ _evry_list_scroll_to(Evry_State *s, Evry_Item *it) Eina_List *l; if (!it) return; - + for(l = s->plugin->items; l; l = l->next, i++) if (l->data == it) break; n = eina_list_count(s->plugin->items); - + e_box_min_size_get(list->o_list, NULL, &mh); evas_object_geometry_get(list->o_list, NULL, NULL, NULL, &h); @@ -1438,13 +1420,13 @@ _evry_list_scroll_to(Evry_State *s, Evry_Item *it) /* printf("MAX %d %d %d\n", max_h, h, mh); * if (max_h != h) * evas_object_resize(list->o_list, max_w, max_h); */ - + if (i >= n || mh <= h) { e_box_align_set(list->o_list, 0.5, 0.0); return; } - + if (n > 1) { list->scroll_align_to = (double)i / (double)(n - 1); @@ -1551,17 +1533,17 @@ _evry_list_item_next(Evry_State *s) _evry_list_win_show(); return; } - + s->plugin_auto_selected = EINA_FALSE; s->item_auto_selected = EINA_FALSE; - + if (!s->sel_item) { _evry_list_item_sel(s, s->plugin->items->data); - _evry_selector_update(selector); + _evry_selector_update(selector); return; } - + EINA_LIST_FOREACH (s->plugin->items, l, it) { if (it == s->sel_item) @@ -1569,7 +1551,7 @@ _evry_list_item_next(Evry_State *s) if (l->next) { _evry_list_item_sel(s, l->next->data); - _evry_selector_update(selector); + _evry_selector_update(selector); } break; } @@ -1583,12 +1565,12 @@ _evry_list_item_prev(Evry_State *s) Evry_Item *it; if (!s->plugin || !s->plugin->items) return; - + s->plugin_auto_selected = EINA_FALSE; s->item_auto_selected = EINA_FALSE; - + if (!s->sel_item) return; - + EINA_LIST_FOREACH (s->plugin->items, l, it) { if (it == s->sel_item) @@ -1612,10 +1594,10 @@ _evry_select_plugin(Evry_State *s, Evry_Plugin *p) if (!p) return; if (list->visible) - { + { if (s->plugin != p) { - if (s->plugin) + if (s->plugin) edje_object_signal_emit(s->plugin->tab, "e,state,unselected", "e"); /* XXX tab_show ? -> see evry_plugin_async_update*/ @@ -1635,11 +1617,11 @@ _evry_list_plugin_next(Evry_State *s) { Eina_List *l; Evry_Plugin *p = NULL; - + if (!s->plugin) return; /* _evry_list_win_show(); */ - + l = eina_list_data_find_list(s->cur_plugins, s->plugin); if (l && l->next) @@ -1653,17 +1635,17 @@ _evry_list_plugin_next(Evry_State *s) _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); - _evry_selector_update(selector); + _evry_selector_update(selector); } } static void _evry_list_plugin_next_by_name(Evry_State *s, const char *key) -{ +{ Eina_List *l; Evry_Plugin *p, *first = NULL, *next = NULL; int found = 0; - + if (!s->plugin) return; EINA_LIST_FOREACH(s->cur_plugins, l, p) @@ -1684,14 +1666,14 @@ _evry_list_plugin_next_by_name(Evry_State *s, const char *key) p = first; else p = NULL; - + if (p) { s->plugin_auto_selected = 0; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); - _evry_selector_update(selector); + _evry_selector_update(selector); } } @@ -1700,11 +1682,11 @@ _evry_list_plugin_prev(Evry_State *s) { Eina_List *l; Evry_Plugin *p = NULL; - + if (!s->plugin) return; /* _evry_list_win_show(); */ - + l = eina_list_data_find_list(s->cur_plugins, s->plugin); if (l && l->prev) @@ -1715,14 +1697,14 @@ _evry_list_plugin_prev(Evry_State *s) if (s->plugin != l->data) p = l->data; } - + if (p) { s->plugin_auto_selected = 0; _evry_list_clear_list(s); _evry_select_plugin(s, p); _evry_list_show_items(s, p); - _evry_selector_update(selector); + _evry_selector_update(selector); } } @@ -1772,15 +1754,15 @@ _evry_list_tabs_update(Evry_State *s) { if (p->tab && !eina_list_data_find(s->cur_plugins, p)) { - e_box_unpack(p->tab); + e_box_unpack(p->tab); evas_object_del(p->tab); p->tab = NULL; } } - + /* show/update tabs of active plugins */ EINA_LIST_FOREACH(s->cur_plugins, l, p) - { + { _evry_list_tab_show(s, p); if (s->plugin == p) edje_object_signal_emit(p->tab, "e,state,selected", "e"); @@ -1830,7 +1812,7 @@ _evry_list_tab_show(Evry_State *s, Evry_Plugin *p) evas_object_show(o); e_box_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999); e_box_thaw(list->o_tabs); - + p->tab = o; } @@ -1868,11 +1850,11 @@ _evry_plug_actions_begin(Evry_Plugin *p, const Evry_Item *it) Evry_Action *act; Eina_List *l; Evry_Selector *sel = selectors[1]; - + _evry_plug_actions_cleanup(p); if (!it) return 0; - + const char *type = it->plugin->type_out; EINA_LIST_FOREACH(evry_conf->actions, l, act) @@ -1899,17 +1881,17 @@ _evry_plug_actions_fetch(Evry_Plugin *p, const char *input) char match1[128]; char match2[128]; int prio; - - if (p->items) + + if (p->items) { EINA_LIST_FREE(p->items, it) - evry_item_free(it); + evry_item_free(it); p->items = NULL; } snprintf(match1, sizeof(match1), "%s*", input); snprintf(match2, sizeof(match2), "*%s*", input); - + EINA_LIST_FOREACH(sel->actions, l, act) { if (input) @@ -1920,7 +1902,7 @@ _evry_plug_actions_fetch(Evry_Plugin *p, const char *input) prio = 2; else prio = 0; } - + if (!input || prio) { it = evry_item_new(p, act->name); @@ -1941,11 +1923,11 @@ _evry_plug_actions_cleanup(Evry_Plugin *p) { Evry_Item *it; Evry_Selector *sel = selectors[1]; - + EINA_LIST_FREE(p->items, it) - evry_item_free(it); + evry_item_free(it); p->items = NULL; - + if (sel->actions) eina_list_free(sel->actions); sel->actions = NULL; } @@ -1955,9 +1937,9 @@ _evry_plug_actions_item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, { Evas_Object *o; Evry_Action *act = it->data[0]; - + if (!act) return NULL; - + if (act->icon_get) o = act->icon_get(act, e); else if (act->icon) @@ -1965,7 +1947,7 @@ _evry_plug_actions_item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, o = e_icon_add(e); evry_icon_theme_set(o, act->icon); } - + return o; } @@ -2055,7 +2037,7 @@ _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p) { Eina_List *l; Evry_Plugin *plugin; - + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) if (p == plugin) return; @@ -2067,7 +2049,7 @@ _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p) s->cur_plugins = eina_list_prepend_relative_list(s->cur_plugins, p, l); else s->cur_plugins = eina_list_append(s->cur_plugins, p); - + } EAPI void @@ -2075,7 +2057,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action) { Evry_State *s; Evry_Plugin *agg; - + if (!win) return; s = selector->state; @@ -2084,7 +2066,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action) if (!s || !eina_list_data_find(s->plugins, p)) return; agg = selector->aggregator; - + if (action == EVRY_ASYNC_UPDATE_ADD) { /* remove plugin and update selector. */ @@ -2093,7 +2075,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action) if (!eina_list_data_find(s->cur_plugins, p)) return; s->cur_plugins = eina_list_remove(s->cur_plugins, p); - + if (p == s->plugin) { s->plugin = NULL; @@ -2135,12 +2117,12 @@ evry_plugin_async_update(Evry_Plugin *p, int action) evas_event_freeze(list->popup->evas); e_box_freeze(list->o_list); EINA_LIST_FOREACH(p->items, l, it) - if (it->o_bg) e_box_unpack(it->o_bg); + if (it->o_bg) e_box_unpack(it->o_bg); e_box_thaw(list->o_list); evas_event_thaw(list->popup->evas); _evry_list_show_items(s, p); - _evry_list_scroll_to(s, s->sel_item); + _evry_list_scroll_to(s, s->sel_item); } } } @@ -2171,10 +2153,10 @@ evry_plugin_async_update(Evry_Plugin *p, int action) * { * Ecore_Event_Mouse_Button *ev; * Evry_State *s =state; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * if (item_mouseover) * { * if (s->sel_item != item_mouseover) @@ -2188,18 +2170,18 @@ evry_plugin_async_update(Evry_Plugin *p, int action) * { * evas_event_feed_mouse_up(popup_list->evas, ev->buttons, 0, ev->timestamp, NULL); * } - * + * * return 1; * } - * + * * static int * _evry_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) * { * Ecore_Event_Mouse_Button *ev; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * if (item_mouseover) * { * if (ev->buttons == 1) @@ -2211,19 +2193,19 @@ evry_plugin_async_update(Evry_Plugin *p, int action) * { * evas_event_feed_mouse_up(popup_list->evas, ev->buttons, 0, ev->timestamp, NULL); * } - * + * * return 1; * } - * + * * static int * _evry_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) * { * Ecore_Event_Mouse_Move *ev; * Evry_State *s =state; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * if (!ev_last_is_mouse) * { * ev_last_is_mouse = 1; @@ -2238,52 +2220,52 @@ evry_plugin_async_update(Evry_Plugin *p, int action) * } * } * } - * + * * evas_event_feed_mouse_move(popup_list->evas, ev->x - popup_list->x, * ev->y - popup_list->y, ev->timestamp, NULL); - * + * * return 1; * } - * + * * static int * _evry_cb_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) * { * Ecore_Event_Mouse_Wheel *ev; - * + * * ev = event; * if (ev->event_window != input_window) return 1; - * + * * ev_last_is_mouse = 0; - * + * * if (ev->z < 0) /\* up *\/ * { * int i; - * + * * for (i = ev->z; i < 0; i++) _evry_list_item_prev(); * } * else if (ev->z > 0) /\* down *\/ * { * int i; - * + * * for (i = ev->z; i > 0; i--) _evry_list_item_next(); * } * return 1; * } - * + * * static void * _evry_cb_item_mouse_in(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) * { * Evry_State *s =state; - * + * * if (!ev_last_is_mouse) return; - * + * * item_mouseover = data; - * + * * if (s->sel_item) _evry_list_item_desel(s->sel_item); * if (!(s->sel_item = data)) return; * _evry_list_item_sel(s->sel_item); * } - * + * * static void * _evry_cb_item_mouse_out(void *data __UNUSED__, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) * { @@ -2301,7 +2283,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action) * if (!strncmp(state->input, p1->trigger, strlen(p1->trigger))) * return 1; * } - * + * * return p1->config->priority - p2->config->priority; * } */ diff --git a/src/modules/everything/evry_config.c b/src/modules/everything/evry_config.c index 4e29574e2..02e9e92cd 100644 --- a/src/modules/everything/evry_config.c +++ b/src/modules/everything/evry_config.c @@ -1,4 +1,3 @@ - #include "e_mod_main.h" /* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */ @@ -12,7 +11,7 @@ static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, * static int _object = type_object; */ -struct _E_Config_Dialog_Data +struct _E_Config_Dialog_Data { int width, height; @@ -29,14 +28,14 @@ struct _E_Config_Dialog_Data EAPI E_Config_Dialog * -evry_config_dialog(E_Container *con, const char *params __UNUSED__) +evry_config_dialog(E_Container *con, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; - + if (e_config_dialog_find("E", "_config_everything_dialog")) return NULL; v = E_NEW(E_Config_Dialog_View, 1); - + v->create_cfdata = _create_data; v->free_cfdata = _free_data; v->basic.apply_cfdata = _basic_apply_data; @@ -51,11 +50,11 @@ evry_config_dialog(E_Container *con, const char *params __UNUSED__) } static void -_fill_data(E_Config_Dialog_Data *cfdata) +_fill_data(E_Config_Dialog_Data *cfdata) { Eina_List *l; Evry_Plugin *p; - + cfdata->scroll_animate = evry_conf->scroll_animate; cfdata->height = evry_conf->height; cfdata->width = evry_conf->width; @@ -66,14 +65,14 @@ _fill_data(E_Config_Dialog_Data *cfdata) else if (p->type == type_action) cfdata->p_action = eina_list_append(cfdata->p_action, p); else if (p->type == type_object) - cfdata->p_object = eina_list_append(cfdata->p_object, p); + cfdata->p_object = eina_list_append(cfdata->p_object, p); } static void * _create_data(E_Config_Dialog *cfd __UNUSED__) { E_Config_Dialog_Data *cfdata; - + cfdata = E_NEW(E_Config_Dialog_Data, 1); _fill_data(cfdata); return cfdata; @@ -85,7 +84,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) eina_list_free(cfdata->p_subject); eina_list_free(cfdata->p_action); eina_list_free(cfdata->p_object); - + E_FREE(cfdata); } @@ -119,7 +118,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, int enabled __UNUSED__) Evas_Coord w; Eina_List *l; Evry_Plugin *p; - + /* freeze evas, edje, and list widget */ evas = evas_object_evas_get(obj); evas_event_freeze(evas); @@ -150,7 +149,7 @@ _plugin_move(Eina_List *plugins, Evas_Object *list, int dir) { Evry_Plugin *p; int prio = 0; - + l1 = eina_list_nth_list(plugins, sel); l2 = eina_list_nth_list(plugins, sel + dir); @@ -159,7 +158,7 @@ _plugin_move(Eina_List *plugins, Evas_Object *list, int dir) l1->data = l2->data; l2->data = p; - _fill_list(plugins, list, 0); + _fill_list(plugins, list, 0); e_widget_ilist_selected_set(list, sel + dir); EINA_LIST_FOREACH(plugins, l1, p) @@ -185,7 +184,7 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial Evas_Object *o, *of, *ob, *otb; otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale); - + o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("General Settings"), 0); @@ -194,16 +193,16 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 300, 800, 5, 0, NULL, &(cfdata->width), 200); - e_widget_framelist_object_append(of, ob); + e_widget_framelist_object_append(of, ob); ob = e_widget_label_add(evas, _("Popup Height")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 200, 800, 5, 0, NULL, &(cfdata->height), 200); - e_widget_framelist_object_append(of, ob); + e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); - + of = e_widget_framelist_add(evas, _("Scroll Settings"), 0); ob = e_widget_check_add(evas, _("Scroll Animate"), &(cfdata->scroll_animate)); @@ -265,10 +264,10 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial cfdata->p_object); e_widget_framelist_object_append(of, o); e_widget_list_object_append(ob, of, 1, 1, 0.5); - + e_widget_toolbook_page_append(otb, NULL, _("Plugins"), ob, 0, 0, 0, 0, 0.5, 0.0); e_widget_toolbook_page_show(otb, 1); - + return otb; } diff --git a/src/modules/everything/evry_plug_apps.c b/src/modules/everything/evry_plug_apps.c index f6ce22fe5..7adaab37f 100644 --- a/src/modules/everything/evry_plug_apps.c +++ b/src/modules/everything/evry_plug_apps.c @@ -25,7 +25,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it) { const char *mime; Inst *inst = NULL; - + if (it) { Eina_List *l; @@ -55,9 +55,9 @@ _begin(Evry_Plugin *p, const Evry_Item *it) { inst = E_NEW(Inst, 1); } - + p->private = inst; - + return 1; } @@ -81,7 +81,7 @@ static void _cleanup(Evry_Plugin *p) { Inst *inst = p->private; - + _list_free(p); if (inst) @@ -91,7 +91,7 @@ _cleanup(Evry_Plugin *p) efreet_desktop_free(desktop); EINA_LIST_FREE(inst->apps_all, desktop) efreet_desktop_free(desktop); - + E_FREE(inst); } @@ -106,12 +106,12 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) Efreet_Desktop *d2; Inst *inst = p->private; int already_refd = 0; - + if (desktop) file = desktop->exec; if (!file) return 0; - + if (!desktop) { char match[4096]; @@ -161,7 +161,7 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) it = evry_item_new(p, desktop->name); else it = evry_item_new(p, file); - + app = E_NEW(Evry_App, 1); app->desktop = desktop; app->file = file; @@ -178,12 +178,12 @@ _add_desktop_list(Evry_Plugin *p, Eina_List *apps, char *m1, char *m2) { Efreet_Desktop *desktop; Eina_List *l; - + EINA_LIST_FOREACH(apps, l, desktop) { if (eina_list_count(p->items) > 99) continue; if (!desktop || !desktop->name || !desktop->exec) continue; - + if (e_util_glob_case_match(desktop->exec, m1)) _item_add(p, desktop, NULL, 1); else if (e_util_glob_case_match(desktop->name, m1)) @@ -193,7 +193,7 @@ _add_desktop_list(Evry_Plugin *p, Eina_List *apps, char *m1, char *m2) { if (eina_list_count(p->items) > 99) continue; if (!desktop || !desktop->name || !desktop->exec) continue; - + if (e_util_glob_case_match(desktop->exec, m2)) _item_add(p, desktop, NULL, 2); else if (e_util_glob_case_match(desktop->name, m2)) @@ -240,7 +240,7 @@ _cb_sort(const void *data1, const void *data2) if ((int)(t2 - t1)) return (int)(t2 - t1); - + // TODO compare exe strings? else return 0; } @@ -258,7 +258,7 @@ _fetch(Evry_Plugin *p, const char *input) Inst *inst = p->private; inst->added = eina_hash_string_small_new(NULL); - + _list_free(p); if (input) @@ -289,16 +289,16 @@ _fetch(Evry_Plugin *p, const char *input) if (input) { if (!inst->apps_all) - inst->apps_all = efreet_util_desktop_name_glob_list("*"); + inst->apps_all = efreet_util_desktop_name_glob_list("*"); - _add_desktop_list(p, inst->apps_all, match1, match2); + _add_desktop_list(p, inst->apps_all, match1, match2); } /* add exe history items */ else if (!p->items) { l = e_exehist_list_get(); EINA_LIST_FREE(l, file) - _item_add(p, NULL, file, 1); + _item_add(p, NULL, file, 1); } /* show 'Run Command' item */ @@ -311,14 +311,14 @@ _fetch(Evry_Plugin *p, const char *input) if (input) { snprintf(match2, 4096, "%s", input); - + if (end = strchr(input, ' ')) { int len = (end - input) - 1; if (len >= 0) snprintf(match2, len, "%s", input); } - + EINA_LIST_FOREACH(exe_path, l, path) { snprintf(match1, 4096, "%s/%s", path, match2); @@ -326,10 +326,10 @@ _fetch(Evry_Plugin *p, const char *input) { found = 1; break; - } + } } } - + if (found || p == p2) { it = evry_item_new(p, _("Run Command")); @@ -393,7 +393,7 @@ _exec_app_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) if (app->file && strlen(app->file) > 0) return 1; - + return 0; } @@ -405,21 +405,21 @@ _app_action(const Evry_Item *it_app, const Evry_Item *it_file) Efreet_Desktop *desktop = NULL; Eina_List *files = NULL; char *exe = NULL; - + if (!it_app) return 0; - + app = it_app->data[0]; if (!app) return 0; - + zone = e_util_zone_current_get(e_manager_current_get()); - + if (app->desktop) { if (it_file && it_file->uri) files = eina_list_append(files, it_file->uri); e_exec(zone, app->desktop, NULL, files, "everything"); - + if (it_file && it_file->mime) e_exehist_mime_desktop_add(it_file->mime, app->desktop); @@ -436,7 +436,7 @@ _app_action(const Evry_Item *it_app, const Evry_Item *it_file) snprintf(exe, len, "%s %s", app->file, it_file->uri); } else exe = (char *) app->file; - + e_exec(zone, NULL, exe, NULL, NULL); if (it_file && it_file->uri) @@ -457,7 +457,7 @@ _open_with_action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSE { Inst *inst = p->private; if (inst->candidate) - return _app_action(it, inst->candidate); + return _app_action(it, inst->candidate); } static int @@ -489,11 +489,11 @@ _edit_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, c e_user_homedir_get(), app->file); desktop = efreet_desktop_empty_new(eina_stringshare_add(buf)); /* XXX check if this gets freed by efreet*/ - desktop->exec = strdup(app->file); + desktop->exec = strdup(app->file); } e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); - + return 1; } @@ -507,7 +507,7 @@ _new_app_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) if (app->file && strlen(app->file) > 0) return 1; - + return 0; } @@ -525,7 +525,7 @@ _new_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, co if (!it1) return 0; app = it1->data[0]; - + if (app->desktop) name = strdup(app->desktop->name); else @@ -534,7 +534,7 @@ _new_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, co if ((end = strchr(name, ' '))) name[end - name] = '\0'; - + for (i = 0; i < 10; i++) { snprintf(buf, 4096, "%s/.local/share/applications/%s-%d.desktop", @@ -548,24 +548,24 @@ _new_app_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, co } free(name); - + if (strlen(buf) == 0) return 0; - + if (!app->desktop) { desktop = efreet_desktop_empty_new(buf); desktop->exec = strdup(app->file); } - else + else { efreet_desktop_save_as(app->desktop, buf); /*XXX hackish - desktop is removed on save_as..*/ efreet_desktop_new(app->desktop->orig_path); - + desktop = efreet_desktop_new(buf); } - + e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); return 1; @@ -575,7 +575,7 @@ static Eina_Bool _init(void) { char *path, *p, *last; - + p1 = E_NEW(Evry_Plugin, 1); p1->name = "Applications"; p1->type = type_subject; @@ -609,7 +609,7 @@ _init(void) act->check_item = &_exec_app_check_item; act->icon = "everything-launch"; evry_action_register(act); - + act1 = E_NEW(Evry_Action, 1); act1->name = "Open File..."; act1->type_in1 = "APPLICATION"; @@ -654,7 +654,7 @@ _init(void) exe_path = eina_list_append(exe_path, strdup(last)); free(path); } - + return EINA_TRUE; } @@ -662,7 +662,7 @@ static void _shutdown(void) { char *str; - + evry_plugin_unregister(p1); evry_plugin_unregister(p2); evry_action_unregister(act); diff --git a/src/modules/everything/evry_plug_aspell.c b/src/modules/everything/evry_plug_aspell.c index d4ea84a3a..e49743535 100644 --- a/src/modules/everything/evry_plug_aspell.c +++ b/src/modules/everything/evry_plug_aspell.c @@ -293,26 +293,26 @@ _fetch(Evry_Plugin *plugin, const char *input) * { * const char *label; * int len; - * + * * if (!it) return EVRY_ACTION_CONTINUE; - * + * * label = it->label; * len = eina_stringshare_strlen(label); - * + * * if (!ecore_x_selection_primary_set(clipboard_win, label, len)) * fprintf(stderr, "ASPELL cannot set primary selection to %#x '%s'\n", * clipboard_win, label); * if (!ecore_x_selection_clipboard_set(clipboard_win, label, len)) * fprintf(stderr, "ASPELL cannot set clipboard selection to %#x '%s'\n", * clipboard_win, label); - * + * * if (plugin->items) * { * Eina_List *l, *l_next; * Evry_Item *it2; - * + * * evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_CLEAR); - * + * * EINA_LIST_FOREACH_SAFE(plugin->items, l, l_next, it2) * { * if (it == it2) continue; @@ -321,9 +321,9 @@ _fetch(Evry_Plugin *plugin, const char *input) * E_FREE(it2); * } * } - * + * * evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_ADD); - * + * * return EVRY_ACTION_FINISHED; * } */ diff --git a/src/modules/everything/evry_plug_border_act.c b/src/modules/everything/evry_plug_border_act.c index 65c7b9a42..f3cbb5cf3 100644 --- a/src/modules/everything/evry_plug_border_act.c +++ b/src/modules/everything/evry_plug_border_act.c @@ -99,14 +99,14 @@ _item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), c else prio = 0; } - + if (!prio) return; - + it = evry_item_new(p, label); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); it->priority = prio; - + p->items = eina_list_prepend(p->items, it); } @@ -140,12 +140,12 @@ _fetch(Evry_Plugin *p, const char *input __UNUSED__) m1[0] = 0; m2[0] = 0; } - + _item_add(p, _("Switch To"), _act_cb_border_switch_to, "go-next", m1, m2); if (inst->border->iconic) _item_add(p, _("Uniconify"), _act_cb_border_unminimize, "window-minimize", m1, m2); - else + else _item_add(p, _("Iconify"), _act_cb_border_minimize, "window-minimize", m1, m2); if (!inst->border->fullscreen) @@ -179,7 +179,7 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) { Evas_Object *o; - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, (const char *)it->data[1]); /* icon = edje_object_add(e); diff --git a/src/modules/everything/evry_plug_calc.c b/src/modules/everything/evry_plug_calc.c index 433b8657b..21eca2434 100644 --- a/src/modules/everything/evry_plug_calc.c +++ b/src/modules/everything/evry_plug_calc.c @@ -67,7 +67,7 @@ _action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSED__) if (p->items->next) { it = p->items->data; - + EINA_LIST_FOREACH(p->items->next, l, it2) { if (!strcmp(it->label, it2->label)) @@ -97,7 +97,7 @@ static int _fetch(Evry_Plugin *p, const char *input) { char buf[1024]; - + if (history) { p->items = history; @@ -119,7 +119,7 @@ _fetch(Evry_Plugin *p, const char *input) ecore_exe_send(exe, buf, strlen(buf)); error = 0; } - + return 1; } @@ -130,7 +130,7 @@ _item_add(Evry_Plugin *p, char *result, int prio) it = evry_item_new(p, result); if (!it) return; - + p->items = eina_list_prepend(p->items, it); } @@ -141,7 +141,7 @@ _cb_data(void *data __UNUSED__, int type __UNUSED__, void *event) Ecore_Exe_Event_Data_Line *l; if (ev->exe != exe) return 1; - + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); for (l = ev->lines; l && l->line; l++) diff --git a/src/modules/everything/evry_plug_clipboard.c b/src/modules/everything/evry_plug_clipboard.c index 25688e3a0..fce3ae3ce 100644 --- a/src/modules/everything/evry_plug_clipboard.c +++ b/src/modules/everything/evry_plug_clipboard.c @@ -22,7 +22,7 @@ _init(void) { Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1); if (!win) return EINA_FALSE; - + act = E_NEW(Evry_Action, 1); act->name = "Copy to Clipboard"; act->is_default = EINA_TRUE; @@ -33,7 +33,7 @@ _init(void) evry_action_register(act); clipboard_win = win; - + return EINA_TRUE; } diff --git a/src/modules/everything/evry_plug_dir_browse.c b/src/modules/everything/evry_plug_dir_browse.c index 8cf8bb058..8a29e7ce0 100644 --- a/src/modules/everything/evry_plug_dir_browse.c +++ b/src/modules/everything/evry_plug_dir_browse.c @@ -25,10 +25,10 @@ _item_add(Evry_Plugin *p, const char *directory, const char *file) { Evry_Item *it = NULL; char buf[4096]; - + it = evry_item_new(p, file); if (!it) return NULL; - + snprintf(buf, sizeof(buf), "%s/%s", directory, file); it->uri = eina_stringshare_add(buf); @@ -41,7 +41,7 @@ _item_fill(Evry_Item *it) const char *mime; if (it->mime) return; - + if ((e_util_glob_case_match(it->label, "*.desktop")) || (e_util_glob_case_match(it->label, "*.directory"))) { @@ -98,7 +98,7 @@ _dirbrowse_idler(void *data) Evry_Item *it; if (!idler) return 0; - + EINA_LIST_FOREACH(s->items, l, it) { if (!it->mime) @@ -112,7 +112,7 @@ _dirbrowse_idler(void *data) if (!s->command) { evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); - + if (eina_list_count(p->items) > 0) { p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); @@ -120,14 +120,14 @@ _dirbrowse_idler(void *data) } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); - + if (cnt > 0) { idler = NULL; return 0; } } - + return 1; } @@ -142,7 +142,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it) s = E_NEW(State, 1); s->directory = eina_stringshare_add(e_user_homedir_get()); p->items = NULL; - + files = ecore_file_ls(s->directory); EINA_LIST_FREE(files, file) @@ -156,7 +156,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it) } it = _item_add(p, s->directory, file); - + if (it) s->items = eina_list_append(s->items, it); @@ -170,7 +170,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it) stack = eina_list_prepend(stack, s); p->private = stack; - + return 1; } @@ -182,7 +182,7 @@ _browse(Evry_Plugin *p, const Evry_Item *it_file) Eina_List *files; Evry_Item *it; Eina_List *stack = p->private; - + if (!it_file || !it_file->uri || !ecore_file_is_dir(it_file->uri)) return 0; @@ -204,7 +204,7 @@ _browse(Evry_Plugin *p, const Evry_Item *it_file) } it = _item_add(p, s->directory, file); - + if (it) s->items = eina_list_append(s->items, it); @@ -226,9 +226,9 @@ _cleanup(Evry_Plugin *p) State *s; Evry_Item *it; Eina_List *stack = p->private; - + if (!stack) return; - + s = stack->data; if (s->directory) eina_stringshare_del(s->directory); @@ -239,21 +239,21 @@ _cleanup(Evry_Plugin *p) if (it->mime) eina_stringshare_del(it->mime); evry_item_free(it); } - + if (idler) { ecore_idler_del(idler); idler = NULL; } - + E_FREE(s); if (p->items) eina_list_free(p->items); p->items = NULL; - + stack = eina_list_remove_list(stack, stack); p->private = stack; - + if (stack) { s = stack->data; @@ -271,7 +271,7 @@ _fetch(Evry_Plugin *p, const char *input) char match2[4096]; int cnt = 0; State *s = ((Eina_List *)p->private)->data; - + if (!s->command) { if (p->items) eina_list_free(p->items); @@ -291,7 +291,7 @@ _fetch(Evry_Plugin *p, const char *input) s->cur = p->items; s->command = EINA_TRUE; return 1; - + } else if (!strncmp(input, "..", 2)) { @@ -301,9 +301,9 @@ _fetch(Evry_Plugin *p, const char *input) int prio = 0; if (!strcmp(s->directory, "/")) return 0; - + snprintf(dir, 4096, "%s", s->directory); - end = strrchr(dir, '/'); + end = strrchr(dir, '/'); while (end != dir) { @@ -342,7 +342,7 @@ _fetch(Evry_Plugin *p, const char *input) p->items = NULL; s->command = EINA_FALSE; } - + if (!directory) directory = s->directory; @@ -378,14 +378,14 @@ _fetch(Evry_Plugin *p, const char *input) s->cur = p->items; return 1; } - + return 0; } static Evas_Object * _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) { - Evas_Object *o = NULL; + Evas_Object *o = NULL; char *icon_path; if (!it->mime) @@ -395,7 +395,7 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) if (it->browseable) { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "folder"); } else @@ -409,11 +409,11 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) } if (!o) { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "none"); } } - return o; + return o; } static Eina_Bool diff --git a/src/modules/everything/evry_plug_tracker.c b/src/modules/everything/evry_plug_tracker.c index 55ae3d4d0..cdf1476f6 100644 --- a/src/modules/everything/evry_plug_tracker.c +++ b/src/modules/everything/evry_plug_tracker.c @@ -23,7 +23,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it) Inst *inst = p->private; inst->active = 0; - + if (!strcmp(it->plugin->type_out, "APPLICATION")) { Efreet_Desktop *desktop; @@ -40,10 +40,10 @@ _begin(Evry_Plugin *p, const Evry_Item *it) if (!app->desktop || !app->desktop->mime_types) return 1; - + rdf_query[0] = '\0'; strcat(rdf_query, ""); - + EINA_LIST_FOREACH(app->desktop->mime_types, l, mime) { if (!strcmp(mime, "x-directory/normal")) @@ -71,7 +71,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it) static void _item_add(Evry_Plugin *p, char *file, char *mime, int prio) { - Evry_Item *it; + Evry_Item *it; const char *filename; int folder = (!strcmp(mime, "Folder")); @@ -81,7 +81,7 @@ _item_add(Evry_Plugin *p, char *file, char *mime, int prio) filename = ecore_file_file_get(file); if (!filename) return; - + it = evry_item_new(p, filename); it->priority = prio; it->uri = eina_stringshare_add(file); @@ -93,7 +93,7 @@ _item_add(Evry_Plugin *p, char *file, char *mime, int prio) } else it->mime = eina_stringshare_add(mime); - + p->items = eina_list_append(p->items, it); } @@ -120,10 +120,10 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error) char *uri, *mime, *date; Evry_Plugin *p = data; Inst *inst = p->private; - + if (inst->active) inst->active--; if (inst->active) return; - + if (dbus_error_is_set(error)) { printf("Error: %s - %s\n", error->name, error->message); @@ -135,9 +135,9 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error) { dbus_message_iter_recurse(&array, &item); while(dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_ARRAY) - { + { dbus_message_iter_recurse(&item, &iter); - + if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_STRING) { dbus_message_iter_get_basic(&iter, &uri); @@ -149,13 +149,13 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error) /* dbus_message_iter_next(&iter); * dbus_message_iter_get_basic(&iter, &date); * printf("%s : %s\n", date, uri); */ - - if (uri && mime) _item_add(p, uri, mime, 1); + + if (uri && mime) _item_add(p, uri, mime, 1); } dbus_message_iter_next(&item); } } - + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } @@ -173,7 +173,7 @@ _fetch(Evry_Plugin *p, const char *input) char *search_text; char *fields[2]; char *keywords[1]; - char *sort_fields[1]; + char *sort_fields[1]; fields[0] = "File:Mime"; /* fields[1] = "File:Modified"; */ fields[1] = "File:Accessed"; @@ -188,22 +188,22 @@ _fetch(Evry_Plugin *p, const char *input) if (!conn) return 0; - if (input && (strlen(input) > 2)) - { + if (input && (strlen(input) > 2)) + { search_text = malloc(sizeof(char) * strlen(input) + 3); sprintf(search_text, "*%s*", input); max_hits = 50; } else if (!p->begin && p->type == type_object) { - + sort_by_access = 1; search_text = ""; } else return 0; inst->active++; - + msg = dbus_message_new_method_call("org.freedesktop.Tracker", "/org/freedesktop/Tracker/Search", "org.freedesktop.Tracker.Search", @@ -236,10 +236,10 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) { char *icon_path; Evas_Object *o = NULL; - + if (it->browseable) { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "folder"); } else @@ -253,7 +253,7 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e) } else { - o = e_icon_add(e); + o = e_icon_add(e); evry_icon_theme_set(o, "none"); } } @@ -265,7 +265,7 @@ _plugin_new(const char *name, int type, char *service, int max_hits, int begin) { Evry_Plugin *p; Inst *inst; - + p = E_NEW(Evry_Plugin, 1); p->name = name; p->type = type; @@ -289,9 +289,9 @@ _plugin_new(const char *name, int type, char *service, int max_hits, int begin) static Eina_Bool _init(void) -{ +{ conn = e_dbus_bus_get(DBUS_BUS_SESSION); - + if (!conn) return EINA_FALSE; _plugin_new("Folders", type_subject, "Folders", 20, 0); @@ -303,7 +303,7 @@ _init(void) _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); - + return EINA_TRUE; } @@ -312,11 +312,11 @@ _shutdown(void) { Inst *inst; Evry_Plugin *p; - + if (conn) e_dbus_connection_close(conn); EINA_LIST_FREE(plugins, p) - { + { evry_plugin_unregister(p); inst = p->private; if (inst->condition[0]) free(inst->condition);