From 7a66da1fedf0648208ae5525fd66f2a49b0c379b Mon Sep 17 00:00:00 2001
From: Rafostar <40623528+Rafostar@users.noreply.github.com>
Date: Thu, 3 Dec 2020 11:04:37 +0100
Subject: [PATCH] Add option to close player after playback
---
clapper_src/player.js | 5 +++--
clapper_src/prefs.js | 1 +
clapper_src/widget.js | 1 -
data/com.github.rafostar.Clapper.gschema.xml | 4 ++++
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/clapper_src/player.js b/clapper_src/player.js
index 4d0ce5b0..8cbf1581 100644
--- a/clapper_src/player.js
+++ b/clapper_src/player.js
@@ -345,12 +345,13 @@ class ClapperPlayer extends PlayerBase
_onStreamEnded(player)
{
+ debug('stream ended');
this._trackId++;
if(this._trackId < this._playlist.length)
this.set_media(this._playlist[this._trackId]);
- else
- this.stop();
+ else if(settings.get_boolean('close-auto'))
+ this._onCloseRequest(this.widget.get_root());
}
_onUriLoaded(player, uri)
diff --git a/clapper_src/prefs.js b/clapper_src/prefs.js
index 53545d2d..ea68ae71 100644
--- a/clapper_src/prefs.js
+++ b/clapper_src/prefs.js
@@ -13,6 +13,7 @@ class ClapperGeneralPage extends PrefsBase.Grid
this.addTitle('Startup');
this.addCheckButton('Auto enter fullscreen', 'fullscreen-auto');
+ this.addCheckButton('Close after playback', 'close-auto');
this.addTitle('Volume');
let comboBox = this.addComboBoxText('Initial value', [
diff --git a/clapper_src/widget.js b/clapper_src/widget.js
index 87ac218e..5faf942b 100644
--- a/clapper_src/widget.js
+++ b/clapper_src/widget.js
@@ -405,7 +405,6 @@ var Widget = GObject.registerClass({
player.disconnect(this.mediaInfoSignal);
this.mediaInfoSignal = null;
}
- this.controls.togglePlayButton.setPrimaryIcon();
break;
case GstPlayer.PlayerState.PAUSED:
debug('player state changed to: PAUSED');
diff --git a/data/com.github.rafostar.Clapper.gschema.xml b/data/com.github.rafostar.Clapper.gschema.xml
index 52ef1eaa..b4df13b3 100644
--- a/data/com.github.rafostar.Clapper.gschema.xml
+++ b/data/com.github.rafostar.Clapper.gschema.xml
@@ -6,6 +6,10 @@
false
Automatically enter fullscreen when first file is loaded
+
+ false
+ Automatically close the app after playback finishes
+
"restore"
Mode used for startup volume value