Major code cleanup

This commit is contained in:
Rafostar
2020-10-20 22:30:15 +02:00
parent 4dea498f37
commit 0291377389
10 changed files with 737 additions and 739 deletions

View File

@@ -1,49 +1,18 @@
const { Gdk, GObject, Gtk } = imports.gi;
var Window = GObject.registerClass({
Signals: {
'fullscreen-changed': {
param_types: [GObject.TYPE_BOOLEAN]
},
}
}, class ClapperWindow extends Gtk.ApplicationWindow
var Window = GObject.registerClass(
class ClapperWindow extends Gtk.ApplicationWindow
{
_init(application, title)
{
super._init({
application: application,
title: title || 'Clapper',
resizable: true,
destroy_with_parent: true,
title: title,
});
this.isFullscreen = false;
this.mapSignal = this.connect('map', this._onMap.bind(this));
}
toggleFullscreen()
updateTitlebar(mediaInfo)
{
let un = (this.isFullscreen) ? 'un' : '';
this[`${un}fullscreen`]();
}
_onStateNotify(toplevel)
{
let isFullscreen = Boolean(
toplevel.state & Gdk.ToplevelState.FULLSCREEN
);
if(this.isFullscreen === isFullscreen)
return;
this.isFullscreen = isFullscreen;
this.emit('fullscreen-changed', this.isFullscreen);
}
_onMap()
{
this.disconnect(this.mapSignal);
let surface = this.get_surface();
surface.connect('notify::state', this._onStateNotify.bind(this));
}
});