[gnome-shell/eos3.8: 183/255] payg: Add AccountID info on the applet



commit ea9edb103a238d281ffadcb7dc5c9659a336b28e
Author: Mazen Asef <mazen asefali gmail com>
Date:   Thu Jan 16 18:58:50 2020 -0300

    payg: Add AccountID info on the applet
    
    Show the account ID coming from the daemon on the user's
    icon tray, along with the time remaining.
    
    https://phabricator.endlessm.com/T28492
    
     * 2020-04-02: Squash with 81acbb876

 js/ui/status/payg.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/js/ui/status/payg.js b/js/ui/status/payg.js
index 26d66b8ff4..e1fe0713bb 100644
--- a/js/ui/status/payg.js
+++ b/js/ui/status/payg.js
@@ -108,8 +108,27 @@ class PaygIndicator extends PanelMenu.SystemIndicator {
         } else {
             let paygManagerId = this._paygManager.connect('initialized', () => {
                 this._sync();
+                this._initializeAccountIDMenu();
                 this._paygManager.disconnect(paygManagerId);
             });
         }
     }
+
+    // Differently from the remaining time counter, we just want to show the account ID
+    // when the backend properly supports it.
+    _initializeAccountIDMenu() {
+        if (this._verifyValidAccountID()) {
+            this._paygItem = new PopupMenu.PopupSubMenuMenuItem('', true);
+            this._paygItem.setSensitive(false);
+            this._paygItem.actor.visible = this._indicator.visible = this._paygManager.enabled;
+            this._paygItem.label.text = _('Account ID: %s').format(this._paygManager.accountID);
+            this._paygItem.icon.gicon = this._getMenuGicon();
+
+            this.menu.addMenuItem(this._paygItem);
+        }
+    }
+
+    _verifyValidAccountID() {
+        return Main.paygManager.accountID !== '0';
+    }
 });


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