diff --git a/data/org.gnome.Shell.Extensions.GSConnect.gschema.xml b/data/org.gnome.Shell.Extensions.GSConnect.gschema.xml index 05c8126ba..ffdb925f1 100644 --- a/data/org.gnome.Shell.Extensions.GSConnect.gschema.xml +++ b/data/org.gnome.Shell.Extensions.GSConnect.gschema.xml @@ -192,6 +192,8 @@ SPDX-License-Identifier: GPL-2.0-or-later true + + true + - diff --git a/data/ui/preferences-device-panel.ui b/data/ui/preferences-device-panel.ui index 8007a4bce..4bdabff5b 100644 --- a/data/ui/preferences-device-panel.ui +++ b/data/ui/preferences-device-panel.ui @@ -1572,6 +1572,7 @@ SPDX-License-Identifier: GPL-2.0-or-later True False 0 + 32 True @@ -1764,12 +1765,107 @@ SPDX-License-Identifier: GPL-2.0-or-later + + False + True + 4 + + + + + True + False + start + 12 + After Calls + + + + False True 5 + + + True + False + 0 + + + True + False + True + none + + + + + True + True + 56 + False + + + True + False + 12 + 12 + 12 + + + True + False + start + center + True + True + Resume Paused Media + + + + + + + 0 + 0 + + + + + True + True + center + settings.after-unpause + + + + + + + 1 + 0 + + + + + + + + + + + + + + + False + True + 7 + + diff --git a/src/preferences/device.js b/src/preferences/device.js index 002eb5833..cb6bca09e 100644 --- a/src/preferences/device.js +++ b/src/preferences/device.js @@ -286,6 +286,7 @@ var Panel = GObject.registerClass({ // Telephony 'telephony', 'telephony-page', 'ringing-list', 'ringing-volume', 'talking-list', 'talking-volume', + 'after-list', // Shortcuts 'shortcuts-page', @@ -484,6 +485,7 @@ var Panel = GObject.registerClass({ this.actions.add_action(settings.create_action('talking-volume')); this.actions.add_action(settings.create_action('talking-pause')); this.actions.add_action(settings.create_action('talking-microphone')); + this.actions.add_action(settings.create_action('after-unpause')); // Pair Actions const encryption_info = new Gio.SimpleAction({name: 'encryption-info'}); @@ -903,8 +905,12 @@ var Panel = GObject.registerClass({ this.ringing_list.next = this.talking_list; this.talking_list.prev = this.ringing_list; + this.talking_list.next = this.after_list; + this.after_list.prev = this.talking_list; + this.ringing_list.set_header_func(rowSeparators); this.talking_list.set_header_func(rowSeparators); + this.after_list.set_header_func(rowSeparators); } /** diff --git a/src/service/components/mpris.js b/src/service/components/mpris.js index 52f35d7f6..a764d56f9 100644 --- a/src/service/components/mpris.js +++ b/src/service/components/mpris.js @@ -996,6 +996,7 @@ var Manager = GObject.registerClass({ if (player.PlaybackStatus === 'Playing' && player.CanPause) { player.Pause(); this._paused.set(name, player); + debug(`Paused ${name}`); } } } @@ -1004,14 +1005,22 @@ var Manager = GObject.registerClass({ * A convenience function for restarting all players paused with pauseAll(). */ unpauseAll() { - for (const player of this._paused.values()) { - if (player.PlaybackStatus === 'Paused' && player.CanPlay) + for (const [name, player] of this._paused) { + if (player.PlaybackStatus === 'Paused' && player.CanPlay) { player.Play(); + debug(`Unpaused ${name}`); + } else { + debug(`Cannot unpause ${name}, skipping`); + } } this._paused.clear(); } + clearPaused() { + this._paused.clear(); + } + destroy() { if (this._cancellable.is_cancelled()) return; diff --git a/src/service/plugins/telephony.js b/src/service/plugins/telephony.js index 9fe683af1..c2433094f 100644 --- a/src/service/plugins/telephony.js +++ b/src/service/plugins/telephony.js @@ -96,16 +96,32 @@ var Plugin = GObject.registerClass({ } /** - * Restore volume, microphone and media player state (if changed), making - * sure to unpause before raising volume. + * Restore volume and microphone, plus media player state + * (if we changed it and restore is enabled). + * + * If we're going to auto-unpause, make sure to do that first + * before raising volume. + * Otherwise, still raise the volume (so the user can unpause). * * TODO: there's a possibility we might revert a media/mixer state set for * another device. */ _restoreMediaState() { // Media Playback - if (this._mpris) - this._mpris.unpauseAll(); + if (this._mpris) { + if (this.settings.get_boolean('after-unpause')) { + this._mpris.unpauseAll(); + } else { + /* Even if unpause is disabled, we still need to clear + * the list of which players we're holding paused + * + * TODO: This potentially worsens the multi-device + * problem, since we may be erasing the player + * list when another device still needs it. + */ + this._mpris.clearPaused(); + } + } // Mixer Volume if (this._mixer)