forked from enlightenment/enlightenment
added selectors-shift function - in object selector one can trigger the
binding for show everything again and start with the current object as new subject. esc or evry-binding will go back to previous level. this will come in handy sooner or later. believe me (= added browse folder action to browse the containing folder of a file in everything. now for example you have a plalist entry or a file from tracker search and want to do sth within the parent dir of that file: select browse folder -> .. go to parent -> trigger-evry-again -> select delete/copy/watch the folder as slideshow or do whatever. SVN revision: 48905
This commit is contained in:
parent
76076d4399
commit
caacbb82df
|
@ -75,7 +75,9 @@ 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;
|
||||
|
@ -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)))
|
||||
|
@ -152,13 +158,17 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
|
|||
|
||||
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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -33,6 +33,9 @@ struct _Evry_Window
|
|||
|
||||
Evry_Selector *selector;
|
||||
Evry_Selector **selectors;
|
||||
Evry_Selector **sel_list;
|
||||
|
||||
int level;
|
||||
};
|
||||
|
||||
struct _Evry_Selector
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -8,7 +8,8 @@ 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,7 +259,8 @@ 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);
|
||||
|
|
Loading…
Reference in New Issue