Open new file in the same window. Closes #31

This commit is contained in:
Rafostar
2020-12-24 00:23:49 +01:00
parent f2d8d8ad4f
commit 6afbbc767a
6 changed files with 63 additions and 35 deletions

View File

@@ -9,15 +9,8 @@ let { settings } = Misc;
var AppBase = GObject.registerClass(
class ClapperAppBase extends Gtk.Application
{
_init(opts)
_init()
{
opts = opts || {};
let defaults = {
playlist: [],
};
Object.assign(this, defaults, opts);
super._init({
application_id: Misc.appId,
});
@@ -58,10 +51,7 @@ class ClapperAppBase extends Gtk.Application
{
super.vfunc_activate();
if(!this.doneFirstActivate)
this._onFirstActivate();
this.active_window.present();
this._handleAppStart();
}
run(arr)
@@ -69,6 +59,15 @@ class ClapperAppBase extends Gtk.Application
super.run(arr || []);
}
_handleAppStart()
{
if(this.doneFirstActivate)
return this._onWindowShow(this.active_window);
this._onFirstActivate();
this.active_window.present();
}
_onFirstActivate()
{
let gtkSettings = Gtk.Settings.get_default();
@@ -89,6 +88,9 @@ class ClapperAppBase extends Gtk.Application
_onWindowShow(window)
{
if(!this.windowShowSignal)
return;
window.disconnect(this.windowShowSignal);
this.windowShowSignal = null;
}