From c3d60a600e6585f733b7c7a6dc643182822bf25e Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 3 Dec 2020 11:20:42 +0100 Subject: [PATCH] Wait for stop after playback instead of forcing it --- clapper_src/player.js | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/clapper_src/player.js b/clapper_src/player.js index 8cbf1581..db7a53e7 100644 --- a/clapper_src/player.js +++ b/clapper_src/player.js @@ -315,6 +315,22 @@ class ClapperPlayer extends PlayerBase debug('cleared update time interval'); } + _performCloseCleanup(window) + { + window.disconnect(this.closeRequestSignal); + this.closeRequestSignal = null; + + let clapperWidget = this.widget.get_ancestor(Gtk.Grid); + if(!clapperWidget.fullscreenMode) { + let size = window.get_size(); + if(size[0] > 0 && size[1] > 0) + clapperWidget._saveWindowSize(size); + } + settings.set_double('volume-last', this.volume); + + clapperWidget.controls._onCloseRequest(); + } + _onStateChanged(player, state) { this.state = state; @@ -350,8 +366,11 @@ class ClapperPlayer extends PlayerBase if(this._trackId < this._playlist.length) this.set_media(this._playlist[this._trackId]); - else if(settings.get_boolean('close-auto')) - this._onCloseRequest(this.widget.get_root()); + else if(settings.get_boolean('close-auto')) { + /* Stop will be automatically called soon afterwards */ + this._performCloseCleanup(this.widget.get_root()); + this.quitOnStop = true; + } } _onUriLoaded(player, uri) @@ -622,18 +641,7 @@ class ClapperPlayer extends PlayerBase _onCloseRequest(window) { - window.disconnect(this.closeRequestSignal); - this.closeRequestSignal = null; - - let clapperWidget = this.widget.get_ancestor(Gtk.Grid); - if(!clapperWidget.fullscreenMode) { - let size = window.get_size(); - if(size[0] > 0 && size[1] > 0) - clapperWidget._saveWindowSize(size); - } - settings.set_double('volume-last', this.volume); - - clapperWidget.controls._onCloseRequest(); + this._performCloseCleanup(window); if(this.state === GstPlayer.PlayerState.STOPPED) return window.run_dispose();