diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2019-08-31 01:32:03 +0200 |
---|---|---|
committer | Florian Müllner <florian.muellner@gmail.com> | 2019-10-16 15:26:13 +0000 |
commit | db7726c5bf4e2ae557163cf2db7aaadf90762837 (patch) | |
tree | 8e1ebcacaefbda5559415fd35f22cac7a6e90744 | |
parent | 0b91dee5a9211ee0ca76ce0750c7f2d2ec8e0317 (diff) | |
download | gnome-shell-db7726c5bf4e2ae557163cf2db7aaadf90762837.tar.gz |
avatar: Use Property bindings to sync reactivity
Instead of manually updating properties on change, use native properties
bindings to keep the them synchronized.
Disable hover-tracking and focus-ability when the avatar is not sensitive.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559
-rw-r--r-- | js/ui/userWidget.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js index 5cd4bb36d..9dcc60f40 100644 --- a/js/ui/userWidget.js +++ b/js/ui/userWidget.js @@ -25,7 +25,6 @@ var Avatar = GObject.registerClass({ super._init({ style_class: params.styleClass, - track_hover: params.reactive, reactive: params.reactive, width: params.iconSize * themeContext.scaleFactor, height: params.iconSize * themeContext.scaleFactor @@ -34,6 +33,11 @@ var Avatar = GObject.registerClass({ this._iconSize = params.iconSize; this._user = user; + this.bind_property('reactive', this, 'track-hover', + GObject.BindingFlags.SYNC_CREATE); + this.bind_property('reactive', this, 'can-focus', + GObject.BindingFlags.SYNC_CREATE); + // Monitor the scaling factor to make sure we recreate the avatar when needed. this._scaleFactorChangeId = themeContext.connect('notify::scale-factor', this.update.bind(this)); @@ -50,7 +54,6 @@ var Avatar = GObject.registerClass({ } setSensitive(sensitive) { - this.can_focus = sensitive; this.reactive = sensitive; } |