diff options
author | kotontrion <[email protected]> | 2024-12-20 09:49:58 +0100 |
---|---|---|
committer | kotontrion <[email protected]> | 2024-12-20 09:49:58 +0100 |
commit | fcef5cea5ca84fa06a74e69de34e84b4d0842fcc (patch) | |
tree | 798de065ecce20a6f5892bc729ef73455abe209c /lang/gjs/src/gtk3/astalify.ts | |
parent | 5ed7a1416c2532188a7e01fead3842602fdb670f (diff) | |
parent | d7d11b341db85ce9768fa06b6f225d713621ec56 (diff) |
Merge branch 'main' into feat/wayland-glib
Diffstat (limited to 'lang/gjs/src/gtk3/astalify.ts')
-rw-r--r-- | lang/gjs/src/gtk3/astalify.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lang/gjs/src/gtk3/astalify.ts b/lang/gjs/src/gtk3/astalify.ts index 6973805..9e6f022 100644 --- a/lang/gjs/src/gtk3/astalify.ts +++ b/lang/gjs/src/gtk3/astalify.ts @@ -69,6 +69,9 @@ export default function astalify< get noImplicitDestroy(): boolean { return this.__no_implicit_destroy } set noImplicitDestroy(value: boolean) { this.__no_implicit_destroy = value } + set actionGroup([prefix, group]: ActionGroup) { this.insert_action_group(prefix, group) } + set_action_group(actionGroup: ActionGroup) { this.actionGroup = actionGroup } + _setChildren(children: Gtk.Widget[]) { children = children.flat(Infinity).map(ch => ch instanceof Gtk.Widget ? ch @@ -165,6 +168,13 @@ export default function astalify< const { setup, child, children = [], ...props } = config props.visible ??= true + // remove undefined values + for (const [key, value] of Object.entries(props)) { + if (value === undefined) { + delete props[key] + } + } + if (child) children.unshift(child) @@ -327,3 +337,5 @@ type Cursor = | "nwse-resize" | "zoom-in" | "zoom-out" + +type ActionGroup = [prefix: string, actionGroup: Gtk.ActionGroup] |