diff --git a/clapper_src/controls.js b/clapper_src/controls.js index dec39228..2f8b48e5 100644 --- a/clapper_src/controls.js +++ b/clapper_src/controls.js @@ -7,6 +7,7 @@ const CONTROLS_MARGIN = 4; const CONTROLS_SPACING = 4; let { debug } = Debug; +let { settings } = Misc; var Controls = GObject.registerClass( class ClapperControls extends Gtk.Box @@ -317,9 +318,6 @@ class ClapperControls extends Gtk.Box draw_value: false, vexpand: true, }); - this.volumeScale.connect( - 'value-changed', this._onVolumeScaleValueChanged.bind(this) - ); this.volumeScale.add_css_class('volumescale'); this.volumeAdjustment = this.volumeScale.get_adjustment(); @@ -332,6 +330,9 @@ class ClapperControls extends Gtk.Box this.volumeScale.add_mark(i, Gtk.PositionType.LEFT, text); } + this.volumeScale.connect( + 'value-changed', this._onVolumeScaleValueChanged.bind(this) + ); this.volumeButton.popoverBox.append(this.volumeScale); } @@ -368,6 +369,10 @@ class ClapperControls extends Gtk.Box ); scrollController.connect('scroll', player._onScroll.bind(player)); this.volumeButton.add_controller(scrollController); + + let lastVolume = settings.get_double('volume-last'); + let cubicVolume = Misc.getCubicValue(lastVolume); + this.volumeScale.set_value(cubicVolume); } _onUnfullscreenClicked(button) diff --git a/clapper_src/player.js b/clapper_src/player.js index a58ffcc6..9a6f72b0 100644 --- a/clapper_src/player.js +++ b/clapper_src/player.js @@ -628,10 +628,11 @@ class ClapperPlayer extends PlayerBase let clapperWidget = this.widget.get_ancestor(Gtk.Grid); if(!clapperWidget.fullscreenMode) { let size = window.get_size(); - if(size[0] > 0 && size[1] > 0) { + if(size[0] > 0 && size[1] > 0) clapperWidget._saveWindowSize(size); - } } + settings.set_double('volume-last', this.volume); + clapperWidget.controls._onCloseRequest(); if(this.state === GstPlayer.PlayerState.STOPPED) diff --git a/data/com.github.rafostar.Clapper.gschema.xml b/data/com.github.rafostar.Clapper.gschema.xml index 124748bd..52ef1eaa 100644 --- a/data/com.github.rafostar.Clapper.gschema.xml +++ b/data/com.github.rafostar.Clapper.gschema.xml @@ -12,7 +12,7 @@ 100 - Custom initial volume value after startup + Custom initial volume value in percentage after startup true @@ -74,5 +74,9 @@ '[480, 270]' Stores floating window size to restore on next launch + + 1 + Stores last linear volume value to apply on startup +