[gnome-shell] avatar: Use Property bindings to sync reactivity
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] avatar: Use Property bindings to sync reactivity
- Date: Wed, 16 Oct 2019 15:33:03 +0000 (UTC)
commit db7726c5bf4e2ae557163cf2db7aaadf90762837
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Sat Aug 31 01:32:03 2019 +0200
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
js/ui/userWidget.js | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js
index 5cd4bb36dd..9dcc60f40c 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]