[polari/wip/fmuellner/disconnect-accounts: 3/5] accounts: Add PolariAccount:visible property
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/disconnect-accounts: 3/5] accounts: Add PolariAccount:visible property
- Date: Mon, 13 Nov 2017 07:19:55 +0000 (UTC)
commit be2fd69dd19d765eb34905bdce12f1e7c759d547
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 | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/src/accountsMonitor.js b/src/accountsMonitor.js
index 38a5a5e..5dce4d2 100644
--- a/src/accountsMonitor.js
+++ b/src/accountsMonitor.js
@@ -158,6 +158,45 @@ 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.READABLE |
+ GObject.ParamFlags.EXPLICIT_NOTIFY,
+ true)
+ }
+}, class PolariAccount extends Tp.Account {
+ _init(params) {
+ this._visible = true;
+
+ super._init(params);
+ }
+
+ get visible() {
+ return this._visible;
+ }
+
+ on_notify(pspec) {
+ if (pspec.name == 'enabled' && this.enabled)
+ this._setVisibleInternal(true);
+ }
+
+ setVisible(value, callback) {
+ this.set_enabled_async(value, (o, res) => {
+ this.set_enabled_finish(res);
+
+ this._setVisibleInternal(value);
+ callback();
+ });
+ }
+
+ _setVisibleInternal(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]