diff --git a/src/modules/everything-files/e_mod_main.c b/src/modules/everything-files/e_mod_main.c index e58b8e58a..458cc7ac2 100644 --- a/src/modules/everything-files/e_mod_main.c +++ b/src/modules/everything-files/e_mod_main.c @@ -1063,14 +1063,14 @@ _plugins_init(void) evry_action_register(act, 2); _actions = eina_list_append(_actions, act); - act = EVRY_ACTION_NEW(N_("Delete"), - EVRY_TYPE_FILE, 0, - "list-remove", - _file_trash_action, NULL); - EVRY_ITEM_DATA_INT_SET(act, ACT_DELETE); - evry_action_register(act, 2); - - _actions = eina_list_append(_actions, act); + /* TODO ask if really want to delete !*/ + /* act = EVRY_ACTION_NEW(N_("Delete"), + * EVRY_TYPE_FILE, 0, + * "list-remove", + * _file_trash_action, NULL); + * EVRY_ITEM_DATA_INT_SET(act, ACT_DELETE); + * evry_action_register(act, 2); + * _actions = eina_list_append(_actions, act); */ act = EVRY_ACTION_NEW(N_("Copy To ..."), EVRY_TYPE_FILE, EVRY_TYPE_FILE, diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h index 67b9b6e0b..6423a4d35 100644 --- a/src/modules/everything/Evry.h +++ b/src/modules/everything/Evry.h @@ -81,6 +81,7 @@ typedef unsigned int Evry_Type; #define GET_VIEW(_v, _view) View *_v = (View*) _view #define GET_ACTION(_act, _item) Evry_Action *_act = (Evry_Action *) _item #define GET_PLUGIN(_p, _plugin) Plugin *_p = (Plugin*) _plugin +#define GET_ITEM(_it, _any) Evry_Item *_it = (Evry_Item *) _any #define EVRY_ITEM_DATA_INT_SET(_item, _data) ((Evry_Item *)_item)->data = (void*)(long) _data #define EVRY_ITEM_DATA_INT_GET(_item) (long) ((Evry_Item *)_item)->data diff --git a/src/modules/everything/evry_plug_aggregator.c b/src/modules/everything/evry_plug_aggregator.c index 36d56a427..950ce2b73 100644 --- a/src/modules/everything/evry_plug_aggregator.c +++ b/src/modules/everything/evry_plug_aggregator.c @@ -22,25 +22,32 @@ _cb_sort_recent(const void *data1, const void *data2) const Evry_Item *it1 = data1; const Evry_Item *it2 = data2; + /* sort actions matching the subtype always before those matching type*/ + if ((it1->type == EVRY_TYPE_ACTION) && + (it2->type == EVRY_TYPE_ACTION)) + { + const Evry_Action *act1 = data1; + const Evry_Action *act2 = data2; + + if (act1->it1.item && act2->it1.item) + { + if ((act1->it1.type == act1->it1.item->type) && + (act2->it1.type != act2->it1.item->type)) + return -1; + + if ((act1->it1.type != act1->it1.item->type) && + (act2->it1.type == act2->it1.item->type)) + return 1; + } + } + if (it1->usage && it2->usage) return (it1->usage > it2->usage ? -1 : 1); if (it1->usage && !it2->usage) return -1; if (it2->usage && !it1->usage) return 1; - - /* if (_is_action(it1) || _is_action(it2)) - * { - * if (_is_action(it1) && _is_action(it2)) - * return (it1->priority - it2->priority); - * else if (_is_action(it1)) - * return ((it1->plugin->config->priority + it1->priority) - - * (it2->plugin->config->priority)); - * else - * return ((it1->plugin->config->priority) - - * (it2->plugin->config->priority + it2->priority)); - * } */ - + if (it1->plugin == it2->plugin) return (it1->priority - it2->priority); @@ -55,25 +62,32 @@ _cb_sort(const void *data1, const void *data2) const Evry_Item *it1 = data1; const Evry_Item *it2 = data2; + /* sort actions matching the subtype always before those matching type*/ + if ((it1->type == EVRY_TYPE_ACTION) && + (it2->type == EVRY_TYPE_ACTION)) + { + const Evry_Action *act1 = data1; + const Evry_Action *act2 = data2; + + if (act1->it1.item && act2->it1.item) + { + if ((act1->it1.type == act1->it1.item->type) && + (act2->it1.type != act2->it1.item->type)) + return -1; + + if ((act1->it1.type != act1->it1.item->type) && + (act2->it1.type == act2->it1.item->type)) + return 1; + } + } + if (it1->usage && it2->usage) return (it1->usage > it2->usage ? -1 : 1); if (it1->usage && !it2->usage) return -1; if (it2->usage && !it1->usage) return 1; - - /* if (_is_action(it1) || _is_action(it2)) - * { - * if (_is_action(it1) && _is_action(it2)) - * return (it1->priority - it2->priority); - * else if (_is_action(it1)) - * return ((it1->plugin->config->priority + it1->priority) - * - it2->plugin->config->priority); - * else - * return (it1->plugin->config->priority - - * (it1->plugin->config->priority + it2->priority)); - * } */ - + if ((it1->plugin == it2->plugin) && (it1->priority - it2->priority)) return (it1->priority - it2->priority);