[gnome-shell] modemManager: Add property getters



commit 461bbcff153d7167d22bbf0e80ecbc5397d724cd
Author: Popax21 <matthias pleschinger gmail com>
Date:   Thu Oct 15 15:14:55 2020 +0000

    modemManager: Add property getters
    
    gjs improved its default property getter/setters, and as a result it
    is no longer possible to set read-only properties.
    
    Add proper getters (backed by private properties) to fix the resulting
    errors.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3203

 js/misc/modemManager.js | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/js/misc/modemManager.js b/js/misc/modemManager.js
index 0de0b24e2f..5f727f3ca2 100644
--- a/js/misc/modemManager.js
+++ b/js/misc/modemManager.js
@@ -111,17 +111,33 @@ var ModemBase = GObject.registerClass({
             0, 100, 0),
     },
 }, class ModemBase extends GObject.Object {
+    _init() {
+        super._init();
+        this._operatorName = null;
+        this._signalQuality = 0;
+    }
+
+    // eslint-disable-next-line camelcase
+    get operator_name() {
+        return this._operatorName;
+    }
+
+    // eslint-disable-next-line camelcase
+    get signal_quality() {
+        return this._signalQuality;
+    }
+
     _setOperatorName(operatorName) {
-        if (this.operator_name == operatorName)
+        if (this._operatorName == operatorName)
             return;
-        this.operator_name = operatorName;
+        this._operatorName = operatorName;
         this.notify('operator-name');
     }
 
     _setSignalQuality(signalQuality) {
-        if (this.signal_quality == signalQuality)
+        if (this._signalQuality == signalQuality)
             return;
-        this.signal_quality = signalQuality;
+        this._signalQuality = signalQuality;
         this.notify('signal-quality');
     }
 });


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