From 72dc615bfd74226cc65da5588224580bb0b88651 Mon Sep 17 00:00:00 2001 From: Florian Brosch Date: Sun, 15 Oct 2017 21:58:57 +0200 Subject: [PATCH] weather: Drop gcal_weather_service_get_location_name() --- src/gcal-weather-service.c | 57 ++++++-------------------------------- 1 file changed, 8 insertions(+), 49 deletions(-) diff --git a/src/gcal-weather-service.c b/src/gcal-weather-service.c index 9ed78eee..2a6cd6ac 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; + GWeatherLocation *wworld; /* unowned */ + gdouble latitude; + gdouble longitude; - loc_name = gcal_weather_service_get_location_name (location); - if (loc_name != NULL) - { - 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().