[polari/wip/fmuellner/disconnect-accounts: 23/25] accounts: Add PolariAccount:visible property



commit 53fc58a2ad046326cf45a2d4029c1965c7fe896c
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Nov 9 03:29:26 2017 +0100

    accounts: Add PolariAccount:visible property
    
    Ever since we removed the separate connections dialog in favor of
    the room list header popovers in commit 263ff952a, it has not been
    possible to enable or disable accounts from Polari itself. We would
    like to re-expose that functionality again, but nowadays we also
    use the disable mechanism to implement undo for account removals.
    So in order to "free" the :enabled property, add a separate :visible
    property that will be used to show or hide accounts from the UI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771889

 src/accountsMonitor.js | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 38a5a5e..74341e5 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -158,6 +158,31 @@ class ClientFactory extends Polari.ClientFactory {
     }
 });
 
-const PolariAccount = GObject.registerClass(
-class PolariAccount extends Tp.Account {
+const PolariAccount = GObject.registerClass({
+    Properties: {
+        visible: GObject.ParamSpec.boolean('visible',
+                                           'visible',
+                                           'visible',
+                                           GObject.ParamFlags.READWRITE |
+                                           GObject.ParamFlags.EXPLICIT_NOTIFY,
+                                           true)
+    }
+}, class PolariAccount extends Tp.Account {
+    _init(params) {
+        this._visible = true;
+
+        super._init(params);
+    }
+
+    get visible() {
+        return this._visible;
+    }
+
+    set visible(value) {
+        if (this._visible == value)
+            return;
+
+        this._visible = value;
+        this.notify('visible');
+    }
 });


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