mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 15:22:11 +02:00
Use Ctrl+Left/Right to switch playlist items. Closes #63
This commit is contained in:
@@ -14,5 +14,13 @@ var actions = {
|
||||
},
|
||||
about: {
|
||||
run: (window) => new Dialogs.AboutDialog(window),
|
||||
},
|
||||
next_track: {
|
||||
run: (window) => window.child.player.playlistWidget.nextTrack(),
|
||||
accels: ['<Ctrl>Right'],
|
||||
},
|
||||
prev_track: {
|
||||
run: (window) => window.child.player.playlistWidget.prevTrack(),
|
||||
accels: ['<Ctrl>Left'],
|
||||
}
|
||||
};
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user