[libgweather/wip/hadess/met-no-migration: 1/6] metno: Rename yr.no backend to met.no
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/wip/hadess/met-no-migration: 1/6] metno: Rename yr.no backend to met.no
- Date: Tue, 12 Jan 2021 00:09:10 +0000 (UTC)
commit 92f55acf67e508ad354e5d44054911ed1d3432d4
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 7 11:15:04 2021 +0100
metno: Rename yr.no backend to met.no
"The Yr API is now officially discontinued, and the Yr is now
trademarked for the website and mobile apps only."
Closes: #64
libgweather/gweather-private.h | 2 +-
libgweather/gweather-weather.c | 6 +++---
libgweather/gweather-weather.h | 4 ++--
libgweather/meson.build | 2 +-
libgweather/test_libgweather.c | 2 +-
libgweather/test_weather.c | 6 +++---
libgweather/{weather-yrno.c => weather-metno.c} | 18 +++++++++---------
7 files changed, 20 insertions(+), 20 deletions(-)
---
diff --git a/libgweather/gweather-private.h b/libgweather/gweather-private.h
index 0c740e92..cdb586b6 100644
--- a/libgweather/gweather-private.h
+++ b/libgweather/gweather-private.h
@@ -206,7 +206,7 @@ struct _GWeatherInfoPrivate {
void metar_start_open (GWeatherInfo *info);
gboolean iwin_start_open (GWeatherInfo *info);
-gboolean yrno_start_open (GWeatherInfo *info);
+gboolean metno_start_open (GWeatherInfo *info);
gboolean owm_start_open (GWeatherInfo *info);
gboolean metar_parse (gchar *metar,
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 8b8122c7..a57e2283 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -723,9 +723,9 @@ gweather_info_update (GWeatherInfo *info)
if (ok)
return;
- /* Try yr.no next */
- if (priv->providers & GWEATHER_PROVIDER_YR_NO)
- ok = yrno_start_open (info);
+ /* Try met.no next */
+ if (priv->providers & GWEATHER_PROVIDER_MET_NO)
+ ok = metno_start_open (info);
if (ok)
return;
diff --git a/libgweather/gweather-weather.h b/libgweather/gweather-weather.h
index 1a800d06..2c34a4a2 100644
--- a/libgweather/gweather-weather.h
+++ b/libgweather/gweather-weather.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
* @GWEATHER_PROVIDER_METAR: METAR office, providing current conditions worldwide
* @GWEATHER_PROVIDER_IWIN: US weather office, providing 7 days of forecast
* @GWEATHER_PROVIDER_YAHOO: Yahoo Weather Service, removed in 3.27.1
- * @GWEATHER_PROVIDER_YR_NO: Yr.no service, worldwide but requires attribution
+ * @GWEATHER_PROVIDER_MET_NO: MET.no service, worldwide but requires attribution
* @GWEATHER_PROVIDER_OWM: OpenWeatherMap, worldwide and possibly more reliable, but requires attribution
and is limited in the number of queries
* @GWEATHER_PROVIDER_ALL: enable all available providers
*/
@@ -44,7 +44,7 @@ typedef enum { /*< flags, underscore_name=gweather_provider >*/
GWEATHER_PROVIDER_METAR = 1,
GWEATHER_PROVIDER_IWIN = 1 << 2,
GWEATHER_PROVIDER_YAHOO = 1 << 3,
- GWEATHER_PROVIDER_YR_NO = 1 << 4,
+ GWEATHER_PROVIDER_MET_NO = 1 << 4,
GWEATHER_PROVIDER_OWM = 1 << 5,
GWEATHER_PROVIDER_ALL = 31
} GWeatherProvider;
diff --git a/libgweather/meson.build b/libgweather/meson.build
index e84ae249..c6c6f658 100644
--- a/libgweather/meson.build
+++ b/libgweather/meson.build
@@ -45,7 +45,7 @@ gweather_c_sources = [
'gweather-weather.c',
'weather-metar.c',
'weather-iwin.c',
- 'weather-yrno.c',
+ 'weather-metno.c',
'weather-owm.c',
'weather-sun.c',
'weather-moon.c',
diff --git a/libgweather/test_libgweather.c b/libgweather/test_libgweather.c
index 84841517..3d9ad67d 100644
--- a/libgweather/test_libgweather.c
+++ b/libgweather/test_libgweather.c
@@ -782,7 +782,7 @@ test_weather_loop_use_after_free (void)
GWEATHER_PROVIDER_METAR |
GWEATHER_PROVIDER_IWIN |
GWEATHER_PROVIDER_YAHOO |
- GWEATHER_PROVIDER_YR_NO |
+ GWEATHER_PROVIDER_MET_NO |
GWEATHER_PROVIDER_OWM);
gweather_info_set_location (info, loc);
g_signal_connect (G_OBJECT (info), "updated",
diff --git a/libgweather/test_weather.c b/libgweather/test_weather.c
index 832dee05..ffe7c92e 100644
--- a/libgweather/test_weather.c
+++ b/libgweather/test_weather.c
@@ -6,7 +6,7 @@
static char *search_str;
// gnome-weather uses:
-static GWeatherProvider providers = GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_YR_NO |
GWEATHER_PROVIDER_OWM;
+static GWeatherProvider providers = GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_MET_NO |
GWEATHER_PROVIDER_OWM;
// default:
//static GWeatherProvider providers = GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_IWIN;
@@ -115,8 +115,8 @@ set_providers (GWeatherInfo *info)
ADD_PROVIDER_STR("IWIN");
if (providers & GWEATHER_PROVIDER_YAHOO)
ADD_PROVIDER_STR("YAHOO");
- if (providers & GWEATHER_PROVIDER_YR_NO)
- ADD_PROVIDER_STR("YR_NO");
+ if (providers & GWEATHER_PROVIDER_MET_NO)
+ ADD_PROVIDER_STR("MET_NO");
if (providers & GWEATHER_PROVIDER_OWM)
ADD_PROVIDER_STR("OWM");
if (providers == GWEATHER_PROVIDER_NONE) {
diff --git a/libgweather/weather-yrno.c b/libgweather/weather-metno.c
similarity index 96%
rename from libgweather/weather-yrno.c
rename to libgweather/weather-metno.c
index b9e2e3e2..1b41c37a 100644
--- a/libgweather/weather-yrno.c
+++ b/libgweather/weather-metno.c
@@ -1,5 +1,5 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* weather-yrno.c - MET Norway Weather service.
+/* weather-metno.c - MET Norway Weather service.
*
* Copyright 2012 Giovanni Campagna <scampa giovanni gmail com>
*
@@ -391,7 +391,7 @@ parse_forecast_xml_new (GWeatherInfo *master_info,
}
static void
-yrno_finish_new (SoupSession *session,
+metno_finish_new (SoupSession *session,
SoupMessage *msg,
gpointer user_data)
{
@@ -403,11 +403,11 @@ yrno_finish_new (SoupSession *session,
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
/* forecast data is not really interesting anyway ;) */
if (msg->status_code == SOUP_STATUS_CANCELLED) {
- g_debug ("Failed to get Yr.no forecast data: %d %s\n",
+ g_debug ("Failed to get met.no forecast data: %d %s\n",
msg->status_code, msg->reason_phrase);
return;
}
- g_message ("Failed to get Yr.no forecast data: %d %s\n",
+ g_message ("Failed to get met.no forecast data: %d %s\n",
msg->status_code, msg->reason_phrase);
_gweather_info_request_done (user_data, msg);
return;
@@ -416,12 +416,12 @@ yrno_finish_new (SoupSession *session,
info = user_data;
priv = info->priv;
loc = &priv->location;
- g_debug ("yrno data for %lf, %lf", loc->latitude, loc->longitude);
+ g_debug ("metno data for %lf, %lf", loc->latitude, loc->longitude);
g_debug ("%s", msg->response_body->data);
parse_forecast_xml_new (info, msg->response_body);
num_forecasts = g_slist_length (priv->forecast_list);
- g_debug ("yrno parsed %d forecast infos", num_forecasts);
+ g_debug ("metno parsed %d forecast infos", num_forecasts);
if (!priv->valid)
priv->valid = (num_forecasts > 0);
@@ -429,7 +429,7 @@ yrno_finish_new (SoupSession *session,
}
gboolean
-yrno_start_open (GWeatherInfo *info)
+metno_start_open (GWeatherInfo *info)
{
GWeatherInfoPrivate *priv;
gchar *url;
@@ -449,11 +449,11 @@ yrno_start_open (GWeatherInfo *info)
g_ascii_dtostr (lonstr, sizeof(lonstr), RADIANS_TO_DEGREES (loc->longitude));
url = g_strdup_printf("https://api.met.no/weatherapi/locationforecast/1.9/?lat=%s;lon=%s", latstr,
lonstr);
- g_debug ("yrno_start_open, requesting: %s", url);
+ g_debug ("metno_start_open, requesting: %s", url);
message = soup_message_new ("GET", url);
_gweather_info_begin_request (info, message);
- soup_session_queue_message (priv->session, message, yrno_finish_new, info);
+ soup_session_queue_message (priv->session, message, metno_finish_new, info);
g_free (url);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]