✨ ags: new window management system, adjustments, use adwaita sans
This commit is contained in:
@@ -6,7 +6,7 @@ import { togglePage } from "../Pages";
|
||||
import { PageNetwork } from "../pages/Network";
|
||||
import { tr } from "../../../i18n/intl";
|
||||
|
||||
export const TileNetwork = new Widget.Box({
|
||||
export const TileNetwork = () => new Widget.Box({
|
||||
child: Variable.derive([
|
||||
bind(AstalNetwork.get_default(), "primary"),
|
||||
bind(AstalNetwork.get_default(), "wired"),
|
||||
@@ -36,7 +36,7 @@ export const TileNetwork = new Widget.Box({
|
||||
icon: "",
|
||||
iconSize: 16,
|
||||
toggleState: bind(wifi, "enabled")
|
||||
} as TileProps);
|
||||
} as TileProps)();
|
||||
|
||||
} else if(primary === AstalNetwork.Primary.WIRED) {
|
||||
return Tile({
|
||||
@@ -69,7 +69,7 @@ export const TileNetwork = new Widget.Box({
|
||||
internet === AstalNetwork.Internet.CONNECTING
|
||||
|| internet === AstalNetwork.Internet.CONNECTED
|
||||
)
|
||||
} as TileProps);
|
||||
} as TileProps)();
|
||||
}
|
||||
|
||||
return Tile({
|
||||
@@ -82,6 +82,6 @@ export const TileNetwork = new Widget.Box({
|
||||
iconSize: 16,
|
||||
toggleState: bind(wired, "internet").as((internet: AstalNetwork.Internet) =>
|
||||
internet === AstalNetwork.Internet.CONNECTING || internet === AstalNetwork.Internet.CONNECTED)
|
||||
} as TileProps);
|
||||
} as TileProps)();
|
||||
})()
|
||||
} as Widget.BoxProps);
|
||||
|
||||
@@ -15,7 +15,7 @@ export type TileProps = {
|
||||
onClickMore?: () => void;
|
||||
}
|
||||
|
||||
export function Tile(props: TileProps): Widget.EventBox {
|
||||
export function Tile(props: TileProps): (() => Widget.EventBox) {
|
||||
const toggled = new Variable<boolean>(props.toggleState instanceof Binding ?
|
||||
(props.toggleState.get() || false) : (props.toggleState || false));
|
||||
|
||||
@@ -24,7 +24,7 @@ export function Tile(props: TileProps): Widget.EventBox {
|
||||
if(props?.toggleState instanceof Binding)
|
||||
subscription = props.toggleState.subscribe(val => toggled.set(val || false));
|
||||
|
||||
return new Widget.EventBox({
|
||||
return () => new Widget.EventBox({
|
||||
className: toggled().as((state: boolean) =>
|
||||
state ? "tile-eventbox toggled" : "tile-eventbox"),
|
||||
expand: true,
|
||||
@@ -39,7 +39,7 @@ export function Tile(props: TileProps): Widget.EventBox {
|
||||
toggled.set(true);
|
||||
props.onToggledOn && props.onToggledOn();
|
||||
},
|
||||
onDestroy: () => subscription(),
|
||||
onDestroy: () => subscription?.(),
|
||||
child: new Widget.Box({
|
||||
className: (props.className instanceof Binding) ?
|
||||
props.className.as((clsName: (string|undefined)) =>
|
||||
|
||||
Reference in New Issue
Block a user