Set popover parent only once and unset on app close

This commit is contained in:
Rafostar
2020-11-10 18:11:59 +01:00
parent 0c307bc606
commit f644710762
3 changed files with 17 additions and 2 deletions

View File

@@ -157,6 +157,7 @@ class ClapperPopoverButton extends IconButton
this.popover.add_css_class('osd'); this.popover.add_css_class('osd');
this.popover.connect('closed', this._onClosed.bind(this)); this.popover.connect('closed', this._onClosed.bind(this));
this.popover.set_parent(this);
} }
setFullscreenMode(isFullscreen) setFullscreenMode(isFullscreen)
@@ -181,7 +182,6 @@ class ClapperPopoverButton extends IconButton
super.vfunc_clicked(); super.vfunc_clicked();
this.set_state_flags(Gtk.StateFlags.CHECKED, false); this.set_state_flags(Gtk.StateFlags.CHECKED, false);
this.popover.set_parent(this);
this.popover.popup(); this.popover.popup();
} }
@@ -190,7 +190,11 @@ class ClapperPopoverButton extends IconButton
let { player } = this.get_ancestor(Gtk.Grid); let { player } = this.get_ancestor(Gtk.Grid);
player.widget.grab_focus(); player.widget.grab_focus();
this.popover.unparent();
this.unset_state_flags(Gtk.StateFlags.CHECKED); this.unset_state_flags(Gtk.StateFlags.CHECKED);
} }
_onCloseRequest()
{
this.popover.unparent();
}
}); });

View File

@@ -467,4 +467,14 @@ class ClapperControls extends Gtk.Box
break; break;
} }
} }
_onCloseRequest()
{
for(let button of this.buttonsArr) {
if(!button._onCloseRequest)
continue;
button._onCloseRequest();
}
}
}); });

View File

@@ -618,6 +618,7 @@ class ClapperPlayer extends PlayerBase
clapperWidget._saveWindowSize(size); clapperWidget._saveWindowSize(size);
} }
} }
clapperWidget.controls._onCloseRequest();
if(this.state === GstPlayer.PlayerState.STOPPED) if(this.state === GstPlayer.PlayerState.STOPPED)
return window.run_dispose(); return window.run_dispose();