From 5dad4266761c4393291860947fb6048261972022 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Sun, 30 May 2010 19:16:33 +0000 Subject: [PATCH] switch aggregator and action plugins to create new instances in _begin. action plugin is no special selector plugin anymore added 'plugins' collection plugin. dont use! some plugins must be converted to return new instances in begin. fix leak in browse_item function fix aspell config path cleanups SVN revision: 49333 --- src/modules/everything-aspell/e_mod_main.c | 4 +- src/modules/everything-files/e_mod_main.c | 11 +- src/modules/everything-settings/e_mod_main.c | 6 +- src/modules/everything/e_mod_main.c | 31 +- src/modules/everything/e_mod_main.h | 10 +- src/modules/everything/evry.c | 317 +++++++++--------- src/modules/everything/evry_config.c | 5 +- src/modules/everything/evry_history.c | 5 +- src/modules/everything/evry_plug_actions.c | 74 ++-- src/modules/everything/evry_plug_aggregator.c | 249 +++++++++----- src/modules/everything/evry_plug_collection.c | 85 +++-- src/modules/everything/evry_plugin.c | 1 + src/modules/everything/evry_view.c | 4 +- 13 files changed, 447 insertions(+), 355 deletions(-) diff --git a/src/modules/everything-aspell/e_mod_main.c b/src/modules/everything-aspell/e_mod_main.c index f8e01d0a0..c0a1b37c2 100644 --- a/src/modules/everything-aspell/e_mod_main.c +++ b/src/modules/everything-aspell/e_mod_main.c @@ -49,8 +49,8 @@ static const Evry_API *evry = NULL; static Evry_Module *evry_module = NULL; static Module_Config *_conf; static Evry_Plugin *_plug = NULL; -static char _config_path[] = "extensions/everthing-aspell"; -static char _config_domain[] = "module.everyhing-aspell"; +static char _config_path[] = "extensions/everything-aspell"; +static char _config_domain[] = "module.everything-aspell"; static char _module_icon[] = "accessories-dictionary"; static E_Config_DD *_conf_edd = NULL; diff --git a/src/modules/everything-files/e_mod_main.c b/src/modules/everything-files/e_mod_main.c index 8a64c0792..a369fddc9 100644 --- a/src/modules/everything-files/e_mod_main.c +++ b/src/modules/everything-files/e_mod_main.c @@ -283,6 +283,7 @@ _append_files(Plugin *p) int cnt = 0; Evry_Item *it; Eina_List *l; + int len = p->input ? strlen(p->input) : 0; EVRY_PLUGIN_ITEMS_CLEAR(p); @@ -290,7 +291,7 @@ _append_files(Plugin *p) { if (!p->input) return 0; - if (strlen(p->input) < p->min_query) + if (len < p->min_query) return 0; } @@ -301,7 +302,7 @@ _append_files(Plugin *p) if (p->dirs_only && !it->browseable) continue; - if (p->input && (match = evry->fuzzy_match(it->label, p->input))) + if (len && (match = evry->fuzzy_match(it->label, p->input))) { it->fuzzy_match = match; if (!it->browseable) @@ -309,7 +310,7 @@ _append_files(Plugin *p) EVRY_PLUGIN_ITEM_APPEND(p, it); cnt++; } - else if (!p->input) + else if (len == 0) { if (!it->browseable) it->priority = 1; @@ -650,7 +651,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) /* provide subject */ EVRY_PLUGIN_INSTANCE(p, plugin); p->parent = EINA_FALSE; - + if (_conf->show_homedir) p->directory = eina_stringshare_add(e_user_homedir_get()); @@ -825,7 +826,7 @@ _fetch(Evry_Plugin *plugin, const char *input) if (!p->parent) p->min_query = plugin->config->min_query; - + if ((p->command) || (!p->min_query) || (len >= p->min_query)) _append_files(p); diff --git a/src/modules/everything-settings/e_mod_main.c b/src/modules/everything-settings/e_mod_main.c index 2e91a4d01..8d3d5d0ae 100644 --- a/src/modules/everything-settings/e_mod_main.c +++ b/src/modules/everything-settings/e_mod_main.c @@ -14,6 +14,7 @@ struct _Plugin Evry_Plugin base; Eina_List *items; Eina_List *categories; + Eina_Bool parent; }; struct _Settings_Item @@ -79,6 +80,7 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item) it = (Settings_Item *) item; EVRY_PLUGIN_INSTANCE(p, plugin); + p->parent = EINA_TRUE; GET_PLUGIN(parent, item->plugin); @@ -113,7 +115,7 @@ _fetch(Evry_Plugin *plugin, const char *input) EVRY_PLUGIN_ITEMS_CLEAR(p); - if (len < plugin->config->min_query) + if ((!p->parent) && (len < plugin->config->min_query)) return 0; if (!p->categories && !p->items) @@ -149,7 +151,7 @@ _fetch(Evry_Plugin *plugin, const char *input) EVRY_PLUGIN_ITEMS_ADD(p, p->categories, input, 1, 1); - if (input || !p->categories) + if (input || p->parent) return EVRY_PLUGIN_ITEMS_ADD(p, p->items, input, 1, 1); } diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index 823ddb459..06a3bf1d1 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -64,8 +64,8 @@ e_modapi_init(E_Module *m) _evry_type_init("TEXT"); _config_init(); - evry_history_init(); + evry_history_init(); evry_plug_actions_init(); evry_plug_collection_init(); evry_plug_clipboard_init(); @@ -214,6 +214,16 @@ e_modapi_shutdown(E_Module *m __UNUSED__) if (cleanup_timer) ecore_timer_del(cleanup_timer); +#ifdef CHECK_REFS + Evry_Item *it; + printf("___________________________________________\n"); + + EINA_LIST_FREE(refd, it) + printf("%d %s\n", it->ref, it->label); + +#endif + + return 1; } @@ -454,41 +464,32 @@ _config_free(void) Plugin_Config *pc, *pc2; 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->trigger); - E_FREE(pc2); - } + IF_RELEASE(pc2->name); + IF_RELEASE(pc2->trigger); + E_FREE(pc2); } EINA_LIST_FREE(evry_conf->conf_subjects, pc) { IF_RELEASE(pc->name); IF_RELEASE(pc->trigger); - if (pc->plugin) - evry_plugin_free(pc->plugin); E_FREE(pc); } EINA_LIST_FREE(evry_conf->conf_actions, pc) { IF_RELEASE(pc->name); IF_RELEASE(pc->trigger); - if (pc->plugin) - evry_plugin_free(pc->plugin); E_FREE(pc); } EINA_LIST_FREE(evry_conf->conf_objects, pc) { IF_RELEASE(pc->name); IF_RELEASE(pc->trigger); - if (pc->plugin) - evry_plugin_free(pc->plugin); E_FREE(pc); } - E_FREE(evry_conf); } @@ -536,7 +537,7 @@ _e_mod_action_cb(E_Object *obj, const char *params) /* if (zone) evry_show(zone, _params); */ if (_idler) ecore_idle_enterer_del(_idler); - _idler = ecore_idle_enterer_add(_e_mod_run_defer_cb, zone); + _idler = ecore_idle_enterer_add(_e_mod_run_defer_cb, zone); } static void diff --git a/src/modules/everything/e_mod_main.h b/src/modules/everything/e_mod_main.h index 50349abbf..a954433a5 100644 --- a/src/modules/everything/e_mod_main.h +++ b/src/modules/everything/e_mod_main.h @@ -92,6 +92,9 @@ struct _Evry_State /* active plugin */ Evry_Plugin *plugin; + /* aggregator instance */ + Evry_Plugin *aggregator; + /* selected item */ Evry_Item *cur_item; @@ -301,7 +304,6 @@ void evry_hide(int clear); int evry_plug_actions_init(); void evry_plug_actions_shutdown(); -Evry_Plugin *evry_plug_actions_new(Evry_Selector *selector, int type); Evry_Plugin *evry_aggregator_new(Evry_Window *win, int type); @@ -378,4 +380,10 @@ EAPI E_Config_Dialog *evry_collection_conf_dialog(E_Container *con, const char * EAPI extern E_Module_Api e_modapi; +/* #define CHECK_REFS */ + +#ifdef CHECK_REFS +extern Eina_List *refd; +#endif + #endif diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 99b497a17..51332a5bc 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -47,7 +47,7 @@ static void _evry_list_win_hide(void); static void _evry_list_win_update(Evry_State *s); static void _evry_view_clear(Evry_State *s); -static void _evry_view_update(Evry_State *s, Evry_Plugin *plugin); +static int _evry_view_update(Evry_State *s); static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev); static void _evry_view_show(Evry_View *v, int slide); static void _evry_view_hide(Evry_View *v, int slide, int destroy); @@ -85,24 +85,20 @@ evry_shutdown(void) } static int -_evry_aggregator_fetch(Evry_Selector *sel, const char *input) +_evry_aggregator_fetch(Evry_State *s) { - Evry_State *s = sel->state; - if (!s) { - sel->aggregator->finish(sel->aggregator); - return 1; + ERR("no state"); + return 0; } - if ((sel->aggregator->fetch(sel->aggregator, input)) && - (!eina_list_data_find(s->cur_plugins, sel->aggregator))) + if ((s->aggregator->fetch(s->aggregator, s->input)) && + (!eina_list_data_find(s->cur_plugins, s->aggregator))) { - s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator); + s->cur_plugins = eina_list_prepend(s->cur_plugins, s->aggregator); } - sel->aggregator->state = s; - return 1; } @@ -139,9 +135,6 @@ _cb_show_timer(void *data) if (sel && sel->state && evry_conf->views) { - /* Evry_View *view =eina_list_stevry_conf->views->data; */ - /* Evry_State *s = sel->state; */ - if (evry_conf->first_run) { evry_view_toggle(sel->state, "?"); @@ -187,17 +180,16 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params) return 1; } - if (eina_list_count((SUBJ_SEL)->states) < 2) - evry_hide(1); + evry_hide(1); - if (win && CUR_SEL && params) + if (win && CUR_SEL && params && (!edge)) { EINA_LIST_FOREACH((SUBJ_SEL)->plugins, l, p) if (!strcmp(params, p->name)) break; _evry_plugin_select((CUR_SEL)->state, p); _evry_selector_update(CUR_SEL); - _evry_view_update((CUR_SEL)->state, p); + _evry_view_update((CUR_SEL)->state); } return 1; } @@ -312,8 +304,9 @@ evry_hide(int clear) if ((clear && CUR_SEL) && ((eina_list_count((SUBJ_SEL)->states) > 1) || - (((SUBJ_SEL)->state) && - ((SUBJ_SEL)->state->input[0])))) + (CUR_SEL != SUBJ_SEL) || + (((CUR_SEL)->state) && + ((CUR_SEL)->state->input[0])))) { int slide = 0; Evry_Selector *sel; @@ -342,7 +335,7 @@ evry_hide(int clear) _evry_clear(sel); _evry_clear(sel); - _evry_aggregator_fetch(sel, s->input); + _evry_aggregator_fetch(s); _evry_selector_update(sel); _evry_update_text_label(s); _evry_view_show(s->view, slide); @@ -471,10 +464,9 @@ evry_clear_input(Evry_Plugin *p) _evry_update_text_label(s); } -//#define CHECK_REFS - #ifdef CHECK_REFS static int item_cnt = 0; +Eina_List *refd = NULL; #endif Evry_Item * @@ -506,6 +498,7 @@ evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label, #ifdef CHECK_REFS item_cnt++; + refd = eina_list_append(refd, it); printf("%d, %d\t new : %s\n", it->ref, item_cnt, it->label); #endif @@ -520,13 +513,14 @@ evry_item_free(Evry_Item *it) it->ref--; #ifdef CHECK_REFS - printf("%d, %d\t unref: %s\n", it->ref, item_cnt - 1, it->label); + printf("%d, %d\t unref: %s\n", it->ref, item_cnt - 1, it->label); #endif if (it->ref > 0) return; #ifdef CHECK_REFS item_cnt--; + refd = eina_list_remove(refd, it); #endif IF_RELEASE(it->label); @@ -583,10 +577,13 @@ _evry_timer_cb_actions_get(void *data) if ((CUR_SEL == sel) && (s = sel->state)) { - if (s->view) - s->view->update(s->view); - else - _evry_view_update(s, NULL); + if (_evry_view_update(s)) + _evry_view_show(s->view, 0); + + /* if (s->view) + * s->view->update(s->view); + * else + * _evry_view_update(s, NULL) */ } return 0; @@ -661,6 +658,12 @@ evry_plugin_update(Evry_Plugin *p, int action) if (action == EVRY_UPDATE_ADD) { + if (s->sel_items) + { + eina_list_free(s->sel_items); + s->sel_items = NULL; + } + if (!p->items && !s->trigger_active) { /* remove plugin */ @@ -668,6 +671,8 @@ evry_plugin_update(Evry_Plugin *p, int action) s->cur_plugins = eina_list_remove(s->cur_plugins, p); + _evry_aggregator_fetch(s); + if (s->plugin == p) _evry_plugin_select(s, NULL); } @@ -676,23 +681,22 @@ evry_plugin_update(Evry_Plugin *p, int action) /* add plugin to current plugins*/ _evry_plugin_list_insert(s, p); - if (!s->plugin || !eina_list_data_find_list(s->cur_plugins, s->plugin)) + _evry_aggregator_fetch(s); + + if ((!s->plugin) || (s->plugin_auto_selected) || + (!eina_list_data_find_list(s->cur_plugins, s->plugin))) _evry_plugin_select(s, NULL); } - if (s->sel_items) - eina_list_free(s->sel_items); - s->sel_items = NULL; - - _evry_aggregator_fetch(sel, s->input); - /* plugin is visible */ if ((sel->state == s) && ((s->plugin == p) || - (s->plugin == sel->aggregator))) + (s->plugin == s->aggregator))) { _evry_selector_update(sel); - _evry_view_update(s, NULL); + if (_evry_view_update(s)) + _evry_view_show(s->view, 0); + } /* switch back to subject selector when no current items */ @@ -707,7 +711,7 @@ evry_plugin_update(Evry_Plugin *p, int action) else if (action == EVRY_UPDATE_REFRESH) { _evry_view_clear(s); - _evry_view_update(s, NULL); + _evry_view_update(s); } } @@ -1101,13 +1105,11 @@ _evry_selector_new(Evry_Window *win, int type) if (type == EVRY_PLUGIN_SUBJECT) { - sel->actions = evry_plug_actions_new(sel, type); pcs = evry_conf->conf_subjects; o = edje_object_part_swallow_get(win->o_main, "subject_selector"); } else if (type == EVRY_PLUGIN_ACTION) { - sel->actions = evry_plug_actions_new(sel, type); pcs = evry_conf->conf_actions; o = edje_object_part_swallow_get(win->o_main, "action_selector"); } @@ -1153,7 +1155,6 @@ _evry_selector_free(Evry_Selector *sel) _evry_state_pop(sel, 1); EVRY_PLUGIN_FREE(sel->aggregator); - EVRY_PLUGIN_FREE(sel->actions); if (sel->plugins) eina_list_free(sel->plugins); @@ -1304,8 +1305,6 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) sel->o_thumb = e_thumb_icon_add(win->popup->evas); evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen", _evry_selector_thumb_gen, sel); - /* edje_object_part_geometry_get(sel->o_main, "e.swallow.thumb", - * NULL, NULL, &w, &h); */ if (suffix) e_thumb_icon_file_set(sel->o_thumb, file->path, "e/desktop/background"); else @@ -1457,8 +1456,8 @@ _evry_list_win_update(Evry_State *s) if (s != (CUR_SEL)->state) return; if (!win->visible) return; - /* if (s->changed) */ - _evry_view_update(s, s->plugin); + if (_evry_view_update(s)) + _evry_view_show(s->view, 0); } static int @@ -1473,9 +1472,6 @@ _evry_selector_subjects_get(const char *plugin_name) if (plugin_name && strcmp(plugin_name, p->name)) continue; - /* if (!p->config->top_level) - * continue; */ - if (p->begin && (pp = p->begin(p, NULL))) plugins = eina_list_append(plugins, pp); @@ -1486,12 +1482,6 @@ _evry_selector_subjects_get(const char *plugin_name) if (!plugins) return 0; _evry_state_new(sel, plugins); - - EINA_LIST_FOREACH(plugins, l, p) - p->state = sel->state; - - DBG("%s", plugin_name); - _evry_matches_update(sel, 1); return 1; @@ -1511,9 +1501,6 @@ _evry_selector_actions_get(Evry_Item *it) EINA_LIST_FOREACH(sel->plugins, l, p) { - /* if (!p->config->top_level) - * continue; */ - if (p->begin && (pp = p->begin(p, it))) plugins = eina_list_append(plugins, pp); } @@ -1521,10 +1508,6 @@ _evry_selector_actions_get(Evry_Item *it) if (!plugins) return 0; _evry_state_new(sel, plugins); - - EINA_LIST_FOREACH(plugins, l, p) - p->state = sel->state; - _evry_matches_update(sel, 1); return 1; @@ -1546,11 +1529,6 @@ _evry_selector_objects_get(Evry_Action *act) EINA_LIST_FOREACH(sel->plugins, l, p) { - DBG("p %s %d %d\n", p->name, EVRY_ITEM(p)->subtype, act->it2.type); - - /* if (!p->config->top_level) - * continue; */ - if (!CHECK_SUBTYPE(p, act->it2.type)) continue; @@ -1564,9 +1542,6 @@ _evry_selector_objects_get(Evry_Action *act) if (!plugins) return 0; _evry_state_new(sel, plugins); - EINA_LIST_FOREACH(plugins, l, p) - p->state = sel->state; - _evry_matches_update(sel, 1); return 1; @@ -1576,6 +1551,11 @@ static Evry_State * _evry_state_new(Evry_Selector *sel, Eina_List *plugins) { Evry_State *s = E_NEW(Evry_State, 1); + Eina_List *l; + Evry_Plugin *p; + + if (!s) return NULL; + s->inp = malloc(INPUTLEN); s->inp[0] = 0; s->input = s->inp; @@ -1585,6 +1565,13 @@ _evry_state_new(Evry_Selector *sel, Eina_List *plugins) sel->states = eina_list_prepend(sel->states, s); sel->state = s; + p = sel->aggregator->begin(sel->aggregator, NULL); + s->plugins = eina_list_append(s->plugins, p); + s->aggregator = p; + + EINA_LIST_FOREACH(s->plugins, l, p) + p->state = s; + return s; } @@ -1593,48 +1580,39 @@ _evry_state_pop(Evry_Selector *sel, int immediate) { Evry_Plugin *p; Evry_State *s; - Evry_State *prev = NULL; + Evry_State *prev; s = sel->state; _evry_item_desel(s, NULL); - free(s->inp); - if (s->view) { if (immediate) s->view->destroy(s->view); else _evry_view_hide(s->view, SLIDE_RIGHT, 1); + /* XXX delay free state? is it possible that + view can receive events here? */ } if (s->sel_items) eina_list_free(s->sel_items); sel->states = eina_list_remove_list(sel->states, sel->states); - - if (sel->states) - prev = sel->states->data; + prev = eina_list_data_get(sel->states); EINA_LIST_FREE(s->plugins, p) { - /* FIXME use it->free cb also for plugin instances*/ - /* skip non top-level plugins */ if (prev && eina_list_data_find(prev->plugins, p)) { p->state = prev; continue; } - - /* if (EVRY_ITEM(p)->ref == 0) */ p->finish(p); - /* else - * p->state = NULL; */ } - - + E_FREE(s->inp); E_FREE(s); sel->state = prev; @@ -1710,29 +1688,32 @@ evry_browse_item(Evry_Item *it) sel = s->selector; - if ((it->plugin->browse) && - (pp = it->plugin->browse(it->plugin, it))) - { - plugins = eina_list_append(plugins, pp); - pref = pp; - } - - EINA_LIST_FOREACH(sel->plugins, l, p) - { - if ((p->browse) && (pp = p->browse(p, it))) - { - if (pref && !strcmp(pp->name, pref->name)) - continue; - plugins = eina_list_append(plugins, pp); - } - } - /* aggregator */ - if (!(plugins) && CHECK_TYPE(it, EVRY_TYPE_PLUGIN)) + if (CHECK_TYPE(it, EVRY_TYPE_PLUGIN)) { browse_aggregator = 1; plugins = eina_list_append(plugins, it); } + else + { + if ((it->plugin->browse) && + (pp = it->plugin->browse(it->plugin, it))) + { + plugins = eina_list_append(plugins, pp); + pref = pp; + } + + EINA_LIST_FOREACH(sel->plugins, l, p) + { + if (pref && !strcmp(p->name, pref->name)) + continue; + + if ((p->browse) && (pp = p->browse(p, it))) + { + plugins = eina_list_append(plugins, pp); + } + } + } if (!(plugins)) { @@ -1746,9 +1727,6 @@ evry_browse_item(Evry_Item *it) return 0; } - EINA_LIST_FOREACH(plugins, l, p) - p->state = new_state; - if (s->view) { _evry_view_hide(s->view, SLIDE_LEFT, 0); @@ -1757,13 +1735,24 @@ evry_browse_item(Evry_Item *it) if (browse_aggregator) { - strncpy(new_state->input, s->input, INPUTLEN); + it->hi = NULL; - evry_history_item_add(it, NULL, NULL); + if (!EVRY_PLUGIN(it)->items) + { + evry_history_item_add(it, NULL, s->input); + s = new_state; + EVRY_PLUGIN(it)->state = s; + _evry_matches_update(sel, 1); + } + else + { + evry_history_item_add(it, NULL, NULL); + strncpy(new_state->input, s->input, INPUTLEN); + s = new_state; + EVRY_PLUGIN(it)->state = s; + s->cur_plugins = eina_list_append(s->cur_plugins, it); + } - s = new_state; - EVRY_PLUGIN(it)->state = s; - s->cur_plugins = eina_list_append(s->cur_plugins, it); _evry_plugin_select(s, EVRY_PLUGIN(it)); } else @@ -1773,6 +1762,7 @@ evry_browse_item(Evry_Item *it) _evry_matches_update(sel, 1); s = new_state; + _evry_plugin_select(s, pref); } _evry_selector_update(sel); @@ -1806,7 +1796,7 @@ evry_browse_back(Evry_Selector *sel) _evry_state_pop(sel, 0); s = sel->state; - _evry_aggregator_fetch(sel, s->input); + /* _evry_aggregator_fetch(s); */ _evry_selector_update(sel); if (sel == SUBJ_SEL) _evry_selector_update_actions(ACTN_SEL); @@ -1970,8 +1960,8 @@ _evry_cheat_history(Evry_State *s, int promote, int delete) if (hi->count < 0) hi->count = 1; } } - if (s->plugin == s->selector->aggregator) - _evry_aggregator_fetch(s->selector, s->input); + if (s->plugin == s->aggregator) + _evry_aggregator_fetch(s); if (s->view) s->view->update(s->view); @@ -2567,10 +2557,14 @@ _evry_view_slide_clear(Evry_View *v) evas_object_hide(v->o_list); } win->view_clearing = NULL; + } - /* replay mouse down to allow direct sliding back */ - if (win->mouse_button) - evas_event_feed_mouse_down(win->popup->evas, win->mouse_button, 0, 0, NULL); + /* replay mouse down to allow direct sliding back */ + if (win->mouse_button) + { + evas_event_feed_mouse_down(win->popup->evas, + win->mouse_button, + 0, 0, NULL); } } @@ -2586,18 +2580,18 @@ _evry_view_hide(Evry_View *v, int slide, int destroy) { /* replay mouse up to allow direct sliding back */ if (win->mouse_button) - evas_event_feed_mouse_up(win->popup->evas, win->mouse_button, 0, 0, NULL); + { + evas_event_feed_mouse_up(win->popup->evas, + win->mouse_button, + 0, 0, NULL); + } + + evas_object_hide(v->o_list); + edje_object_part_unswallow(win->o_main, v->o_list); if (slide == SLIDE_RIGHT) { - evas_object_hide(v->o_list); - edje_object_part_unswallow(win->o_main, v->o_list); - edje_object_part_swallow(win->o_main, "list:e.swallow.list2", v->o_list); - evas_object_show(v->o_list); - edje_object_signal_emit(v->o_list, "e,action,hide,list", "e"); - edje_object_signal_emit(v->o_list, "e.swallow.list:e,action,hide,list", "e"); - v->clear_timer = ecore_timer_add(0.3, _clear_timer, v); if (destroy) win->view_freeing = v; else @@ -2605,17 +2599,14 @@ _evry_view_hide(Evry_View *v, int slide, int destroy) } else /* if (slide == SLIDE_LEFT) */ { - evas_object_hide(v->o_list); - edje_object_part_unswallow(win->o_main, v->o_list); - edje_object_part_swallow(win->o_main, "list:e.swallow.list", v->o_list); - evas_object_show(v->o_list); - edje_object_signal_emit(v->o_list, "e,action,hide,list", "e"); - edje_object_signal_emit(v->o_list, "e.swallow.list:e,action,hide,list", "e"); - v->clear_timer = ecore_timer_add(0.3, _clear_timer, v); win->view_clearing = v; } - + + evas_object_show(v->o_list); + edje_object_signal_emit(v->o_list, "e,action,hide,list", "e"); + v->clear_timer = ecore_timer_add(0.3, _clear_timer, v); + if (v->o_bar) { edje_object_part_unswallow(win->o_main, v->o_bar); @@ -2643,20 +2634,25 @@ _evry_view_hide(Evry_View *v, int slide, int destroy) v->destroy(v); } -static void -_evry_view_update(Evry_State *s, Evry_Plugin *p) +static int +_evry_view_update(Evry_State *s) { - if (!win->visible) return; + if (!win->visible) return 0; if (!s->view) { Evry_View *view = evry_conf->views->data; - s->view = view->create(view, s, win->o_main); - /* _evry_view_show(s->view, 0); */ + if (!(s->view = view->create(view, s, win->o_main))) + return 0; + + s->view->update(s->view); + return 1; } if (s->view) s->view->update(s->view); + + return 0; } static void @@ -2726,10 +2722,7 @@ evry_view_toggle(Evry_State *s, const char *trigger) _evry_list_win_show(); if (s->view) - { - _evry_view_hide(s->view, 0, 1); - /* s->view->destroy(s->view); */ - } + _evry_view_hide(s->view, 0, 1); s->view = v; _evry_view_show(s->view, 0); @@ -2832,20 +2825,7 @@ _evry_matches_update(Evry_Selector *sel, int async) /* query all other plugins for this state */ EINA_LIST_FOREACH(s->plugins, l, p) { - if (!sel->states->next) - { - /* skip plugins in toplevel which trigger-only */ - if ((sel == SUBJ_SEL) && - (p->config->top_level) && - (p->config->trigger) && - (p->config->trigger_only)) - continue; - - /* skip non-toplevel plugins when input < min_query */ - if ((!p->config->top_level) && - (p->config->min_query > len_inp)) - continue; - } + p->request = s->request; /* dont wait for async plugin. use their current items */ if (!async && p->async_fetch && p->items) @@ -2854,16 +2834,37 @@ _evry_matches_update(Evry_Selector *sel, int async) continue; } - p->request = s->request; - - if ((p->fetch(p, input)) || (sel->states->next)) + if ((sel->states->next) || + ((CUR_SEL == SUBJ_SEL) && (win->plugin_dedicated))) { + p->fetch(p, input); s->cur_plugins = eina_list_append(s->cur_plugins, p); + continue; + } + + /* skip plugins in toplevel which trigger-only */ + if ((sel == SUBJ_SEL) && + (p->config->top_level) && + (p->config->trigger) && + (p->config->trigger_only)) + continue; + + /* skip non-toplevel plugins when input < min_query */ + if ((!p->config->top_level) && + (p->config->min_query > len_inp)) + continue; + + if (p->fetch(p, input)) + { + if (p == s->aggregator) + s->cur_plugins = eina_list_prepend(s->cur_plugins, p); + else + s->cur_plugins = eina_list_append(s->cur_plugins, p); } } found: - _evry_aggregator_fetch(sel, input); + /* _evry_aggregator_fetch(s); */ if (s->plugin_auto_selected || (s->plugin && (!eina_list_data_find(s->cur_plugins, s->plugin)))) diff --git a/src/modules/everything/evry_config.c b/src/modules/everything/evry_config.c index 1c9839557..8154bd881 100644 --- a/src/modules/everything/evry_config.c +++ b/src/modules/everything/evry_config.c @@ -413,11 +413,14 @@ _create_plugin_page(E_Config_Dialog_Data *cfdata, Evas *e, Plugin_Page *page) e_widget_table_object_append(ob, of, 1, 0, 1, 1, 1, 1, 1, 0); of = e_widget_framelist_add(e, _("Plugin Trigger"), 0); + o = e_widget_label_add(e, _("Default is plugin name")); + e_widget_framelist_object_append(of, o); + o = e_widget_entry_add(e, &(page->trigger), NULL, NULL, NULL); e_widget_disabled_set(o, 1); page->o_trigger = o; e_widget_framelist_object_append(of, o); - o = e_widget_check_add(e, _("Show only when triggered"), + o = e_widget_check_add(e, _("Search only when triggered"), &(page->trigger_only)); e_widget_disabled_set(o, 1); page->o_trigger_only = o; diff --git a/src/modules/everything/evry_history.c b/src/modules/everything/evry_history.c index 58466bdae..af4d5132f 100644 --- a/src/modules/everything/evry_history.c +++ b/src/modules/everything/evry_history.c @@ -270,6 +270,9 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input) if (!it) return NULL; + if ((!it->plugin->history) && (!CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) + return NULL; + if (it->type == EVRY_TYPE_ACTION) { GET_ACTION(act, it); @@ -360,7 +363,7 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt) int rem_ctxt = 1; it->usage = 0.0; - if (!it->plugin->history) + if ((!it->plugin->history) && (!CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) return 0; if (it->hi) diff --git a/src/modules/everything/evry_plug_actions.c b/src/modules/everything/evry_plug_actions.c index f28d1e428..8899fa6fd 100644 --- a/src/modules/everything/evry_plug_actions.c +++ b/src/modules/everything/evry_plug_actions.c @@ -8,13 +8,12 @@ typedef struct _Plugin Plugin; struct _Plugin { Evry_Plugin base; - Evry_Selector *selector; Eina_List *actions; Eina_Bool parent; Evry_Action *action; }; -static Evry_Plugin *_base_plug = NULL; +static Evry_Plugin *_plug = NULL; static void _finish(Evry_Plugin *plugin) @@ -22,15 +21,8 @@ _finish(Evry_Plugin *plugin) GET_PLUGIN(p, plugin); Evry_Action *act; - if (p->parent) - { - EINA_LIST_FREE(p->actions, act); - E_FREE(p); - } - else - { - EINA_LIST_FREE(p->actions, act); - } + EINA_LIST_FREE(p->actions, act); + E_FREE(p); } static Evry_Plugin * @@ -44,9 +36,7 @@ _browse(Evry_Plugin *plugin, const Evry_Item *it) act = EVRY_ACTN(it); - p = E_NEW(Plugin, 1); - p->base = *plugin; - p->base.items = NULL; + EVRY_PLUGIN_INSTANCE(p, plugin); p->actions = act->fetch(act); p->parent = EINA_TRUE; p->action = act; @@ -59,10 +49,9 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) { Evry_Action *act; Eina_List *l; + Plugin *p; - GET_PLUGIN(p, plugin); - - EINA_LIST_FREE(p->actions, act); + EVRY_PLUGIN_INSTANCE(p, plugin); if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) { @@ -76,7 +65,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) if (act->check_item && !(act->check_item(act, it))) continue; - act->base.plugin = plugin; + act->base.plugin = EVRY_PLUGIN(p); act->it1.item = it; EVRY_ITEM(act)->hi = NULL; @@ -88,7 +77,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) { EINA_LIST_FOREACH(it->plugin->actions, l, act) { - act->base.plugin = plugin; + act->base.plugin = EVRY_PLUGIN(p); act->it1.item = EVRY_ITEM(it->plugin); EVRY_ITEM(act)->hi = NULL; @@ -96,9 +85,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) } } - if (!p->actions) return NULL; - - return plugin; + return EVRY_PLUGIN(p); } static int @@ -177,39 +164,18 @@ _fetch(Evry_Plugin *plugin, const char *input) return 1; } -Evry_Plugin * -evry_plug_actions_new(Evry_Selector *sel, int type) -{ - Evry_Plugin *plugin; - - if (type == EVRY_PLUGIN_SUBJECT) - { - plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, - NULL, _finish, _fetch, NULL); - } - else if (type == EVRY_PLUGIN_ACTION) - { - plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, - _begin, _finish, _fetch, NULL); - } - else return NULL; - - plugin->browse = &_browse; - - GET_PLUGIN(p, plugin); - p->selector = sel; - - evry_plugin_register(plugin, type, 2); - return plugin; -} - /***************************************************************************/ int evry_plug_actions_init() { - _base_plug = evry_plugin_new(NULL, _("Actions"), NULL, NULL, - EVRY_TYPE_ACTION, NULL, NULL, NULL, NULL); + _plug = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, + EVRY_TYPE_ACTION, + _begin, _finish, _fetch, NULL); + + _plug->browse = &_browse; + + evry_plugin_register(_plug, EVRY_PLUGIN_ACTION, 2); return 1; } @@ -219,7 +185,7 @@ evry_plug_actions_shutdown() { Evry_Item *it; - evry_plugin_free(_base_plug); + evry_plugin_free(_plug); /* bypass unregister, because it modifies the list */ EINA_LIST_FREE(evry_conf->actions, it) @@ -248,7 +214,7 @@ _action_free_cb(Evry_Item *it) { GET_ACTION(act, it); - if (act->name) eina_stringshare_del(act->name); + IF_RELEASE(act->name); E_FREE(act); } @@ -260,8 +226,8 @@ evry_action_new(const char *name, const char *label, int (*action) (Evry_Action *act), int (*check_item) (Evry_Action *act, const Evry_Item *it)) { - Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _base_plug, label, NULL, _action_free_cb); - + Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _plug, label, + NULL, _action_free_cb); if (icon) act->base.icon = eina_stringshare_add(icon); diff --git a/src/modules/everything/evry_plug_aggregator.c b/src/modules/everything/evry_plug_aggregator.c index 824fc855b..34efabc40 100644 --- a/src/modules/everything/evry_plug_aggregator.c +++ b/src/modules/everything/evry_plug_aggregator.c @@ -1,5 +1,7 @@ #include "e_mod_main.h" +//TODO min input for items not in history + #define MAX_ITEMS 50 typedef struct _Plugin Plugin; @@ -17,34 +19,31 @@ static int _fetch(Evry_Plugin *plugin, const char *input) { Plugin *p = (Plugin *) plugin; - Evry_Plugin *pp; + Evry_Plugin *pp, *pp2; Evry_State *s; Eina_List *l, *ll, *lp = NULL; Evry_Item *it, *it2; - int i, cnt = 0; + int i, top_level = 0, subj_sel = 0, inp_len = 0, cnt = 0; Eina_List *items = NULL; const char *context = NULL; char buf[128]; Evry_Selector *sel = p->win->selectors[p->type]; - if (input && !input[0]) input = NULL; + if (input && input[0]) + inp_len = strlen(input); + else + input = NULL; EVRY_PLUGIN_ITEMS_FREE(p); s = sel->state; if (!s) return 0; - if (!s->cur_plugins) - { - /* 'text' and 'actions' are always loaded */ - if ((sel == p->win->selectors[0]) && - (eina_list_count(s->plugins) == 2)) - { - evry_item_ref(p->warning); - EVRY_PLUGIN_ITEM_APPEND(p, p->warning); - } - return 1; - } + if (sel == p->win->selectors[0]) + subj_sel = 1; + + if (!sel->states->next) + top_level = 1; /* get current items' context ... */ for (i = 1; i < 3; i++) @@ -56,54 +55,79 @@ _fetch(Evry_Plugin *plugin, const char *input) } } - /* filter all to be shown in aggregator */ + /* collect plugins to be shown in aggregator */ EINA_LIST_FOREACH(s->cur_plugins, l, pp) { - if (!pp->config->aggregate || pp == plugin) + if (!pp->config->aggregate) continue; - if (!sel->states->next && !pp->config->top_level) + if (pp == plugin) + continue; + if (top_level && !pp->config->top_level) continue; lp = eina_list_append(lp, pp); } - /* show non-top-level plugins as item */ - if (!s->trigger_active && !sel->states->next) + if (top_level && (!s->trigger_active)) { + /* show non-top-level plugins as item */ EINA_LIST_FOREACH(s->plugins, l, pp) { - GET_ITEM(it, pp); + int min_fuzz = 0; + double max_usage = 0.0; - if (pp->config->top_level || pp == plugin) + if (pp->config->top_level) + continue; + + if (pp == plugin) continue; if (!pp->items) continue; - it->hi = NULL; - it->usage = 0; - it->fuzzy_match = 0; + /* give plugin item the highest priority of its items */ + EINA_LIST_FOREACH(pp->items, ll, it) + { + if (it->usage >= 0) + evry_history_item_usage_set(it, input, context); - /* if (input) - * { - * evry_history_item_usage_set(it, NULL, NULL); - * it->usage /= 100.0; - * it->fuzzy_match = ; - * } */ + if (it->usage && it->usage > max_usage) + { + max_usage = it->usage; + } + + if (it->fuzzy_match == 0) + it->fuzzy_match = evry_fuzzy_match(it->label, input); + + if ((!min_fuzz) || ((it->fuzzy_match > 0) && + (it->fuzzy_match < min_fuzz))) + min_fuzz = it->fuzzy_match; + } + + GET_ITEM(it, pp); + + it->hi = NULL; + + evry_history_item_usage_set(it, NULL, NULL); + it->usage /= 100.0; + + if (it->usage && max_usage && (it->usage < max_usage)) + it->usage = max_usage; + it->fuzzy_match = min_fuzz; IF_RELEASE(it->detail); - snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items")); + snprintf(buf, sizeof(buf), "%d %s", + eina_list_count(pp->items), _("Items")); it->detail = eina_stringshare_add(buf); items = eina_list_append(items, it); } /* only one plugin: show items */ - if (eina_list_count(s->cur_plugins) == 1 && items) + if ((eina_list_count(s->cur_plugins)) == 1 && items && + (pp = eina_list_data_get(items)) && (pp->config->aggregate)) { - pp = eina_list_data_get(items); eina_list_free(items); items = NULL; - EINA_LIST_FOREACH(pp->items, l, it) { if (it->usage >= 0) @@ -114,27 +138,63 @@ _fetch(Evry_Plugin *plugin, const char *input) items = eina_list_append(items, it); } } + +#if 0 + /* append all plugins as items (which were not added above) */ + if (inp_len >= plugin->config->min_query) + { + EINA_LIST_FOREACH(s->plugins, l, pp) + { + if (!strcmp(pp->name, "Actions")) + continue; + + /* items MUST only conatin plugins here ! */ + EINA_LIST_FOREACH(items, ll, pp2) + if (pp2->name == pp->name) break; + if (pp2) + continue; + + GET_ITEM(it, pp); + + if ((!input) || + (it->fuzzy_match = evry_fuzzy_match(it->label, input))) + { + evry_history_item_usage_set(it, input, NULL); + it->usage /= 100.0; + + EVRY_ITEM(pp)->plugin->state = s; + items = eina_list_append(items, pp); + } + } + } +#endif + if (!lp && (eina_list_count(items) < 2)) + { + if (items) eina_list_free(items); + return 0; + } } - if (!lp && !items) return 0; + if (!lp && !items) + return 0; /* if there is only one plugin append all items */ if (lp && !lp->next) { - pp = lp->data; + pp = eina_list_data_get(lp); - EINA_LIST_FOREACH(pp->items, l, it) - { - if (it->usage >= 0) - evry_history_item_usage_set(it, input, context); - if (it->fuzzy_match == 0) - it->fuzzy_match = evry_fuzzy_match(it->label, input); + EINA_LIST_FOREACH(pp->items, l, it) + { + if (it->usage >= 0) + evry_history_item_usage_set(it, input, context); - items = eina_list_append(items, it); - } + if (it->fuzzy_match == 0) + it->fuzzy_match = evry_fuzzy_match(it->label, input); + + items = eina_list_append(items, it); + } } - /* if there is input append all items that match or have - fuzzy_match set to -1 */ + /* if there is input append all items that match */ else if (input) { EINA_LIST_FOREACH(lp, l, pp) @@ -144,32 +204,16 @@ _fetch(Evry_Plugin *plugin, const char *input) if (it->fuzzy_match == 0) it->fuzzy_match = evry_fuzzy_match(it->label, input); - if (it->fuzzy_match || sel == p->win->selectors[2]) - { - if (it->usage >= 0) - evry_history_item_usage_set(it, input, context); - - items = eina_list_append(items, it); - } - } - } - } - /* always append items of action or object selector */ - else if ((!input) && - ((sel == p->win->selectors[1]) || - (sel == p->win->selectors[2]))) - { - EINA_LIST_FOREACH(lp, l, pp) - { - EINA_LIST_FOREACH(pp->items, ll, it) - { if (it->usage >= 0) - evry_history_item_usage_set(it, NULL, context); - it->fuzzy_match = 0; + evry_history_item_usage_set(it, input, context); + + if ((subj_sel) && (top_level) && + (!it->usage) && (inp_len < 2)) + continue; items = eina_list_append(items, it); - } - } + } + } } /* no input: append all items that are in history */ else @@ -178,9 +222,9 @@ _fetch(Evry_Plugin *plugin, const char *input) { EINA_LIST_FOREACH(pp->items, ll, it) { - if ((it->usage >= 0) && - (evry_history_item_usage_set(it, input, context)) && - (!eina_list_data_find_list(items, it))) + if (((it->usage >= 0) && + (evry_history_item_usage_set(it, input, context))) || + (!subj_sel)) { it->fuzzy_match = 0; items = eina_list_append(items, it); @@ -189,22 +233,18 @@ _fetch(Evry_Plugin *plugin, const char *input) } } - if (lp && lp->next && eina_list_count(items) < MAX_ITEMS) + if ((!top_level) && (eina_list_count(items) < MAX_ITEMS)) { - EINA_LIST_FOREACH(lp, l, pp) - { - EINA_LIST_FOREACH(pp->items, ll, it) - { - if (!eina_list_data_find_list(items, it)) - { - it->usage = -1; - if (it->fuzzy_match == 0) - it->fuzzy_match = evry_fuzzy_match(it->label, input); + EINA_LIST_FOREACH(lp, l, pp) + { + EINA_LIST_FOREACH(pp->items, ll, it) + { + if (eina_list_data_find_list(items, it)) + continue; - items = eina_list_append(items, it); - } - } - } + items = eina_list_append(items, it); + } + } } items = eina_list_sort(items, -1, evry_items_sort_func); @@ -234,16 +274,45 @@ _fetch(Evry_Plugin *plugin, const char *input) } - if (items) eina_list_free(items); if (lp) eina_list_free(lp); + if (items) + { + eina_list_free(items); + } + /* 'text' and 'actions' are always loaded */ + else if ((subj_sel) && (eina_list_count(s->plugins) == 2)) + { + evry_item_ref(p->warning); + EVRY_PLUGIN_ITEM_APPEND(p, p->warning); + } + return !!(p->base.items); } static void -_finish(Evry_Plugin *p) +_finish(Evry_Plugin *plugin) { + GET_PLUGIN(p, plugin); + EVRY_PLUGIN_ITEMS_FREE(p); + + E_FREE(p); +} + +static Evry_Plugin * +_begin(Evry_Plugin *plugin, const Evry_Item *it __UNUSED__) +{ + Plugin *p; + + GET_PLUGIN(base, plugin); + EVRY_PLUGIN_INSTANCE(p, plugin); + + p->type = base->type; + p->win = base->win; + p->warning = base->warning; + + return EVRY_PLUGIN(p); } static void @@ -251,8 +320,6 @@ _free(Evry_Plugin *plugin) { GET_PLUGIN(p, plugin); - _finish(plugin); - evry_item_free(p->warning); free(p); @@ -263,7 +330,7 @@ evry_aggregator_new(Evry_Window *win, int type) { Evry_Plugin *p; - p = EVRY_PLUGIN_NEW(Plugin, N_("All"), NULL, 0, NULL, _finish, _fetch, _free); + p = EVRY_PLUGIN_NEW(Plugin, N_("All"), NULL, 0, _begin, _finish, _fetch, _free); if (evry_plugin_register(p, type, -1)) { diff --git a/src/modules/everything/evry_plug_collection.c b/src/modules/everything/evry_plug_collection.c index 6ffeb2188..12c28d1d5 100644 --- a/src/modules/everything/evry_plug_collection.c +++ b/src/modules/everything/evry_plug_collection.c @@ -10,8 +10,6 @@ typedef struct _Plugin Plugin; struct _Plugin { Evry_Plugin base; - const char *input; - Eina_List *items; }; static Eina_List *plugins = NULL; @@ -44,34 +42,61 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item) return NULL; } +static Evry_Item * +_add_item(Plugin *p, Plugin_Config *pc) +{ + Evry_Plugin *pp; + Evry_Item *it = NULL; + + if (pc->enabled && (pp = evry_plugin_find(pc->name))) + { + pc->plugin = pp; + + GET_ITEM(itp, pp); + it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL); + if (itp->icon) it->icon = eina_stringshare_ref(itp->icon); + it->icon_get = itp->icon_get; + it->data = pc; + it->browseable = EINA_TRUE; + p->base.items = eina_list_append(p->base.items, it); + } + return it; +} + static Evry_Plugin * _begin(Evry_Plugin *plugin, const Evry_Item *item) { - Evry_Plugin *pp; Plugin_Config *pc; - Evry_Item *it; Eina_List *l; Plugin *p; EVRY_PLUGIN_INSTANCE(p, plugin); EINA_LIST_FOREACH(plugin->config->plugins, l, pc) + _add_item(p, pc); + + return EVRY_PLUGIN(p); +} + +static Evry_Plugin * +_begin_all(Evry_Plugin *plugin, const Evry_Item *item) +{ + Plugin_Config *pc; + Eina_List *l; + Plugin *p; + + EVRY_PLUGIN_INSTANCE(p, plugin); + + EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) { - if (!pc->enabled) + if (!strcmp(pc->name, "All") || + !strcmp(pc->name, "Actions") || + !strcmp(pc->name, "Plugins")) continue; - - if ((pp = evry_plugin_find(pc->name))) - { - GET_ITEM(itp, pp); - it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL); - if (itp->icon) it->icon = eina_stringshare_ref(itp->icon); - pc->plugin = pp; - it->data = pc; - it->browseable = EINA_TRUE; - p->base.items = eina_list_append(p->base.items, it); - } + + _add_item(p, pc); } - + return EVRY_PLUGIN(p); } @@ -84,8 +109,6 @@ _finish(Evry_Plugin *plugin) EVRY_PLUGIN_ITEMS_FREE(p); - IF_RELEASE(p->input); - E_FREE(p); } @@ -111,6 +134,19 @@ evry_plug_collection_init(void) e_configure_registry_category_add ("extensions", 80, _("Extensions"), NULL, "preferences-extensions"); + + p = EVRY_PLUGIN_NEW(Evry_Plugin, N_("Plugins"), + _module_icon, COLLECTION_PLUGIN, + _begin_all, _finish, _fetch, NULL); + p->browse = &_browse; + if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1)) + { + p->config->enabled = EINA_FALSE; + p->config->aggregate = EINA_FALSE; + } + plugins = eina_list_append(plugins, p); + + EINA_LIST_FOREACH(evry_conf->collections, l, pc) { p = EVRY_PLUGIN_NEW(Evry_Plugin, N_(pc->name), @@ -135,7 +171,7 @@ evry_plug_collection_init(void) plugins = eina_list_append(plugins, p); } - + return EINA_TRUE; } @@ -146,9 +182,12 @@ evry_plug_collection_shutdown(void) EINA_LIST_FREE(plugins, p) { - e_configure_registry_item_del(p->config_path); - eina_stringshare_del(p->config_path); + if (p->config_path) + { + e_configure_registry_item_del(p->config_path); + eina_stringshare_del(p->config_path); + } + EVRY_PLUGIN_FREE(p); } - } diff --git a/src/modules/everything/evry_plugin.c b/src/modules/everything/evry_plugin.c index 94d9db55e..395502413 100644 --- a/src/modules/everything/evry_plugin.c +++ b/src/modules/everything/evry_plugin.c @@ -149,6 +149,7 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority) act = EVRY_ACTION_NEW(buf, p->input_type, 0, EVRY_ITEM(p)->icon, _evry_plugin_action_browse, NULL); + EVRY_ITEM(act)->icon_get = EVRY_ITEM(p)->icon_get; EVRY_ITEM(act)->data = p; evry_action_register(act, 1); actions = eina_list_append(actions, act); diff --git a/src/modules/everything/evry_view.c b/src/modules/everything/evry_view.c index 458a51d1b..bf74bcf4e 100644 --- a/src/modules/everything/evry_view.c +++ b/src/modules/everything/evry_view.c @@ -364,7 +364,7 @@ _e_smart_reconfigure_do(void *data) int cnt = eina_list_count(sd->items); double col = 1; int width = sd->w - 8; - + if (cnt < 5) { col = 2; @@ -1422,7 +1422,7 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) sel = sd->view->state->selector; if (!sel || !sel->states) return; - + diff_x = abs(ev->cur.canvas.x - sd->mouse_x); diff_y = abs(ev->cur.canvas.y - sd->mouse_y);