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




commit e1baf5e1c5fb0d3c06bf8d9f58ef2dcf91b677df
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]