[gnome-shell] locatePointer: Bind ripples creation to settings
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] locatePointer: Bind ripples creation to settings
- Date: Mon, 9 Sep 2019 19:37:50 +0000 (UTC)
commit a53b48de4c773f4513584b5fb3bb96074ad0d7e0
Author: Marco Trevisan (Treviño) <mail 3v1n0 net>
Date: Sat Aug 31 01:57:12 2019 +0200
locatePointer: Bind ripples creation to settings
Don't create ripples if locate pointer is not enabled, and bind
creation to the relative desktop interface settings key.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700
js/ui/locatePointer.js | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/locatePointer.js b/js/ui/locatePointer.js
index 10caa656d0..6ae29419a3 100644
--- a/js/ui/locatePointer.js
+++ b/js/ui/locatePointer.js
@@ -11,12 +11,26 @@ const LOCATE_POINTER_SCHEMA = "org.gnome.desktop.interface";
var LocatePointer = class {
constructor() {
this._settings = new Gio.Settings({ schema_id: LOCATE_POINTER_SCHEMA });
- this._ripples = new Ripples.Ripples(0.5, 0.5, 'ripple-pointer-location');
- this._ripples.addTo(Main.uiGroup);
+ this._settings.connect(`changed::${LOCATE_POINTER_KEY}`, () => this._syncEnabled());
+ this._syncEnabled();
+ }
+
+ _syncEnabled() {
+ let enabled = this._settings.get_boolean(LOCATE_POINTER_KEY);
+ if (enabled == !!this._ripples)
+ return;
+
+ if (enabled) {
+ this._ripples = new Ripples.Ripples(0.5, 0.5, 'ripple-pointer-location');
+ this._ripples.addTo(Main.uiGroup);
+ } else {
+ this._ripples.destroy();
+ this._ripples = null;
+ }
}
show() {
- if (!this._settings.get_boolean(LOCATE_POINTER_KEY))
+ if (!this._ripples)
return;
let [x, y] = global.get_pointer();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]