52 lines
1.4 KiB
JavaScript
52 lines
1.4 KiB
JavaScript
var _a;
|
|
import GObject from 'gi://GObject';
|
|
import Gtk from 'gi://Gtk?version=4.0';
|
|
import { Realm } from './model/Realm.js';
|
|
export class RealmRow extends Gtk.Widget {
|
|
constructor() {
|
|
super(...arguments);
|
|
this._notifyId = 0;
|
|
}
|
|
get realm() {
|
|
if (this._realm === undefined) {
|
|
this._realm = null;
|
|
}
|
|
return this._realm;
|
|
}
|
|
set realm(value) {
|
|
if (this.realm === value) {
|
|
return;
|
|
}
|
|
if (this.realm && this._notifyId) {
|
|
this.realm.disconnect(this._notifyId);
|
|
this._notifyId = 0;
|
|
}
|
|
this._realm = value;
|
|
if (this.realm) {
|
|
this._notifyId = this.realm.connect('notify', this.syncRealm.bind(this));
|
|
this.syncRealm();
|
|
}
|
|
this.notify('realm');
|
|
}
|
|
syncRealm() {
|
|
if (this.realm && this.realm.is_running()) {
|
|
this._nameLabel.remove_css_class('dim-label');
|
|
}
|
|
else {
|
|
// @ts-ignore
|
|
this._nameLabel.add_css_class('dim-label');
|
|
}
|
|
}
|
|
}
|
|
_a = RealmRow;
|
|
(() => {
|
|
GObject.registerClass({
|
|
GTypeName: 'RealmRow',
|
|
Template: 'resource:///com/subgraph/citadel/Realms/ui/RealmRow.ui',
|
|
Properties: {
|
|
'realm': GObject.ParamSpec.object('realm', '', '', GObject.ParamFlags.READWRITE, Realm),
|
|
},
|
|
InternalChildren: ['nameLabel'],
|
|
}, _a);
|
|
})();
|