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
);
Builds a new GWeatherInfo that will provide weather information about
location
.
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, removed in 3.27.1 |
||
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 |
The current or forecasted significant phenomenon.
An additional modifier applied to a GWeatherConditionPhenomenon to describe the current or forecasted weather conditions. The exact meaning of each qualifier is described at http://www.weather.com/glossary/ and http://www.crh.noaa.gov/arx/wx.tbl.php
value not available |
||
no qualifier for the phenomenon |
||
phenomenon happening in the proximity of the location, not in the actual location |
||
phenomenon is light or predicted to be light |
||
phenomenon is moderate or predicted to be moderate |
||
phenomenon is heavy or predicted to be heavy |
||
shallow fog (only valid with
|
||
patches of fog (only valid with
|
||
partial fog (only valid with
|
||
phenomenon will be a thunderstorm and/or will include lightning |
||
phenomenon is blowing (valid with
|
||
phenomenon is heavy and involves showers |
||
phenomenon is moving across (valid
with |
||
phenomenon is freezing and involves ice |
||
maximum value of the enumeration. |
struct GWeatherConditions { gboolean significant; GWeatherConditionPhenomenon phenomenon; GWeatherConditionQualifier qualifier; };
A convenient way to describe the current or forecast
weather phenomenon, if significant, and its associated
modifier. If the value is not significant, the weather conditions
are described by gweather_info_get_sky()
instead.
In general it is discouraged to use this value directly to compute
the forecast icon: applications should instead use
gweather_info_get_icon_name()
or
gweather_info_get_symbolic_icon_name()
.
gboolean |
||
GWeatherConditionPhenomenon |
the main weather phenomenon |
|
GWeatherConditionQualifier |
a modifier for |
The sky and cloud visibility. In general it is discouraged to
use this value directly to compute the forecast icon: applications
should instead use gweather_info_get_icon_name()
or
gweather_info_get_symbolic_icon_name()
.
The direction of the prevailing wind. Composite values such as north-north-east indicate a direction between the two component value (north and north-east).
typedef gdouble GWeatherMoonPhase;
The current phase of the moon, represented as degrees, where 0 is the new moon, 90 is the first quarter, etc.
The measure unit to use for sky visibility values, when retrieved
by gweather_info_get_value_visibility()
.
The measure unit to use for atmospheric pressure values, when
retrieved by gweather_info_get_value_pressure()
.
invalid unit |
||
the user preferred pressure unit |
||
kiloPascal (* 10^3 Pa) |
||
hectoPascal (* 10^2 Pa); also known as millibars, but formatted differently |
||
millibars; same as |
||
millimeters of mercury |
||
inches of mercury |
||
atmospheres |
The measure unit to use for wind speed values, when retrieved by
gweather_info_get_value_wind()
.
The measure unit to use for temperature values, when retrieved by
the gweather_info_get_value_temp()
family of functions.
“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