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