diff --git a/src/player.js b/src/player.js index 1dcd05cf..e72ae9e4 100644 --- a/src/player.js +++ b/src/player.js @@ -388,11 +388,24 @@ class ClapperPlayer extends GstClapper.Clapper case 'pause': this[action](); break; + case 'seek': case 'set_playlist': case 'append_playlist': case 'set_subtitles': this[action](value); break; + case 'change_playlist_item': + this.playlistWidget.changeActiveRow(value); + break; + case 'toggle_fullscreen': + case 'volume_up': + case 'volume_down': + case 'next_track': + case 'prev_track': + case 'next_chapter': + case 'prev_chapter': + this.widget.activate_action(`app.${action}`, null); + break; case 'toggle_maximized': action = 'toggle-maximized'; case 'minimize': @@ -400,16 +413,7 @@ class ClapperPlayer extends GstClapper.Clapper this.widget.activate_action(`window.${action}`, null); break; default: - const clapperWidget = this.widget.get_ancestor(Gtk.Grid); - - switch(action) { - case 'toggle_fullscreen': - clapperWidget.toggleFullscreen(); - break; - default: - debug(`unhandled WebSocket action: ${action}`); - break; - } + warn(`unhandled WebSocket action: ${action}`); break; } } diff --git a/src/playlist.js b/src/playlist.js index 7e65d649..eb16684a 100644 --- a/src/playlist.js +++ b/src/playlist.js @@ -91,6 +91,17 @@ class ClapperPlaylistWidget extends Gtk.ListBox button.icon_name = 'list-remove-symbolic'; } + changeActiveRow(rowId) + { + const row = this.get_row_at_index(rowId); + if(!row) + return false; + + row.activate(); + + return true; + } + changeRepeatMode(mode) { const lastMode = Object.keys(RepeatMode).length - 1; @@ -117,18 +128,7 @@ class ClapperPlaylistWidget extends Gtk.ListBox ? this.activeRowId - 1 : this.activeRowId + 1; - return this._changeActiveRow(rowId); - } - - _changeActiveRow(rowId) - { - const row = this.get_row_at_index(rowId); - if(!row) - return false; - - row.activate(); - - return true; + return this.changeActiveRow(rowId); } _onRowActivated(listBox, row) @@ -165,7 +165,7 @@ class ClapperPlaylistWidget extends Gtk.ListBox return true; if(this.repeatMode === RepeatMode.PLAYLIST) - return this._changeActiveRow(0); + return this.changeActiveRow(0); return false; }