From ed2ae06f3502ecd745dda529f61078afdf8962f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 30 Jul 2022 13:07:31 +0200 Subject: [PATCH] status/brightness: Improve proxy error handling On error, we currently print a warning and bail out early. That means we don't hide the slider, despite it being non-functional without the proxy. Fix this by making sure _sync() is called in any case. While at it, use an appropriate log level for the warning message. Part-of: --- js/ui/status/brightness.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js index 61258bd59..5a46c36ff 100644 --- a/js/ui/status/brightness.js +++ b/js/ui/status/brightness.js @@ -20,15 +20,13 @@ class Indicator extends PanelMenu.SystemIndicator { _init() { super._init(); this._proxy = new BrightnessProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, - (proxy, error) => { - if (error) { - log(error.message); - return; - } - - this._proxy.connect('g-properties-changed', this._sync.bind(this)); - this._sync(); - }); + (proxy, error) => { + if (error) + console.error(error.message); + else + this._proxy.connect('g-properties-changed', () => this._sync()); + this._sync(); + }); this._item = new PopupMenu.PopupBaseMenuItem({ activate: false }); this.menu.addMenuItem(this._item);