[gnome-calendar/wip/flb/weather-forecast: 28/50] weather: Drop gcal_weather_service_get_location_name()



commit 6ed2ccc0f3e95c1074d06656b0e33c0c7967a79b
Author: Florian Brosch <flo brosch gmail com>
Date:   Sun Oct 15 21:58:57 2017 +0200

    weather: Drop gcal_weather_service_get_location_name()

 src/gcal-weather-service.c |   57 ++++++-------------------------------------
 1 files changed, 8 insertions(+), 49 deletions(-)
---
diff --git a/src/gcal-weather-service.c b/src/gcal-weather-service.c
index 9ed78ee..2a6cd6a 100644
--- a/src/gcal-weather-service.c
+++ b/src/gcal-weather-service.c
@@ -124,8 +124,6 @@ static void     gcal_weather_service_update_location       (GcalWeatherService
 static void     gcal_weather_service_update_gclue_location (GcalWeatherService  *self,
                                                             GClueLocation       *location);
 
-static char*    gcal_weather_service_get_location_name     (GClueLocation       *location);
-
 static void     on_gclue_simple_creation                   (GClueSimple         *source,
                                                             GAsyncResult        *result,
                                                             GcalWeatherService  *data);
@@ -952,23 +950,16 @@ gcal_weather_service_update_gclue_location (GcalWeatherService  *self,
 
   if (location != NULL)
     {
-      g_autofree gchar *loc_name = NULL;
-
-      loc_name = gcal_weather_service_get_location_name (location);
-      if (loc_name != NULL)
-        {
-          GWeatherLocation *wworld; /* unowned */
-          gdouble latitude;
-          gdouble longitude;
+      GWeatherLocation *wworld; /* unowned */
+      gdouble latitude;
+      gdouble longitude;
 
-          latitude = gclue_location_get_latitude (location);
-          longitude = gclue_location_get_longitude (location);
+      latitude = gclue_location_get_latitude (location);
+      longitude = gclue_location_get_longitude (location);
 
-          // wlocation = gweather_location_new_detached (loc_name, NULL, latitude, longitude);
-          // nearest-city works more closely to gnome weather.
-          wworld = gweather_location_get_world ();
-          wlocation = gweather_location_find_nearest_city (wworld, latitude, longitude);
-        }
+      // nearest-city works more closely to gnome weather.
+      wworld = gweather_location_get_world ();
+      wlocation = gweather_location_find_nearest_city (wworld, latitude, longitude);
     }
 
 
@@ -980,38 +971,6 @@ gcal_weather_service_update_gclue_location (GcalWeatherService  *self,
 
 
 
-/* gcal_weather_service_get_location_name:
- * @location: A #GClueLocation to get the city name from.
- *
- * Queries the city name for the given location or %NULL.
- *
- * @Returns: (transfer full) (nullable): City name or %NULL.
- */
-static char*
-gcal_weather_service_get_location_name (GClueLocation *location)
-{
-  g_autoptr (GeocodeLocation) glocation = NULL;
-  g_autoptr (GeocodeReverse) greverse = NULL;
-  g_autoptr (GeocodePlace) gplace = NULL;
-
-  g_return_val_if_fail (GCLUE_IS_LOCATION (location), NULL);
-
-  glocation = geocode_location_new (gclue_location_get_latitude (location),
-                                    gclue_location_get_longitude (location),
-                                    gclue_location_get_accuracy (location));
-
-  greverse = geocode_reverse_new_for_location (glocation);
-
-  /* TODO: Use async version of geocode_reverse_resolve */
-  gplace = geocode_reverse_resolve (greverse, NULL);
-  if (gplace == NULL)
-    return NULL;
-
-  return g_strdup (geocode_place_get_town (gplace));
-}
-
-
-
 /* on_gclue_simple_creation:
  * @source:
  * @result:                Result of gclue_simple_new().


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