Use Ctrl+Left/Right to switch playlist items. Closes #63

This commit is contained in:
Rafał Dzięgiel
2021-04-22 14:32:02 +02:00
parent 084f78a851
commit edfa85b5cc
2 changed files with 28 additions and 6 deletions

View File

@@ -46,13 +46,12 @@ class ClapperPlaylistWidget extends Gtk.ListBox
nextTrack()
{
const nextRow = this.get_row_at_index(this.activeRowId + 1);
if(!nextRow)
return false;
return this._switchTrack(false);
}
nextRow.activate();
return true;
prevTrack()
{
return this._switchTrack(true);
}
getActiveRow()
@@ -83,6 +82,21 @@ class ClapperPlaylistWidget extends Gtk.ListBox
button.icon_name = 'list-remove-symbolic';
}
_switchTrack(isPrevious)
{
const rowId = (isPrevious)
? this.activeRowId - 1
: this.activeRowId + 1;
const row = this.get_row_at_index(rowId);
if(!row)
return false;
row.activate();
return true;
}
_onRowActivated(listBox, row)
{
const { player } = this.get_ancestor(Gtk.Grid);