mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
Use Ctrl+Left/Right to switch playlist items. Closes #63
This commit is contained in:
@@ -14,5 +14,13 @@ var actions = {
|
|||||||
},
|
},
|
||||||
about: {
|
about: {
|
||||||
run: (window) => new Dialogs.AboutDialog(window),
|
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()
|
nextTrack()
|
||||||
{
|
{
|
||||||
const nextRow = this.get_row_at_index(this.activeRowId + 1);
|
return this._switchTrack(false);
|
||||||
if(!nextRow)
|
}
|
||||||
return false;
|
|
||||||
|
|
||||||
nextRow.activate();
|
prevTrack()
|
||||||
|
{
|
||||||
return true;
|
return this._switchTrack(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveRow()
|
getActiveRow()
|
||||||
@@ -83,6 +82,21 @@ class ClapperPlaylistWidget extends Gtk.ListBox
|
|||||||
button.icon_name = 'list-remove-symbolic';
|
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)
|
_onRowActivated(listBox, row)
|
||||||
{
|
{
|
||||||
const { player } = this.get_ancestor(Gtk.Grid);
|
const { player } = this.get_ancestor(Gtk.Grid);
|
||||||
|
Reference in New Issue
Block a user