[libgweather/wip/hadess/app-id: 5/8] gweather: Require an app id to enable weather providers




commit 60950318b566c966ab8337ee066f9a35d2f39199
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jan 12 12:06:28 2021 +0100

    gweather: Require an app id to enable weather providers
    
    And mention that in the gweather_info_set_application_id() API doc.

 libgweather/gweather-weather.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/libgweather/gweather-weather.c b/libgweather/gweather-weather.c
index 37ee928a..b4ecadc0 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -2152,6 +2152,11 @@ gweather_info_set_enabled_providers (GWeatherInfo     *info,
 {
     g_return_if_fail (GWEATHER_IS_INFO (info));
 
+    if (providers != GWEATHER_PROVIDER_NONE) {
+        g_return_if_fail (info->application_id != NULL);
+        g_return_if_fail (g_application_id_is_valid (info->application_id));
+    }
+
     if (info->providers == providers)
        return;
 
@@ -2185,7 +2190,8 @@ gweather_info_get_application_id (GWeatherInfo *info)
  * @application_id: the application ID to set
  *
  * Sets the [application ID](https://docs.flatpak.org/en/latest/conventions.html#application-ids)
- * of the application fetching the weather.
+ * of the application fetching the weather. It is a requirement
+ * for using any of the online weather providers.
  */
 void
 gweather_info_set_application_id (GWeatherInfo *info,


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