weather: Drop gcal_weather_service_get_location_name()

This commit is contained in:
Florian Brosch
2017-12-11 21:32:01 -02:00
committed by Georges Basile Stavracas Neto
parent 9d4bf09ca7
commit 72dc615bfd
-41
View File
@@ -124,8 +124,6 @@ static void gcal_weather_service_update_location (GcalWeatherService
static void gcal_weather_service_update_gclue_location (GcalWeatherService *self, static void gcal_weather_service_update_gclue_location (GcalWeatherService *self,
GClueLocation *location); GClueLocation *location);
static char* gcal_weather_service_get_location_name (GClueLocation *location);
static void on_gclue_simple_creation (GClueSimple *source, static void on_gclue_simple_creation (GClueSimple *source,
GAsyncResult *result, GAsyncResult *result,
GcalWeatherService *data); GcalWeatherService *data);
@@ -951,11 +949,6 @@ gcal_weather_service_update_gclue_location (GcalWeatherService *self,
g_return_if_fail (location == NULL || GCLUE_IS_LOCATION (location)); g_return_if_fail (location == NULL || GCLUE_IS_LOCATION (location));
if (location != NULL) 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 */ GWeatherLocation *wworld; /* unowned */
gdouble latitude; gdouble latitude;
@@ -964,12 +957,10 @@ gcal_weather_service_update_gclue_location (GcalWeatherService *self,
latitude = gclue_location_get_latitude (location); latitude = gclue_location_get_latitude (location);
longitude = gclue_location_get_longitude (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. // nearest-city works more closely to gnome weather.
wworld = gweather_location_get_world (); wworld = gweather_location_get_world ();
wlocation = gweather_location_find_nearest_city (wworld, latitude, longitude); wlocation = gweather_location_find_nearest_city (wworld, latitude, longitude);
} }
}
gcal_weather_service_update_location (self, wlocation); gcal_weather_service_update_location (self, wlocation);
@@ -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: /* on_gclue_simple_creation:
* @source: * @source:
* @result: Result of gclue_simple_new(). * @result: Result of gclue_simple_new().