mirror of
https://github.com/zoriya/ags.git
synced 2026-06-08 12:33:23 +00:00
linting fixes and overlay
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ags",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ags",
|
||||
"version": "0.1.0",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL",
|
||||
"dependencies": {
|
||||
"@girs/gvc-1.0": "^1.0.0-3.1.0",
|
||||
|
||||
+7
-6
@@ -25,19 +25,20 @@ export default class AgsBox extends Gtk.Box {
|
||||
get children() { return this.get_children(); }
|
||||
set children(children: Gtk.Widget[] | null) {
|
||||
const newChildren = children || [];
|
||||
|
||||
|
||||
this.get_children()
|
||||
.filter((ch) => !newChildren?.includes(ch))
|
||||
.forEach((ch) => ch.destroy());
|
||||
.filter(ch => !newChildren?.includes(ch))
|
||||
.forEach(ch => ch.destroy());
|
||||
|
||||
// remove any children that weren't destroyed so
|
||||
// we can re-add everything in the correct new order
|
||||
this.get_children()
|
||||
.forEach(ch => this.remove(ch));
|
||||
|
||||
if (!children) return;
|
||||
|
||||
children.forEach((w) => w && this.add(w));
|
||||
if (!children)
|
||||
return;
|
||||
|
||||
children.forEach(w => w && this.add(w));
|
||||
this.show_all();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,9 @@ export default class AgsButton extends Gtk.Button {
|
||||
get child() { return this.get_child(); }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
|
||||
if (widget === child) return;
|
||||
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
@@ -29,7 +29,7 @@ export default class AgsCenterBox extends AgsBox {
|
||||
set children(children: Gtk.Widget[] | null) {
|
||||
const newChildren = children || [];
|
||||
|
||||
newChildren.filter((ch) => !newChildren?.includes(ch))
|
||||
newChildren.filter(ch => !newChildren?.includes(ch))
|
||||
.forEach(ch => ch.destroy());
|
||||
|
||||
if (!children)
|
||||
|
||||
@@ -95,8 +95,9 @@ export default class AgsEventBox extends Gtk.EventBox {
|
||||
get child() { return this.get_child(); }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
if (widget === child) return;
|
||||
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
|
||||
+3
-2
@@ -80,8 +80,9 @@ export class AgsMenuItem extends Gtk.MenuItem {
|
||||
get child() { return this.get_child(); }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
if (widget === child) return;
|
||||
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
|
||||
@@ -38,8 +38,9 @@ export default class AgsOverlay extends Gtk.Overlay {
|
||||
get child() { return this._child; }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
if (widget === child) return;
|
||||
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
@@ -54,12 +55,12 @@ export default class AgsOverlay extends Gtk.Overlay {
|
||||
overlays ||= [];
|
||||
this.get_children().filter(
|
||||
ch => ch !== this._child
|
||||
// && !overlays.includes(ch)
|
||||
)
|
||||
&& !overlays.includes(ch),
|
||||
)
|
||||
.forEach(ch => ch.destroy());
|
||||
|
||||
// this.get_children()
|
||||
// .forEach(ch => this.remove_overlay(ch));
|
||||
this.get_children()
|
||||
.forEach(ch => this.remove_overlay(ch));
|
||||
|
||||
this._overlays = [];
|
||||
overlays.forEach(ch => this.add_overlay(ch));
|
||||
@@ -71,7 +72,6 @@ export default class AgsOverlay extends Gtk.Overlay {
|
||||
}
|
||||
|
||||
remove_overlay(widget: Gtk.Widget): void {
|
||||
//why is ts complaining remove_overlay doesn't exist?
|
||||
//super.remove_overlay(widget);
|
||||
super.remove(widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,9 @@ export default class AgsRevealer extends Gtk.Revealer {
|
||||
get child() { return this.get_child(); }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
if (widget === child) return;
|
||||
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
|
||||
@@ -34,8 +34,9 @@ export default class AgsScrollable extends Gtk.ScrolledWindow {
|
||||
get child() { return this.get_child(); }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
if (widget === child) return;
|
||||
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
|
||||
@@ -44,15 +44,15 @@ export default class AgsStack extends Gtk.Stack {
|
||||
set items(items: [string, Gtk.Widget][]) {
|
||||
this._items
|
||||
.filter(([name]) => !items.find(([n]) => n === name))
|
||||
.forEach(([_, ch]) => ch.destroy());
|
||||
|
||||
.forEach(([, ch]) => ch.destroy());
|
||||
|
||||
// remove any children that weren't destroyed so
|
||||
// we can re-add everything without trying to add
|
||||
// items multiple times
|
||||
this._items
|
||||
.filter(([_, ch]) => this.get_children().includes(ch))
|
||||
.forEach(([_, ch]) => this.remove(ch));
|
||||
|
||||
.filter(([, ch]) => this.get_children().includes(ch))
|
||||
.forEach(([, ch]) => this.remove(ch));
|
||||
|
||||
this._items = [];
|
||||
items.forEach(([name, widget]) => {
|
||||
widget && this.add_named(widget, name);
|
||||
|
||||
@@ -174,7 +174,8 @@ export default class AgsWindow extends Gtk.Window {
|
||||
get child() { return this.get_child(); }
|
||||
set child(child: Gtk.Widget) {
|
||||
const widget = this.get_child();
|
||||
if (widget === child) return;
|
||||
if (widget === child)
|
||||
return;
|
||||
|
||||
if (widget)
|
||||
widget.destroy();
|
||||
|
||||
Reference in New Issue
Block a user