Remove GTK3 "widget.show()" leftovers

This commit is contained in:
Rafostar
2020-10-16 10:59:00 +02:00
parent 12c1251c9b
commit d0eb28b207
2 changed files with 11 additions and 22 deletions

View File

@@ -40,15 +40,19 @@ var Controls = GObject.registerClass({
this.visualizationsButton = this.addPopoverButton( this.visualizationsButton = this.addPopoverButton(
'display-projector-symbolic' 'display-projector-symbolic'
); );
this.visualizationsButton.set_visible(false);
this.videoTracksButton = this.addPopoverButton( this.videoTracksButton = this.addPopoverButton(
'emblem-videos-symbolic' 'emblem-videos-symbolic'
); );
this.videoTracksButton.set_visible(false);
this.audioTracksButton = this.addPopoverButton( this.audioTracksButton = this.addPopoverButton(
'emblem-music-symbolic' 'emblem-music-symbolic'
); );
this.audioTracksButton.set_visible(false);
this.subtitleTracksButton = this.addPopoverButton( this.subtitleTracksButton = this.addPopoverButton(
'media-view-subtitles-symbolic' 'media-view-subtitles-symbolic'
); );
this.subtitleTracksButton.set_visible(false);
this._addVolumeButton(); this._addVolumeButton();
this.unfullscreenButton = this.addButton( this.unfullscreenButton = this.addButton(
'view-restore-symbolic', 'view-restore-symbolic',
@@ -56,8 +60,6 @@ var Controls = GObject.registerClass({
this.unfullscreenButton.set_visible(false); this.unfullscreenButton.set_visible(false);
this.add_css_class('playercontrols'); this.add_css_class('playercontrols');
this.realizeSignal = this.connect('realize', this._onRealize.bind(this));
this.destroySignal = this.connect('destroy', this._onDestroy.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%'; let text = (i) ? `${i}00%` : '0%';
this.volumeScale.add_mark(i, Gtk.PositionType.LEFT, text); 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); this.volumeButton.popoverBox.append(this.volumeScale);
} }
@@ -316,21 +323,6 @@ var Controls = GObject.registerClass({
this.emit('position-seeking-changed', this.isPositionSeeking); 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) _onScroll(controller, dx, dy)
{ {
let isVertical = Math.abs(dy) >= Math.abs(dx); let isVertical = Math.abs(dy) >= Math.abs(dx);

View File

@@ -81,9 +81,6 @@ class ClapperInterface extends Gtk.Grid
this.overlay.set_child(this._player.widget); this.overlay.set_child(this._player.widget);
this.overlay.add_overlay(this.revealerTop); this.overlay.add_overlay(this.revealerTop);
this.overlay.add_overlay(this.revealerBottom); this.overlay.add_overlay(this.revealerBottom);
this.overlay.show();
this._player.widget.show();
} }
addHeaderBar(headerBar, defaultTitle) addHeaderBar(headerBar, defaultTitle)
@@ -210,7 +207,7 @@ class ClapperInterface extends Gtk.Grid
if(!parsedInfo[`${type}Tracks`].length) { if(!parsedInfo[`${type}Tracks`].length) {
if(this.controls[`${type}TracksButton`].visible) { if(this.controls[`${type}TracksButton`].visible) {
debug(`hiding popover button without contents: ${type}`); debug(`hiding popover button without contents: ${type}`);
this.controls[`${type}TracksButton`].hide(); this.controls[`${type}TracksButton`].set_visible(false);
} }
continue; continue;
} }
@@ -221,7 +218,7 @@ class ClapperInterface extends Gtk.Grid
); );
if(!this.controls[`${type}TracksButton`].visible) { if(!this.controls[`${type}TracksButton`].visible) {
debug(`showing popover button with contents: ${type}`); debug(`showing popover button with contents: ${type}`);
this.controls[`${type}TracksButton`].show(); this.controls[`${type}TracksButton`].set_visible(true);
} }
} }