mirror of
https://github.com/Rafostar/clapper.git
synced 2025-09-01 08:51:59 +02:00
Major code cleanup
This commit is contained in:
@@ -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));
|
||||
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user