Top | ![]() |
![]() |
![]() |
![]() |
GWeatherProvider | enabled-providers | Read / Write |
GWeatherLocation * | location | Read / Write / Construct |
enum | GWeatherProvider |
enum | GWeatherConditionPhenomenon |
enum | GWeatherConditionQualifier |
struct | GWeatherConditions |
enum | GWeatherSky |
enum | GWeatherWindDirection |
typedef | GWeatherMoonLatitude |
typedef | GWeatherMoonPhase |
enum | GWeatherDistanceUnit |
enum | GWeatherPressureUnit |
enum | GWeatherSpeedUnit |
enum | GWeatherTemperatureUnit |
GWeatherInfo provides a handy way to access weather conditions and forecasts from a GWeatherLocation, aggregating multiple different web services.
It includes also astronomical data such as sunrise times and moon phases.
GWeatherInfo * gweather_info_new (GWeatherLocation *location
,GWeatherForecastType type
);
Builds a new GWeatherInfo that will provide weather information about
location
.
location |
the desidered GWeatherLocation ( |
[allow-none] |
type |
deprecated and ignored |
void
gweather_info_update (GWeatherInfo *info
);
Requests a reload of weather conditions and forecast data from enabled network services. This call does no synchronous IO: rather, the result is delivered by emitting the “updated” signal. Note that if no network services are enabled, the signal will not be emitted. See “enabled-providers” for details.
void
gweather_info_store_cache (void
);
Ensures that any data cached from the network is stored to disk. Calling this is not necessary, as the cache will be saved when the last reference to a GWeatherInfo will be dropped. On the other hand, it must be called if there is any chance that the application will be closed without unreffing all objects, such as when using a language binding that employs a GC.
const GWeatherLocation *
gweather_info_get_location (GWeatherInfo *info
);
void gweather_info_set_location (GWeatherInfo *info
,GWeatherLocation *location
);
Changes info
to report weather for location
.
Note that this will clear any forecast or current conditions from
info
, you must call gweather_info_update()
to obtain the new data.
GSList *
gweather_info_get_forecast_list (GWeatherInfo *info
);
list of GWeatherInfo* objects for the forecast. The list is owned by the 'info' object thus is alive as long as the 'info'. This list is filled only when requested with type FORECAST_LIST and if available for given location. The 'update' property is the date/time when the forecast info is used for.
[transfer none][element-type GWeather.Info]
GWeatherProvider
gweather_info_get_enabled_providers (GWeatherInfo *info
);
void gweather_info_set_enabled_providers (GWeatherInfo *info
,GWeatherProvider providers
);
const gchar *
gweather_info_get_attribution (GWeatherInfo *info
);
Some weather services require the application showing the data to include an attribution text, possibly including links to the service website. This must be shown prominently toghether with the data.
the required attribution text, in Pango
markup form, or NULL
if not required.
[transfer none]
const gchar *
gweather_info_get_symbolic_icon_name (GWeatherInfo *info
);
gchar *
gweather_info_get_weather_summary (GWeatherInfo *info
);
const gchar *
gweather_conditions_to_string (GWeatherConditions *conditions
);
const gchar *
gweather_wind_direction_to_string (GWeatherWindDirection wind
);
gboolean gweather_info_get_value_update (GWeatherInfo *info
,time_t *value
);
gboolean gweather_info_get_value_sky (GWeatherInfo *info
,GWeatherSky *sky
);
Fills out sky
with current sky conditions.
gboolean gweather_info_get_value_conditions (GWeatherInfo *info
,GWeatherConditionPhenomenon *phenomenon
,GWeatherConditionQualifier *qualifier
);
Fills out phenomenon
and qualifier
with current weather conditions.
info |
||
phenomenon |
a location for a GWeatherConditionPhenomenon. |
[out] |
qualifier |
a location for a GWeatherConditionQualifier. |
[out] |
gboolean gweather_info_get_value_temp (GWeatherInfo *info
,GWeatherTemperatureUnit unit
,gdouble *value
);
info |
||
unit |
the desired unit, as a GWeatherTemperatureUnit |
|
value |
the temperature value. |
[out] |
gboolean gweather_info_get_value_temp_min (GWeatherInfo *info
,GWeatherTemperatureUnit unit
,gdouble *value
);
info |
||
unit |
the desired unit, as a GWeatherTemperatureUnit |
|
value |
the minimum temperature value. |
[out] |
gboolean gweather_info_get_value_temp_max (GWeatherInfo *info
,GWeatherTemperatureUnit unit
,gdouble *value
);
info |
||
unit |
the desired unit, as a GWeatherTemperatureUnit |
|
value |
the maximum temperature value. |
[out] |
gboolean gweather_info_get_value_dew (GWeatherInfo *info
,GWeatherTemperatureUnit unit
,gdouble *value
);
gboolean gweather_info_get_value_apparent (GWeatherInfo *info
,GWeatherTemperatureUnit unit
,gdouble *value
);
info |
||
unit |
the desired unit, as a GWeatherTemperatureUnit |
|
value |
the apparent temperature. |
[out] |
gboolean gweather_info_get_value_wind (GWeatherInfo *info
,GWeatherSpeedUnit unit
,gdouble *speed
,GWeatherWindDirection *direction
);
info |
||
unit |
the desired unit, as a GWeatherSpeedUnit |
|
speed |
forecasted wind speed. |
[out] |
direction |
forecasted wind direction. |
[out] |
gboolean gweather_info_get_value_pressure (GWeatherInfo *info
,GWeatherPressureUnit unit
,gdouble *value
);
info |
||
unit |
the desired unit, as a GWeatherPressureUnit |
|
value |
forecasted pressure, expressed in |
[out] |
gboolean gweather_info_get_value_visibility (GWeatherInfo *info
,GWeatherDistanceUnit unit
,gdouble *value
);
info |
||
unit |
the desired unit, as a GWeatherDistanceUnit |
|
value |
forecasted visibility, expressed in |
[out] |
gboolean gweather_info_get_value_sunrise (GWeatherInfo *info
,time_t *value
);
gboolean gweather_info_get_value_sunset (GWeatherInfo *info
,time_t *value
);
gboolean gweather_info_get_value_moonphase (GWeatherInfo *info
,GWeatherMoonPhase *value
,GWeatherMoonLatitude *lat
);
gboolean gweather_info_get_upcoming_moonphases (GWeatherInfo *info
,time_t *phases
);
info |
a GWeatherInfo containing the time_t of interest |
|
phases |
An array of four time_t values that will hold the returned values. The values are estimates of the time of the next new, quarter, full and three-quarter moons. |
[out][array fixed-size=4][element-type gulong] |
gboolean
gweather_info_is_daytime (GWeatherInfo *info
);
Whether it is daytime (that is, if the sun is visible)
or not at the location and the point of time referred by info
.
This is mostly equivalent to comparing the return value
of gweather_info_get_value_sunrise()
and
gweather_info_get_value_sunset()
, but it accounts also
for midnight sun and polar night, for locations within
the Artic and Antartic circles.
no provider, no weather information available |
||
METAR office, providing current conditions worldwide |
||
US weather office, providing 7 days of forecast |
||
Yahoo Weather Service, worldwide but non commercial only |
||
Yr.no service, worldwide but requires attribution |
||
OpenWeatherMap, worldwide and possibly more reliable, but requires attribution and is limited in the number of queries |
||
enable all available providers |
struct GWeatherConditions { gboolean significant; GWeatherConditionPhenomenon phenomenon; GWeatherConditionQualifier qualifier; };
“enabled-providers”
property“enabled-providers” GWeatherProvider
A bitmask of enabled weather service providers.
Flags: Read / Write
Default value: GWEATHER_PROVIDER_METAR | GWEATHER_PROVIDER_IWIN
“location”
property“location” GWeatherLocation *
The location this info represents.
Flags: Read / Write / Construct
“updated”
signalvoid user_function (GWeatherInfo *object, gpointer user_data)
This signal is emitted after the initial fetch of the weather
data from upstream services, and after every successful call
to
.gweather_info_update()
object |
the emitter of the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First