Delete key now removes selected song(s) from current playlist
This commit is contained in:
parent
9fe9938e35
commit
efe94dbb49
27
empc.c
27
empc.c
|
@ -230,6 +230,33 @@ queue_list_key_down(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *ob
|
|||
so = elm_object_item_data_get(it);
|
||||
empd_empc_play_id_call(empd_proxy, so->songid);
|
||||
}
|
||||
else if (!strcmp(ev->keyname, "Delete"))
|
||||
{
|
||||
const Eina_List *l, *ll;
|
||||
int start = -1, num;
|
||||
|
||||
l = elm_genlist_selected_items_get(obj);
|
||||
if (!l) return;
|
||||
EINA_LIST_FOREACH(l, ll, it)
|
||||
{
|
||||
/* check for contiguous selection */
|
||||
so = elm_object_item_data_get(it);
|
||||
if (start == -1)
|
||||
start = so->song_pos, num = 1;
|
||||
/* fragmentation detected */
|
||||
if ((elm_genlist_item_next_get(it) != eina_list_data_get(ll->next)) &&
|
||||
(elm_genlist_item_prev_get(it) != eina_list_data_get(ll->next))) //selections can go both ways
|
||||
{
|
||||
if (so->song_pos < start) //backwards selection
|
||||
start = so->song_pos;
|
||||
//fprintf(stderr, "DEL %d:%d\n", start, num);
|
||||
empd_empc_delete_list_range_call(empd_proxy, start, num);
|
||||
start = -1, num = 0;
|
||||
}
|
||||
else
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
|
|
Loading…
Reference in New Issue