From d0eb28b20739cdf2d077392616ca4bf6fa3dd549 Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Fri, 16 Oct 2020 10:59:00 +0200 Subject: [PATCH] Remove GTK3 "widget.show()" leftovers --- clapper_src/controls.js | 26 +++++++++----------------- clapper_src/interface.js | 7 ++----- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/clapper_src/controls.js b/clapper_src/controls.js index 8b13af9f..0a0bb657 100644 --- a/clapper_src/controls.js +++ b/clapper_src/controls.js @@ -40,15 +40,19 @@ var Controls = GObject.registerClass({ this.visualizationsButton = this.addPopoverButton( 'display-projector-symbolic' ); + this.visualizationsButton.set_visible(false); this.videoTracksButton = this.addPopoverButton( 'emblem-videos-symbolic' ); + this.videoTracksButton.set_visible(false); this.audioTracksButton = this.addPopoverButton( 'emblem-music-symbolic' ); + this.audioTracksButton.set_visible(false); this.subtitleTracksButton = this.addPopoverButton( 'media-view-subtitles-symbolic' ); + this.subtitleTracksButton.set_visible(false); this._addVolumeButton(); this.unfullscreenButton = this.addButton( 'view-restore-symbolic', @@ -56,8 +60,6 @@ var Controls = GObject.registerClass({ this.unfullscreenButton.set_visible(false); this.add_css_class('playercontrols'); - - this.realizeSignal = this.connect('realize', this._onRealize.bind(this)); this.destroySignal = this.connect('destroy', this._onDestroy.bind(this)); } @@ -257,6 +259,11 @@ var Controls = GObject.registerClass({ let text = (i) ? `${i}00%` : '0%'; this.volumeScale.add_mark(i, Gtk.PositionType.LEFT, text); } + + this.audioTracksButton.bind_property('visible', this.volumeButton, 'visible', + GObject.BindingFlags.SYNC_CREATE + ); + this.volumeButton.popoverBox.append(this.volumeScale); } @@ -316,21 +323,6 @@ var Controls = GObject.registerClass({ this.emit('position-seeking-changed', this.isPositionSeeking); } - _onRealize() - { - this.disconnect(this.realizeSignal); - - let hiddenButtons = [ - 'visualizations', - 'videoTracks', - 'audioTracks', - 'subtitleTracks' - ]; - - for(let name of hiddenButtons) - this[`${name}Button`].hide(); - } - _onScroll(controller, dx, dy) { let isVertical = Math.abs(dy) >= Math.abs(dx); diff --git a/clapper_src/interface.js b/clapper_src/interface.js index 1553333f..2d50e4ca 100644 --- a/clapper_src/interface.js +++ b/clapper_src/interface.js @@ -81,9 +81,6 @@ class ClapperInterface extends Gtk.Grid this.overlay.set_child(this._player.widget); this.overlay.add_overlay(this.revealerTop); this.overlay.add_overlay(this.revealerBottom); - - this.overlay.show(); - this._player.widget.show(); } addHeaderBar(headerBar, defaultTitle) @@ -210,7 +207,7 @@ class ClapperInterface extends Gtk.Grid if(!parsedInfo[`${type}Tracks`].length) { if(this.controls[`${type}TracksButton`].visible) { debug(`hiding popover button without contents: ${type}`); - this.controls[`${type}TracksButton`].hide(); + this.controls[`${type}TracksButton`].set_visible(false); } continue; } @@ -221,7 +218,7 @@ class ClapperInterface extends Gtk.Grid ); if(!this.controls[`${type}TracksButton`].visible) { debug(`showing popover button with contents: ${type}`); - this.controls[`${type}TracksButton`].show(); + this.controls[`${type}TracksButton`].set_visible(true); } }