[gnome-shell] status/brightness: Improve proxy error handling



commit ed2ae06f3502ecd745dda529f61078afdf8962f3
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Jul 30 13:07:31 2022 +0200

    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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2391>

 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 61258bd59e..5a46c36ff0 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]