[gnome-weather/wip/christopherdavis/use-find-nearest-city-instead-of-detached: 2/3] app: Use find_nearest_city() instead of new_detached()



commit f07286f13a3daf8fa5a44da8dfeef36e9df44ed0
Author: Christopher Davis <brainblasted disroot org>
Date:   Tue Mar 19 15:20:41 2019 -0700

    app: Use find_nearest_city() instead of new_detached()
    
    GWeather.Location.new_detached() can return a value that
    cannot be serialized after being serialized.
    
    We can use find_nearest_city() in place of it for now.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-weather/issues/25

 src/app/currentLocationController.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/app/currentLocationController.js b/src/app/currentLocationController.js
index 67538d2..644ac63 100644
--- a/src/app/currentLocationController.js
+++ b/src/app/currentLocationController.js
@@ -87,10 +87,11 @@ var CurrentLocationController = class CurrentLocationController {
     _onLocationUpdated(simple) {
         let geoclueLocation = simple.get_location();
 
-        this.currentLocation = GWeather.Location.new_detached(geoclueLocation.description,
-                                                              null,
-                                                              geoclueLocation.latitude,
-                                                              geoclueLocation.longitude);
+        this.currentLocation = GWeather.Location.get_world()
+                                                .find_nearest_city(
+                                                    geoclueLocation.latitude,
+                                                    geoclueLocation.longitude
+                                                );
         this._world.currentLocationChanged(this.currentLocation);
     }
 


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