Compare commits
No commits in common. "a6543a796d5e3036783214858fd52d11ac18646a" and "a53d24861f79e925a1ed22350860e1f19cba4340" have entirely different histories.
a6543a796d
...
a53d24861f
29
nncmpp.c
29
nncmpp.c
@ -2002,7 +2002,6 @@ g_normal_defaults[] =
|
|||||||
// Not sure how to set these up, they're pretty arbitrary so far
|
// Not sure how to set these up, they're pretty arbitrary so far
|
||||||
{ "Enter", ACTION_CHOOSE },
|
{ "Enter", ACTION_CHOOSE },
|
||||||
{ "Delete", ACTION_DELETE },
|
{ "Delete", ACTION_DELETE },
|
||||||
{ "d", ACTION_DELETE },
|
|
||||||
{ "Backspace", ACTION_UP },
|
{ "Backspace", ACTION_UP },
|
||||||
{ "v", ACTION_MULTISELECT },
|
{ "v", ACTION_MULTISELECT },
|
||||||
{ "/", ACTION_MPD_SEARCH },
|
{ "/", ACTION_MPD_SEARCH },
|
||||||
@ -2220,7 +2219,6 @@ static bool
|
|||||||
current_tab_on_action (enum action action)
|
current_tab_on_action (enum action action)
|
||||||
{
|
{
|
||||||
struct tab *self = g.active_tab;
|
struct tab *self = g.active_tab;
|
||||||
struct tab_range range = tab_selection_range (self);
|
|
||||||
compact_map_t map = item_list_get (&g.playlist, self->item_selected);
|
compact_map_t map = item_list_get (&g.playlist, self->item_selected);
|
||||||
|
|
||||||
const char *id;
|
const char *id;
|
||||||
@ -2229,31 +2227,10 @@ current_tab_on_action (enum action action)
|
|||||||
|
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
// TODO: make this block more than just multiselect-tolerant
|
|
||||||
case ACTION_MOVE_UP: return current_tab_move_song (id, -1);
|
case ACTION_MOVE_UP: return current_tab_move_song (id, -1);
|
||||||
case ACTION_MOVE_DOWN: return current_tab_move_song (id, 1);
|
case ACTION_MOVE_DOWN: return current_tab_move_song (id, 1);
|
||||||
|
case ACTION_CHOOSE: return MPD_SIMPLE ("playid", id);
|
||||||
case ACTION_CHOOSE:
|
case ACTION_DELETE: return MPD_SIMPLE ("deleteid", id);
|
||||||
return MPD_SIMPLE ("playid", id);
|
|
||||||
|
|
||||||
case ACTION_DELETE:
|
|
||||||
{
|
|
||||||
struct mpd_client *c = &g.client;
|
|
||||||
if (range.from < 0 || c->state != MPD_CONNECTED)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
mpd_client_list_begin (c);
|
|
||||||
for (int i = range.from; i <= range.upto; i++)
|
|
||||||
{
|
|
||||||
if ((map = item_list_get (&g.playlist, i))
|
|
||||||
&& (id = compact_map_find (map, "id")))
|
|
||||||
mpd_client_send_command (c, "deleteid", id, NULL);
|
|
||||||
}
|
|
||||||
mpd_client_list_end (c);
|
|
||||||
mpd_client_add_task (c, mpd_on_simple_response, NULL);
|
|
||||||
mpd_client_idle (c, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2272,7 +2249,7 @@ current_tab_init (void)
|
|||||||
{
|
{
|
||||||
struct tab *super = &g_current_tab;
|
struct tab *super = &g_current_tab;
|
||||||
tab_init (super, "Current");
|
tab_init (super, "Current");
|
||||||
super->can_multiselect = true;
|
// TODO: implement multiselect, set can_multiselect to true
|
||||||
super->on_action = current_tab_on_action;
|
super->on_action = current_tab_on_action;
|
||||||
super->on_item_draw = current_tab_on_item_draw;
|
super->on_item_draw = current_tab_on_item_draw;
|
||||||
return super;
|
return super;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user