mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
gex: trial of updating quicktoggle with dbus signal
This commit is contained in:
@@ -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();
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user