From 150fdb7cbbbf18278a3fda7b7f022f3c2d8c232f Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 3 Dec 2020 11:59:59 +0100 Subject: [PATCH] Do not show tracks revealer when there are no tracks --- clapper_src/controls.js | 1 + clapper_src/widget.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/clapper_src/controls.js b/clapper_src/controls.js index 70ef3f76..94fadbd5 100644 --- a/clapper_src/controls.js +++ b/clapper_src/controls.js @@ -76,6 +76,7 @@ class ClapperControls extends Gtk.Box this.revealTracksRevealer = new Revealers.ButtonsRevealer('SLIDE_LEFT'); this.revealTracksRevealer.append(revealTracksButton); + this.revealTracksRevealer.set_visible(false); this.append(this.revealTracksRevealer); tracksRevealer.set_reveal_child(true); diff --git a/clapper_src/widget.js b/clapper_src/widget.js index 5faf942b..500f9c7b 100644 --- a/clapper_src/widget.js +++ b/clapper_src/widget.js @@ -274,6 +274,8 @@ var Widget = GObject.registerClass({ }); } + let anyButtonShown = false; + for(let type of ['video', 'audio', 'subtitle']) { let currStream = player[`get_current_${type}_track`](); let activeId = (currStream) ? currStream.get_index() : -1; @@ -299,8 +301,11 @@ var Widget = GObject.registerClass({ ); debug(`showing popover button with contents: ${type}`); this.controls[`${type}TracksButton`].set_visible(true); + + anyButtonShown = true; } + this.controls.revealTracksRevealer.set_visible(anyButtonShown); this.mediaInfoSignal = null; }