From b446fb943e946160ccfd0860ca5eaae9b0fa172b Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Thu, 10 Sep 2020 21:21:35 +0200 Subject: [PATCH] Hide track selection buttons without contents --- clapper_src/interface.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clapper_src/interface.js b/clapper_src/interface.js index 27bf30b8..e1d75200 100644 --- a/clapper_src/interface.js +++ b/clapper_src/interface.js @@ -185,16 +185,23 @@ class ClapperInterface extends Gtk.Grid for(let type of ['video', 'audio', 'subtitle']) { let currStream = this._player[`get_current_${type}_track`](); let activeId = (currStream) ? currStream.get_index() : -1; + let buttonBox = this.controls[`${type}TracksButton`].get_parent(); if(currStream && type !== 'subtitle') { let caps = currStream.get_caps(); debug(`${type} caps: ${caps.to_string()}`, 'LEVEL_INFO'); } + if(!parsedInfo[`${type}Tracks`].length) { + debug(`hiding popover button without contents: ${type}`); + buttonBox.hide(); + continue; + } this.controls.addRadioButtons( this.controls[`${type}TracksButton`].popoverBox, parsedInfo[`${type}Tracks`], activeId ); + buttonBox.show(); } }