Do not show tracks revealer when there are no tracks

This commit is contained in:
Rafostar
2020-12-03 11:59:59 +01:00
parent c3d60a600e
commit 150fdb7cbb
2 changed files with 6 additions and 0 deletions

View File

@@ -76,6 +76,7 @@ class ClapperControls extends Gtk.Box
this.revealTracksRevealer = new Revealers.ButtonsRevealer('SLIDE_LEFT'); this.revealTracksRevealer = new Revealers.ButtonsRevealer('SLIDE_LEFT');
this.revealTracksRevealer.append(revealTracksButton); this.revealTracksRevealer.append(revealTracksButton);
this.revealTracksRevealer.set_visible(false);
this.append(this.revealTracksRevealer); this.append(this.revealTracksRevealer);
tracksRevealer.set_reveal_child(true); tracksRevealer.set_reveal_child(true);

View File

@@ -274,6 +274,8 @@ var Widget = GObject.registerClass({
}); });
} }
let anyButtonShown = false;
for(let type of ['video', 'audio', 'subtitle']) { for(let type of ['video', 'audio', 'subtitle']) {
let currStream = player[`get_current_${type}_track`](); let currStream = player[`get_current_${type}_track`]();
let activeId = (currStream) ? currStream.get_index() : -1; let activeId = (currStream) ? currStream.get_index() : -1;
@@ -299,8 +301,11 @@ var Widget = GObject.registerClass({
); );
debug(`showing popover button with contents: ${type}`); debug(`showing popover button with contents: ${type}`);
this.controls[`${type}TracksButton`].set_visible(true); this.controls[`${type}TracksButton`].set_visible(true);
anyButtonShown = true;
} }
this.controls.revealTracksRevealer.set_visible(anyButtonShown);
this.mediaInfoSignal = null; this.mediaInfoSignal = null;
} }