diff --git a/ags/widget/control-center/pages/Bluetooth.tsx b/ags/widget/control-center/pages/Bluetooth.tsx index 9b9e9c5..5d1929f 100644 --- a/ags/widget/control-center/pages/Bluetooth.tsx +++ b/ags/widget/control-center/pages/Bluetooth.tsx @@ -34,7 +34,7 @@ export const BluetoothPage = () => ]} - onClose={() => AstalBluetooth.get_default().adapter.discovering && + actionClose={() => AstalBluetooth.get_default().adapter.discovering && AstalBluetooth.get_default().adapter.stop_discovery()} bottomButtons={[{ title: tr("control_center.pages.more_settings"), diff --git a/ags/widget/control-center/pages/Microphone.tsx b/ags/widget/control-center/pages/Microphone.tsx index 7d1b111..6cec762 100644 --- a/ags/widget/control-center/pages/Microphone.tsx +++ b/ags/widget/control-center/pages/Microphone.tsx @@ -7,8 +7,8 @@ import AstalWp from "gi://AstalWp?version=0.1"; import { lookupIcon } from "../../../scripts/apps"; -export function PageMicrophone(): Page { - return + @@ -27,4 +27,3 @@ export function PageMicrophone(): Page { />} as Page; -} diff --git a/ags/widget/control-center/pages/Network.tsx b/ags/widget/control-center/pages/Network.tsx index 080dfe8..a743d9d 100644 --- a/ags/widget/control-center/pages/Network.tsx +++ b/ags/widget/control-center/pages/Network.tsx @@ -13,7 +13,7 @@ import AstalNetwork from "gi://AstalNetwork"; import { createBinding, For, With } from "ags"; -export const PageNetwork = () => +export const PageNetwork = () => Page) = () => +export const PageNightLight = () => diff --git a/ags/widget/control-center/pages/Page.tsx b/ags/widget/control-center/pages/Page.tsx index 4b38b62..799f9ba 100644 --- a/ags/widget/control-center/pages/Page.tsx +++ b/ags/widget/control-center/pages/Page.tsx @@ -3,11 +3,13 @@ import { Gtk } from "ags/gtk4"; import { Separator } from "../../Separator"; import { Accessor, For } from "ags"; import { transform, transformWidget, variableToBoolean, WidgetNodeType } from "../../../scripts/utils"; + import Pango from "gi://Pango?version=1.0"; + export type PageProps = { $?: () => void; - onClose?: () => void; + actionClose?: () => void; id: string; class?: string | Accessor; title: string | Accessor; @@ -31,27 +33,23 @@ export { Page }; @register({ GTypeName: "Page" }) class Page extends Gtk.Box { - readonly #id: string | number; - readonly bottomButtons?: Array; + #id: string | number = ""; + readonly bottomButtons?: Array = []; #subs: Array<() => void> = []; - #title: string | Accessor; + #title: string | Accessor = ""; #description?: string | Accessor; public get title() { return this.#title; } public get description() { return this.#description; } public get id() { return this.#id; } - public onClose?: () => void; + public actionClose?: () => void = () => {}; constructor(props: PageProps) { - super({ - hexpand: true, - orientation: Gtk.Orientation.VERTICAL - }); + super(); - this.#id = props.id; - this.#title = props.title; - this.#description = props.description; + this.set_hexpand(true); + this.set_orientation(Gtk.Orientation.VERTICAL); if(props.class instanceof Accessor) { this.#subs.push(props.class.subscribe(() => { @@ -67,6 +65,11 @@ class Page extends Gtk.Box { this.add_css_class("page"); } + this.#id = props.id; + this.#title = props.title; + this.#description = props.description; + this.actionClose = props.actionClose; + this.prepend( @@ -117,7 +120,6 @@ class Page extends Gtk.Box { )} as Gtk.Box); - this.onClose = props.onClose; props.$?.(); } }