- disabled 'file delete' action for now. make it safer

- sort actions matching subtype before type, i.e. mpris action before file actions


SVN revision: 48444
This commit is contained in:
Hannes Janetzek 2010-04-29 23:11:53 +00:00
parent 21713329da
commit 703f9550b4
3 changed files with 49 additions and 34 deletions

View File

@ -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,

View File

@ -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

View File

@ -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);