gex: trial of updating quicktoggle with dbus signal

This commit is contained in:
Luke D. Jones
2023-07-01 23:14:54 +12:00
parent 13965b2261
commit b002187b39
3 changed files with 12 additions and 5 deletions

View File

@@ -12,6 +12,9 @@ export class Platform extends DbusBase {
mini_led_mode: false
};
// TODO: interface or something to enforce requirement of "sync()" method
public notifyPanelOdSubscribers: any[] = [];
constructor() {
super("org-asuslinux-platform-4", "/org/asuslinux/Platform");
}
@@ -142,6 +145,9 @@ export class Platform extends DbusBase {
if (proxy) {
//@ts-ignore
log(`NotifyPanelOd has changed to ${data}.`);
this.notifyPanelOdSubscribers.forEach(sub => {
sub.sync();
});
}
}
);

View File

@@ -35,17 +35,17 @@ export const QuickPanelOd = GObject.registerClass(
this, "checked",
Gio.SettingsBindFlags.DEFAULT);
this._sync();
this.sync();
addQuickSettingsItems([this]);
}
_toggleMode() {
this._dbus_platform.setPanelOd(this.checked);
this._sync();
this.sync();
}
_sync() {
sync() {
const checked = this._dbus_platform.getPanelOd();
if (this.checked !== checked)
this.set({ checked });