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




commit 6a8ed8de660d98636faf9a17a3ee9f8e53c0ab95
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 2ae8af48..3fa42836 100644
--- a/libgweather/gweather-weather.c
+++ b/libgweather/gweather-weather.c
@@ -2153,6 +2153,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;
 
@@ -2186,7 +2191,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.
  *
  * If the application uses #GApplication, then the application ID
  * will be automatically filled in.


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