diff --git a/src/modules/everything-apps/e_mod_main.c b/src/modules/everything-apps/e_mod_main.c index aaa4b5fff..e4c25e816 100644 --- a/src/modules/everything-apps/e_mod_main.c +++ b/src/modules/everything-apps/e_mod_main.c @@ -75,13 +75,15 @@ static void _hash_free(void *data) static Evry_Plugin * _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item) { - GET_PLUGIN(p, plugin); + Plugin *p = NULL; + + /* GET_PLUGIN(p, plugin); */ Efreet_Desktop *d, *d2; const char *mime; const char *path = NULL; Eina_List *l; - + if (CHECK_TYPE(item, EVRY_TYPE_ACTION)) { GET_ACTION(act, item); @@ -111,6 +113,10 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item) if (!path || !mime || !(mime = efreet_mime_type_get(path))) return NULL; + p = E_NEW(Plugin, 1); + p->base = *plugin; + p->base.items = NULL; + p->apps_mime = efreet_util_desktop_mime_list(mime); if (strcmp(mime, "text/plain") && (!strncmp(mime, "text/", 5))) @@ -149,16 +155,20 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item) p->apps_mime = eina_list_prepend(p->apps_mime, d); } - + p->added = eina_hash_string_small_new(_hash_free); - return plugin; + return EVRY_PLUGIN(p); } static Evry_Plugin * _begin(Evry_Plugin *plugin, const Evry_Item *item) { - GET_PLUGIN(p, plugin); + Plugin *p; + + p = E_NEW(Plugin, 1); + p->base = *plugin; + p->base.items = NULL; if (item && (item != _act_open_with)) return NULL; @@ -168,7 +178,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item) if (_conf->list_executables) _scan_executables(); - return plugin; + return EVRY_PLUGIN(p); } @@ -217,6 +227,7 @@ _finish(Evry_Plugin *plugin) p->app_command = NULL; p->app_parameter = NULL; + E_FREE(p); } static void @@ -384,7 +395,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match) eina_hash_add(p->added, file, app); } } - + EVRY_ACTN(app)->remember_context = EINA_TRUE; EVRY_ITEM(app)->subtype = EVRY_TYPE_ACTION; EVRY_ITEM(app)->fuzzy_match = match; @@ -402,16 +413,16 @@ _add_desktop_list(Plugin *p, Eina_List *apps, const char *input) int m1, m2; const char *exec, *end; char buf[PATH_MAX]; - + EINA_LIST_FOREACH(apps, l, desktop) { if (eina_list_count(EVRY_PLUGIN(p)->items) > 199) break; if (!desktop->name || !desktop->exec) continue; - + if (input) { m1 = m2 = 0; - + exec = ecore_file_file_get(desktop->exec); if (exec && (end = strchr(exec, '%'))) { @@ -423,7 +434,7 @@ _add_desktop_list(Plugin *p, Eina_List *apps, const char *input) { m1 = evry->fuzzy_match(exec, input); } - + m2 = evry->fuzzy_match(desktop->name, input); if (!m1 || (m2 && m2 < m1)) diff --git a/src/modules/everything-files/e_mod_main.c b/src/modules/everything-files/e_mod_main.c index 4aadce5cc..43eb0d993 100644 --- a/src/modules/everything-files/e_mod_main.c +++ b/src/modules/everything-files/e_mod_main.c @@ -234,7 +234,6 @@ static void _scan_mime_func(void *data) { Data *d = data; - /* Plugin *p = d->plugin; */ Evry_Item_File *file; Eina_List *l; const char *mime; @@ -311,7 +310,6 @@ _scan_cancel_func(void *data) Data *d = data; Plugin *p = d->plugin; Evry_Item_File *file; - /* Evry_Item *item; */ if (!d->run_cnt) { @@ -351,7 +349,6 @@ _scan_end_func(void *data) Data *d = data; Plugin *p = d->plugin; Evry_Item *item; - /* Evry_Item_File *f; */ char *filename, *path, *mime; Eina_List *l, *ll, *lll; History_Item *hi; @@ -359,12 +356,6 @@ _scan_end_func(void *data) History_Types *ht = NULL; int cnt = 0; - /* if (!p->thread) - * { - * _scan_cancel_func(d); - * return; - * } */ - if (_conf->cache_dirs) ht = evry->history_types_get(EVRY_TYPE_FILE); @@ -517,8 +508,6 @@ _dir_watcher(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const c case ECORE_FILE_EVENT_CREATED_DIRECTORY: case ECORE_FILE_EVENT_CREATED_FILE: - /* DBG("added %s", path); */ - label = ecore_file_file_get(path); file = EVRY_ITEM_NEW(Evry_Item_File, p, label, NULL, _item_free); @@ -528,7 +517,6 @@ _dir_watcher(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const c file->mime = eina_stringshare_ref(_mime_dir); _item_fill(file); - p->files = eina_list_append(p->files, file); break; @@ -536,7 +524,6 @@ _dir_watcher(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const c case ECORE_FILE_EVENT_DELETED_FILE: case ECORE_FILE_EVENT_DELETED_DIRECTORY: label = eina_stringshare_add(path); - /* DBG("delete %s", path); */ EINA_LIST_FOREACH_SAFE(p->files, l, ll, file) { @@ -609,21 +596,41 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) if (it && !CHECK_TYPE(it, EVRY_TYPE_ACTION)) return NULL; - p = E_NEW(Plugin, 1); - p->base = *plugin; - p->base.items = NULL; - if (it) { /* provide object */ - p->directory = eina_stringshare_add(e_user_homedir_get()); + const char *dir = NULL; + + GET_ACTION(act, it); + if (!strcmp(act->name, "Browse Folder...")) + { + GET_FILE(file, act->it1.item); + if (!evry->file_path_get(file)) + return NULL; + + char *tmp = ecore_file_dir_get(file->path); + dir = eina_stringshare_add(tmp); + E_FREE(tmp); + } + else + { + dir = eina_stringshare_add(e_user_homedir_get()); + } + + p = E_NEW(Plugin, 1); + p->base = *plugin; + p->base.items = NULL; + p->directory = dir; p->parent = EINA_FALSE; _read_directory(p); } else { /* provide subject */ + p = E_NEW(Plugin, 1); + p->base = *plugin; + p->base.items = NULL; p->min_query = plugin->config->min_query; if (_conf->show_homedir) @@ -694,7 +701,6 @@ static int _fetch(Evry_Plugin *plugin, const char *input) { GET_PLUGIN(p, plugin); - /* Evry_Item_File *file; */ int len = (input ? strlen(input) : 0); if (!p->command) @@ -707,9 +713,6 @@ _fetch(Evry_Plugin *plugin, const char *input) char *path = NULL; if (p->command != CMD_SHOW_ROOT) - /* ((ecore_file_is_dir(input) ? (path = strdup(input)) : 0) || - * ((path = ecore_file_dir_get(input)) && - * (strcmp(p->directory, path))))) */ { _free_files(p); @@ -1205,6 +1208,12 @@ _open_folder_action(Evry_Action *act) return 1; } +static int +_browse_folder_action(Evry_Action *act) +{ + return 0; +} + static int _file_trash_action(Evry_Action *act) { @@ -1349,9 +1358,13 @@ _plugins_init(const Evry_API *api) * _file_trash_action, NULL); * EVRY_ITEM_DATA_INT_SET(act, ACT_DELETE); */ + ACTION_NEW(N_("Browse Folder..."), EVRY_TYPE_FILE, "folder-open", + _browse_folder_action, NULL); + ACTION_NEW(N_("Open Folder (EFM)"), 0, "folder-open", _open_folder_action, _open_folder_check); act->remember_context = EINA_TRUE; + #undef ACTION_NEW return EINA_TRUE; diff --git a/src/modules/everything/e_mod_main.h b/src/modules/everything/e_mod_main.h index e4d16c089..91323255f 100644 --- a/src/modules/everything/e_mod_main.h +++ b/src/modules/everything/e_mod_main.h @@ -33,6 +33,9 @@ struct _Evry_Window Evry_Selector *selector; Evry_Selector **selectors; + Evry_Selector **sel_list; + + int level; }; struct _Evry_Selector diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 9f53f423e..8d404f16b 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -127,6 +127,46 @@ _cb_show_timer(void *data) return 0; } +static int +_evry_selectors_shift() +{ + void *new_sel; + Evry_Selector *sel; + Evry_State *s; + + if ((new_sel = realloc(win->sel_list, sizeof(Evry_Selector*) * 6))) + { + win->sel_list = new_sel; + + edje_object_part_unswallow(win->o_main, win->sel_list[0]->o_main); + evas_object_hide(win->sel_list[0]->o_main); + edje_object_part_unswallow(win->o_main, win->sel_list[1]->o_main); + evas_object_hide(win->sel_list[1]->o_main); + edje_object_part_unswallow(win->o_main, win->sel_list[2]->o_main); + + edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e"); + + win->sel_list[5] = NULL; + win->selectors = win->sel_list + 2; + _evry_selector_new(win, EVRY_PLUGIN_ACTION); + _evry_selector_new(win, EVRY_PLUGIN_OBJECT); + + win->selector = win->selectors[0]; + sel = win->selector; + + edje_object_part_swallow(win->o_main, "e.swallow.subject_selector", + sel->o_main); + + edje_object_signal_emit(sel->o_main, "e,state,selected", "e"); + /* was checked before. anyway */ + if ((s = sel->state) && (s->cur_item)) + _evry_selector_update_actions(sel); + + win->level++; + } + return 1; +} + int evry_show(E_Zone *zone, const char *params) { @@ -138,6 +178,14 @@ evry_show(E_Zone *zone, const char *params) Eina_List *l; Evry_Plugin *p; + if (!(win->level) && !(params) && + (win->selector == win->selectors[2]) && + (win->selector->state && win->selector->state->cur_item)) + { + _evry_selectors_shift(1); + return 1; + } + if (!(params && eina_list_count(win->selectors[0]->states) == 1)) evry_hide(1); @@ -159,7 +207,7 @@ evry_show(E_Zone *zone, const char *params) return 0; ecore_x_sync(); - + win = _evry_window_new(zone); if (!win) { @@ -175,7 +223,9 @@ evry_show(E_Zone *zone, const char *params) if (params) win->plugin_dedicated = EINA_TRUE; - win->selectors = E_NEW(Evry_Selector*, 3); + win->sel_list = E_NEW(Evry_Selector*, 4); + win->sel_list[3] = NULL; + win->selectors = win->sel_list; _evry_selector_new(win, EVRY_PLUGIN_SUBJECT); _evry_selector_new(win, EVRY_PLUGIN_ACTION); _evry_selector_new(win, EVRY_PLUGIN_OBJECT); @@ -212,6 +262,7 @@ void evry_hide(int clear) { Ecore_Event_Handler *ev; + int i; if (!win) return; @@ -256,17 +307,49 @@ evry_hide(int clear) return; } + if (win->level > 0) + { + Evry_Selector *sel; + + _evry_selector_free(win->selectors[1]); + _evry_selector_free(win->selectors[2]); + + edje_object_part_unswallow(win->o_main, win->selectors[0]->o_main); + win->selectors = win->sel_list; //-= 2; + win->sel_list[3] = NULL; + win->selector = NULL; + + edje_object_signal_emit(win->o_main, + "e,state,object_selector_show", "e"); + + edje_object_part_swallow(win->o_main, + "e.swallow.subject_selector", + win->selectors[0]->o_main); + evas_object_show(win->selectors[0]->o_main); + + edje_object_part_swallow(win->o_main, + "e.swallow.action_selector", + win->selectors[1]->o_main); + evas_object_show(win->selectors[1]->o_main); + + _evry_selector_activate(win->selectors[2]); + + edje_object_part_swallow(win->o_main, + "e.swallow.object_selector", + win->selectors[2]->o_main); + win->level = 0; + return; + } + if (win->show_timer) ecore_timer_del(win->show_timer); win->visible = EINA_FALSE; - _evry_selector_free(win->selectors[0]); - _evry_selector_free(win->selectors[1]); - _evry_selector_free(win->selectors[2]); - E_FREE(win->selectors); - /* selectors = NULL; - * selector = NULL; */ + for (i = 0; win->sel_list[i]; i++) + _evry_selector_free(win->sel_list[i]); + + E_FREE(win->sel_list); EINA_LIST_FREE(win->handlers, ev) ecore_event_handler_del(ev); @@ -782,6 +865,12 @@ _evry_selector_activate(Evry_Selector *sel) _evry_list_win_clear(evry_conf->hide_list); } + if (!sel) + { + ERR("selector == NULL"); + return; + } + edje_object_signal_emit(sel->o_main, "e,state,selected", "e"); win->selector = sel; @@ -1375,7 +1464,7 @@ _evry_cheat_history(Evry_State *s, int promote, int delete) if (!(ht = evry_history_types_get(it->type))) return 1; - + if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label)))) return 1; diff --git a/src/modules/everything/evry_plug_aggregator.c b/src/modules/everything/evry_plug_aggregator.c index e4e1ac049..24b557923 100644 --- a/src/modules/everything/evry_plug_aggregator.c +++ b/src/modules/everything/evry_plug_aggregator.c @@ -8,8 +8,9 @@ struct _Plugin { Evry_Plugin base; int type; - Evry_Selector **selectors; - + /* Evry_Selector **selectors; */ + Evry_Window *win; + Evry_Item *warning; }; @@ -25,7 +26,7 @@ _fetch(Evry_Plugin *plugin, const char *input) Eina_List *items = NULL; const char *context = NULL; char buf[128]; - Evry_Selector *sel = p->selectors[p->type]; + Evry_Selector *sel = p->win->selectors[p->type]; if (input && !input[0]) input = NULL; @@ -37,7 +38,7 @@ _fetch(Evry_Plugin *plugin, const char *input) if (!s->cur_plugins) { /* 'text' and 'actions' are always loaded */ - if ((sel == p->selectors[0]) && + if ((sel == p->win->selectors[0]) && (eina_list_count(s->plugins) == 2)) { evry_item_ref(p->warning); @@ -49,9 +50,9 @@ _fetch(Evry_Plugin *plugin, const char *input) /* get current items' context ... */ for (i = 1; i < 3; i++) { - if (sel == p->selectors[i]) + if (sel == p->win->selectors[i]) { - it = p->selectors[i-1]->state->cur_item; + it = p->win->selectors[i-1]->state->cur_item; if (it) context = it->context; } } @@ -127,7 +128,7 @@ _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->selectors[2]) + if (it->fuzzy_match || sel == p->win->selectors[2]) { if (it->usage >= 0) evry_history_item_usage_set(it, input, context); @@ -139,8 +140,8 @@ _fetch(Evry_Plugin *plugin, const char *input) } /* always append items of action or object selector */ else if ((!input) && - ((sel == p->selectors[1]) || - (sel == p->selectors[2]))) + ((sel == p->win->selectors[1]) || + (sel == p->win->selectors[2]))) { EINA_LIST_FOREACH(lp, l, pp) { @@ -258,9 +259,10 @@ evry_aggregator_new(Evry_Window *win, int type) } GET_PLUGIN(pa, p); - pa->selectors = win->selectors; + /* pa->selectors = win->selectors; */ + pa->win = win; pa->type = type; - + pa->warning = evry_item_new(NULL, p, N_("No plugins loaded"), NULL, NULL); pa->warning->type = EVRY_TYPE_NONE;