diff --git a/configure.ac b/configure.ac index 489b57ee4..4f82b5222 100644 --- a/configure.ac +++ b/configure.ac @@ -319,6 +319,7 @@ PKG_CHECK_MODULES(E, [ edje efreet efreet-mime + efreet-trash eina-0 dbus-1 edbus diff --git a/data/themes/default.edc b/data/themes/default.edc index fc1414f11..f9ae6d6ce 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -34341,6 +34341,34 @@ collections { color: 255 255 255 108; } } + part { + name: "bg_mark"; + mouse_events: 0; + description { + state: "default" 0.0; + visible: 0; + rel1 { + to: "base"; + offset: -1 -3; + } + rel2 { + to: "base"; + offset: -2 2; + } + fill.smooth: 0; + image { + normal: "everything_item_bg.png"; + border: 5 5 5 5; + } + color: 255 255 255 16; + } + description { + state: "marked" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 48; + } + } part { name: "base"; mouse_events: 0; @@ -34569,6 +34597,24 @@ collections { target: "bg"; /* target: "clip"; */ } + program { + name: "mark"; + signal: "e,state,marked"; + source: "e"; + action: STATE_SET "marked" 0.0; + target: "bg_mark"; + transition: ACCELERATE 0.15; + /* target: "clip"; */ + } + program { + name: "unmark"; + signal: "e,state,unmarked"; + source: "e"; + action: STATE_SET "default" 0.0; + transition: LINEAR 0.2; + target: "bg_mark"; + /* target: "clip"; */ + } program { name: "arrow_show"; signal: "e,state,browseable"; @@ -34637,8 +34683,6 @@ collections { group { name: "e/modules/everything/thumbview/main/scrollframe"; images { - image: "arrow_up.png" COMP; - image: "arrow_down.png" COMP; image: "bt_sm_base1.png" COMP; image: "bt_sm_base2.png" COMP; image: "bt_sm_shine.png" COMP; @@ -34646,16 +34690,8 @@ collections { image: "sb_runnerv.png" COMP; } parts { - /* - part { name: "clipper"; - type: RECT; - mouse_events: 0; - description { state: "default" 0.0; } - } - */ part { name: "e.swallow.content"; - // clip_to: "clipper"; type: SWALLOW; description { state: "default" 0.0; diff --git a/src/modules/everything-apps/e_mod_main.c b/src/modules/everything-apps/e_mod_main.c index a8a75904f..03c034c4f 100644 --- a/src/modules/everything-apps/e_mod_main.c +++ b/src/modules/everything-apps/e_mod_main.c @@ -836,12 +836,11 @@ _exec_sudo_action(Evry_Action *act) } static int -_open_with_action(Evry_Plugin *plugin, const Evry_Item *it) +_open_with_action(Evry_Plugin *plugin, const Evry_Item *act, const Evry_Item *subj) { PLUGIN(p, plugin); - if (p->candidate) - return evry_util_exec_app(it, p->candidate); + return evry_util_exec_app(act, subj); return 0; } diff --git a/src/modules/everything-calc/e_mod_main.c b/src/modules/everything-calc/e_mod_main.c index 942108920..f1e961336 100644 --- a/src/modules/everything-calc/e_mod_main.c +++ b/src/modules/everything-calc/e_mod_main.c @@ -101,7 +101,7 @@ _cleanup(Evry_Plugin *p) } static int -_action(Evry_Plugin *p, const Evry_Item *it) +_action(Evry_Plugin *p, const Evry_Item *act __UNUSED__, const Evry_Item *it) { Eina_List *l; Evry_Item *it2, *it_old; diff --git a/src/modules/everything-files/e_mod_main.c b/src/modules/everything-files/e_mod_main.c index 297b03d13..d2ebadeaa 100644 --- a/src/modules/everything-files/e_mod_main.c +++ b/src/modules/everything-files/e_mod_main.c @@ -4,6 +4,7 @@ #include "Evry.h" #include "e_mod_main.h" +#include #define MAX_ITEMS 50 #define MAX_SHOWN 300 @@ -31,6 +32,7 @@ struct _Plugin Eina_Bool show_hidden; Ecore_Thread *thread; + Ecore_File_Monitor *dir_mon; Eina_Bool cleanup; }; @@ -358,6 +360,34 @@ _scan_end_func(void *data) evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD); } +static void +_dir_watcher(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path) +{ + Plugin *p = data; + Evry_Item_File *file; + + if (p->thread) + { + ecore_thread_cancel(p->thread); + } + + EINA_LIST_FREE(p->files, file) + evry_item_free(EVRY_ITEM(file)); + + EVRY_PLUGIN_ITEMS_CLEAR(p); + + if (event == ECORE_FILE_EVENT_DELETED_SELF) + { + evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD); + return; + } + + Data *d = E_NEW(Data, 1); + d->plugin = p; + + p->thread = ecore_thread_run(_scan_func, _scan_end_func, _scan_cancel_func, d); +} + static void _read_directory(Plugin *p) { @@ -369,6 +399,11 @@ _read_directory(Plugin *p) #endif p->thread = ecore_thread_run(_scan_func, _scan_end_func, _scan_cancel_func, d); + + if (p->dir_mon) + ecore_file_monitor_del(p->dir_mon); + + p->dir_mon = ecore_file_monitor_add(p->directory, _dir_watcher, p); } static Evry_Plugin * @@ -453,6 +488,9 @@ _cleanup(Evry_Plugin *plugin) if (p->input) eina_stringshare_del(p->input); + if (p->dir_mon) + ecore_file_monitor_del(p->dir_mon); + if (p->thread) { ecore_thread_cancel(p->thread); @@ -564,7 +602,7 @@ _fetch(Evry_Plugin *plugin, const char *input) { if (p->thread) ecore_thread_cancel(p->thread); - + /* browse root */ EINA_LIST_FREE(p->files, file) evry_item_free(EVRY_ITEM(file)); @@ -593,7 +631,11 @@ _fetch(Evry_Plugin *plugin, const char *input) if (p->thread) ecore_thread_cancel(p->thread); - + + if (p->dir_mon) + ecore_file_monitor_del(p->dir_mon); + p->dir_mon = NULL; + /* browse root */ EINA_LIST_FREE(p->hist_added, file) { @@ -634,7 +676,7 @@ _fetch(Evry_Plugin *plugin, const char *input) { if (p->thread) ecore_thread_cancel(p->thread); - + EINA_LIST_FREE(p->files, file) evry_item_free(EVRY_ITEM(file)); @@ -798,6 +840,35 @@ _open_term_action(Evry_Action *act) return ret; } + +static int +_file_trash_action(Evry_Action *act) +{ + Efreet_Uri *uri; + + ITEM_FILE(file, act->item1); + + if (!file->url) + { + /* efreet_uri_decode could be a litle less picky imo */ + char buf[4096]; + snprintf(buf, sizeof(buf), "file://%s", file->path); + uri = efreet_uri_decode(buf); + } + else + { + uri = efreet_uri_decode(file->url); + } + + if (uri) + { + efreet_trash_delete_uri(uri, 0); + efreet_uri_free(uri); + } + + return 1; +} + static Eina_Bool _plugins_init(void) { @@ -822,6 +893,10 @@ _plugins_init(void) _open_term_action, NULL); evry_action_register(act2, 2); + act2 = EVRY_ACTION_NEW(N_("Move to Trash"), "FILE", NULL, "system-run", + _file_trash_action, NULL); + evry_action_register(act2, 2); + return EINA_TRUE; } diff --git a/src/modules/everything-wallpaper/e_mod_main.c b/src/modules/everything-wallpaper/e_mod_main.c index 65ea53624..ac70bff07 100644 --- a/src/modules/everything-wallpaper/e_mod_main.c +++ b/src/modules/everything-wallpaper/e_mod_main.c @@ -172,7 +172,7 @@ _fetch(Evry_Plugin *plugin, const char *input) } static int -_action(Evry_Plugin *plugin, const Evry_Item *item) +_action(Evry_Plugin *plugin, const Evry_Item *act, const Evry_Item *item) { PLUGIN(p, plugin); diff --git a/src/modules/everything-windows/e_mod_main.c b/src/modules/everything-windows/e_mod_main.c index d539374a8..be7bd2a47 100644 --- a/src/modules/everything-windows/e_mod_main.c +++ b/src/modules/everything-windows/e_mod_main.c @@ -421,12 +421,12 @@ _act_fetch(Evry_Plugin *p, const char *input) } static int -_act_action(Evry_Plugin *p __UNUSED__, const Evry_Item *item) +_act_action(Evry_Plugin *p __UNUSED__, const Evry_Item *act, const Evry_Item *item) { void (*border_action) (E_Border *bd); - border_action = item->data; - border_action(inst->border); - + border_action = act->data; + border_action(((E_Border *)item->data)); + return EVRY_ACTION_FINISHED; } diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h index 7fd453cac..1165d4d68 100644 --- a/src/modules/everything/Evry.h +++ b/src/modules/everything/Evry.h @@ -123,7 +123,8 @@ struct _Evry_Item /* do not set by plugin! */ Evry_Item *next; - Eina_Bool selected; + Eina_Bool selected; + Eina_Bool marked; Evry_Plugin *plugin; int ref; void (*free) (Evry_Item *item); @@ -186,7 +187,7 @@ struct _Evry_Plugin Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e); /* only used when plugin is of type_action */ - int (*action) (Evry_Plugin *p, const Evry_Item *item); + int (*action) (Evry_Plugin *p, const Evry_Item *act, const Evry_Item *subj); /* try to complete current item: return: EVRY_COMPLETE_INPUT when input was changed diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 3e095266e..bc5ec63d8 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -409,15 +409,16 @@ evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark) { Evry_State *s = (Evry_State *)state; - if (mark) - s->sel_items = eina_list_append(s->sel_items, it); - else - s->sel_items = eina_list_remove(s->sel_items, it); - - /* s->plugin_auto_selected = EINA_FALSE; - * s->item_auto_selected = EINA_FALSE; - * _evry_item_sel(s, it); - * _evry_selector_update(selector); */ + if (mark && !it->marked) + { + it->marked = EINA_TRUE; + s->sel_items = eina_list_append(s->sel_items, it); + } + else if (it->marked) + { + it->marked = EINA_FALSE; + s->sel_items = eina_list_remove(s->sel_items, it); + } } EAPI void @@ -1168,6 +1169,9 @@ _evry_state_pop(Evry_Selector *sel) sel->aggregator->cleanup(sel->aggregator); + if (s->sel_items) + eina_list_free(s->sel_items); + E_FREE(s); sel->states = eina_list_remove_list(sel->states, sel->states); @@ -1680,7 +1684,9 @@ static void _evry_plugin_action(Evry_Selector *sel, int finished) { Evry_State *s_subject, *s_action, *s_object; - + Evry_Item *it, *it_act; + Eina_List *l; + if (selectors[0]->update_timer) { _evry_matches_update(selectors[0], 0); @@ -1709,32 +1715,73 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if (!s_action || !s_action->cur_item) return; - /* FIXME */ if (s_action->cur_item->plugin == selectors[1]->actions) { - Evry_Action *act = s_action->cur_item->data; Evry_Item *it_object = NULL; - - if (selectors[2] == selector) - it_object = selector->state->cur_item; - - if (act->type_in2 && !it_object) + Evry_Action *act = s_action->cur_item->data; + + /* get object item for action, when required */ + if (act->type_in2) { - if (selectors[1] == selector) - _evry_selectors_switch(1); - return; + /* check if object is provided */ + if (selectors[2] == selector) + { + s_object = selector->state; + it_object = s_object->cur_item; + } + + if (!it_object) + { + if (selectors[1] == selector) + _evry_selectors_switch(1); + return; + } + + act->item2 = it_object; } - act->item2 = it_object; - - if (!act->action(act)) + if (s_subject->sel_items) + { + EINA_LIST_REVERSE_FOREACH(s_subject->sel_items, l, it) + { + if (it->plugin->type_out != act->type_in1) + continue; + act->item1 = it; + act->action(act); + } + } + else if (s_object && s_object->sel_items) + { + EINA_LIST_FOREACH(s_object->sel_items, l, it) + { + if (it->plugin->type_out != act->type_in2) + continue; + act->item2 = it; + act->action(act); + } + } + else if (!act->action(act)) return; } else if (s_action->plugin->action) { - Evry_Item *it = s_action->cur_item; - if (!s_action->plugin->action(s_action->plugin, it)) - return; + it_act = s_action->cur_item; + + if (s_subject->sel_items) + { + EINA_LIST_REVERSE_FOREACH(s_subject->sel_items, l, it) + { + if (it->plugin->type_out != it_act->plugin->type_in) + continue; + s_action->plugin->action(s_action->plugin, it_act, it); + } + } + else + { + it = s_subject->cur_item; + if (!s_action->plugin->action(s_action->plugin, it_act, it)) + return; + } } else return; @@ -1746,10 +1793,10 @@ _evry_plugin_action(Evry_Selector *sel, int finished) /* let subject and object plugin know that an action was performed */ if (s_subject->plugin->action) - s_subject->plugin->action(s_subject->plugin, s_subject->cur_item); + s_subject->plugin->action(s_subject->plugin, s_action->cur_item, s_subject->cur_item); - if (s_object && s_object->plugin->action) - s_object->plugin->action(s_object->plugin, s_object->cur_item); + /* if (s_object && s_object->plugin->action) + * s_object->plugin->action(s_object->plugin, s_action->cur_item, s_object->cur_item); */ if (finished) evry_hide(); @@ -1901,7 +1948,9 @@ _evry_matches_update(Evry_Selector *sel, int async) Evry_State *s = sel->state; Evry_Plugin *p; Eina_List *l; + Evry_Item *it; const char *input; + s->changed = 1; if (s->inp[0]) @@ -1909,6 +1958,10 @@ _evry_matches_update(Evry_Selector *sel, int async) else input = NULL; + if (s->sel_items) + eina_list_free(s->sel_items); + s->sel_items = NULL; + if (!input || !s->trigger_active) { EINA_LIST_FREE(s->cur_plugins, p); @@ -1998,6 +2051,13 @@ _evry_matches_update(Evry_Selector *sel, int async) if (sel->update_timer) ecore_timer_del(sel->update_timer); sel->update_timer = NULL; + + if (s->plugin) + { + EINA_LIST_FOREACH(s->plugin->items, l, it) + if (it->marked) + s->sel_items = eina_list_append(s->sel_items, it); + } } static void diff --git a/src/modules/everything/evry_plug_aggregator.c b/src/modules/everything/evry_plug_aggregator.c index c025a0ea3..78effb08d 100644 --- a/src/modules/everything/evry_plug_aggregator.c +++ b/src/modules/everything/evry_plug_aggregator.c @@ -98,19 +98,22 @@ _cb_sort(const void *data1, const void *data2) static inline Eina_List * _add_item(Plugin *p, Eina_List *items, Evry_Item *it) -{ - Eina_List *_l; - Evry_Item *_it; - +{ /* remove duplicates provided by different plugins */ - EINA_LIST_FOREACH(p->base.items, _l, _it) + if (it->id) { - if ((it->plugin->name != _it->plugin->name) && - (it->plugin->type_out == _it->plugin->type_out) && - (it->id == _it->id)) - return items; - } + Eina_List *_l; + Evry_Item *_it; + EINA_LIST_FOREACH(p->base.items, _l, _it) + { + if ((it->plugin->name != _it->plugin->name) && + (it->plugin->type_out == _it->plugin->type_out) && + (it->id == _it->id)) + return items; + } + } + evry_item_ref(it); items = eina_list_append(items, it); EVRY_PLUGIN_ITEM_APPEND(p, it); @@ -256,10 +259,10 @@ _fetch(Evry_Plugin *plugin, const char *input) } static int -_action(Evry_Plugin *plugin, const Evry_Item *it) +_action(Evry_Plugin *plugin, const Evry_Item *act, const Evry_Item *subj) { - if (it->plugin && it->plugin->action) - return it->plugin->action(it->plugin, it); + if (act->plugin && act->plugin->action) + return act->plugin->action(act->plugin, act, subj); return 0; } diff --git a/src/modules/everything/evry_plug_view_thumb.c b/src/modules/everything/evry_plug_view_thumb.c index ac779a744..f819612fb 100644 --- a/src/modules/everything/evry_plug_view_thumb.c +++ b/src/modules/everything/evry_plug_view_thumb.c @@ -354,6 +354,9 @@ _e_smart_reconfigure_do(void *data) evas_object_smart_member_add(it->frame, obj); evas_object_clip_set(it->frame, evas_object_clip_get(obj)); + + if (it->item->marked) + edje_object_signal_emit(it->frame, "e,state,marked", "e"); } edje_object_part_text_set(it->frame, "e.text.label", it->item->label); @@ -704,7 +707,8 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll) { prev = sd->cur_item->y / sd->cur_item->h; sd->cur_item->selected = EINA_FALSE; - edje_object_signal_emit(sd->cur_item->frame, "e,state,unselected", "e"); + if (!sd->cur_item->item->marked) + edje_object_signal_emit(sd->cur_item->frame, "e,state,unselected", "e"); } sd->cur_item = NULL; @@ -1119,14 +1123,16 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) Item *it = NULL; const Evry_State *s = v->state; int slide; - + if (!s->plugin) return 0; + char *key = strdup(ev->key); + if (s->plugin->view_mode == VIEW_MODE_NONE) { if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - (!strcmp(ev->key, "2"))) + (!strcmp(key, "2"))) { if (v->mode == VIEW_MODE_LIST) v->mode = VIEW_MODE_DETAIL; @@ -1139,8 +1145,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) goto end; } else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - ((!strcmp(ev->key, "plus")) || - (!strcmp(ev->key, "3")))) + (!strcmp(key, "3"))) { if (v->mode != VIEW_MODE_THUMB) { @@ -1160,16 +1165,9 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) } } - if ((slide = v->tabs->key_down(v->tabs, ev))) - { - /* _view_update(view, -slide); */ - _view_update(view, 0); - return 1; - } - if (((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) || (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) && - (!strcmp(ev->key, "Up"))) + (!strcmp(key, "Up"))) { if (!sd->items) goto end; it = sd->items->data; @@ -1180,7 +1178,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) } else if (((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) || (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) && - (!strcmp(ev->key, "Down"))) + (!strcmp(key, "Down"))) { if (!sd->items) goto end; @@ -1190,6 +1188,61 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) goto end; } + if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + (!strcmp(key, "plus"))) + { + EINA_LIST_FOREACH(sd->items, ll, it) + { + if (!it->item->marked) + { + if (it->frame) + edje_object_signal_emit(it->frame, "e,state,marked", "e"); + evry_item_mark(s, it->item, 1); + } + } + goto end; + } + else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && + (!strcmp(key, "minus"))) + { + EINA_LIST_FOREACH(sd->items, ll, it) + { + if (it->item->marked) + { + if (it->frame) + edje_object_signal_emit(it->frame, "e,state,unmarked", "e"); + evry_item_mark(s, it->item, 0); + } + } + goto end; + } + else if (!strcmp(key, "comma")) + { + if (!sd->cur_item) + goto end; + + if (!sd->cur_item->item->marked) + { + edje_object_signal_emit(sd->cur_item->frame, "e,state,marked", "e"); + evry_item_mark(s, sd->cur_item->item, 1); + } + else + { + edje_object_signal_emit(sd->cur_item->frame, "e,state,unmarked", "e"); + evry_item_mark(s, sd->cur_item->item, 0); + } + + free(key); + key = strdup("Down"); + } + + if ((slide = v->tabs->key_down(v->tabs, ev))) + { + /* _view_update(view, -slide); */ + _view_update(view, 0); + return 1; + } + if (sd->items) l = eina_list_data_find_list(sd->items, sd->cur_item); if (!l) @@ -1197,7 +1250,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) if (v->mode == VIEW_MODE_THUMB && !evry_conf->cycle_mode) { - if (!strcmp(ev->key, "Right")) + if (!strcmp(key, "Right")) { if (l && l->next) it = l->next->data; @@ -1209,9 +1262,9 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) } goto end; } - else if (!strcmp(ev->key, "Left")) + else if (!strcmp(key, "Left")) { - if (!sd->items) return 1; + /* if (!sd->items) goto end; */ if (l && l->prev) it = l->prev->data; @@ -1224,9 +1277,9 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) goto end; } } - if (!strcmp(ev->key, "Down")) + if (!strcmp(key, "Down")) { - if (!sd->items) return 1; + /* if (!sd->items) goto end; */ if (!evry_conf->cycle_mode) { @@ -1248,9 +1301,9 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) } goto end; } - else if (!strcmp(ev->key, "Up")) + else if (!strcmp(key, "Up")) { - if (!sd->items) return 1; + /* if (!sd->items) goto end; */ if (!evry_conf->cycle_mode) { @@ -1274,18 +1327,20 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) } goto end; } - else if (!strcmp(ev->key, "Return")) + else if (!strcmp(key, "Return")) { - if (!v->mode) + if (v->mode == VIEW_MODE_THUMB) { if (evry_browse_item(NULL)) goto end; } } + free(key); return 0; end: + free(key); return 1; }