[gnome-weather/wip/hadess/use-libgeoclue-portal: 2/2] currentLocationController: Stop accessing client proxy




commit ae4f90886773bc34cda556147c3a97965b026e8f
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jul 23 22:49:10 2021 +0200

    currentLocationController: Stop accessing client proxy
    
    We don't have access to the proxy when using the location portal.
    Instead, we can set the distance-threshold when creating the
    Geoclue.Simple.

 src/app/currentLocationController.js | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/src/app/currentLocationController.js b/src/app/currentLocationController.js
index 644ac63..57dace9 100644
--- a/src/app/currentLocationController.js
+++ b/src/app/currentLocationController.js
@@ -44,12 +44,14 @@ var CurrentLocationController = class CurrentLocationController {
 
     _startGeolocationService() {
         this._processStarted = true;
-        Geoclue.Simple.new(pkg.name,
-                           Geoclue.AccuracyLevel.CITY,
-                           null,
-                           (object, result) => {
-                                this._onSimpleReady(object, result)
-                            });
+        Geoclue.Simple.new_with_thresholds(pkg.name,
+                                           Geoclue.AccuracyLevel.CITY,
+                                           0, /* time threshold */
+                                           100, /* distance threshold */
+                                           null,
+                                           (object, result) => {
+                                               this._onSimpleReady(object, result)
+                                           });
     }
 
     _geoLocationFailed(e) {
@@ -69,9 +71,6 @@ var CurrentLocationController = class CurrentLocationController {
             return;
         }
 
-        let client = this._simple.get_client();
-        client.distance_threshold = 100;
-
         this._findLocation();
     }
 


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