source: trunk/third/gnome-applets/gweather/weather.h @ 20910

Revision 20910, 6.6 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r20909, which included commits to RCS files with non-trunk default branches.
Line 
1#ifndef __WEATHER_H_
2#define __WEATHER_H_
3
4/* $Id: weather.h,v 1.1.1.2 2004-10-04 03:07:16 ghudson Exp $ */
5
6/*
7 *  Papadimitriou Spiros <spapadim+@cs.cmu.edu>
8 *
9 *  This code released under the GNU GPL.
10 *  Read the file COPYING for more information.
11 *
12 *  Weather server functions (METAR and IWIN)
13 *
14 */
15
16#include <time.h>
17#include <panel-applet.h>
18#include <panel-applet-gconf.h>
19#include <libgnomevfs/gnome-vfs.h>
20#include "gweather.h"
21
22/*
23 * Location
24 */
25
26G_BEGIN_DECLS
27
28#define WEATHER_LOCATION_CODE_LEN 4
29
30struct _WeatherLocation {
31    gchar *untrans_name;
32    gchar *trans_name;
33    gchar *code;
34    gchar *zone;
35    gchar *radar;
36    gboolean zone_valid;
37};
38
39
40
41extern WeatherLocation *weather_location_new (const gchar *untrans_name, const gchar *trans_name, const gchar *code, const gchar *zone, const gchar *radar);
42extern WeatherLocation *weather_location_clone (const WeatherLocation *location);
43extern void weather_location_free (WeatherLocation *location);
44extern gboolean weather_location_equal (const WeatherLocation *location1, const WeatherLocation *location2);
45
46extern void weather_location_config_write (gchar *prefix, WeatherLocation *location);
47extern WeatherLocation *weather_location_config_read (PanelApplet *applet);
48
49
50/*
51 * Weather information
52 */
53
54enum _WeatherWindDirection {
55    WIND_VARIABLE,
56    WIND_N, WIND_NNE, WIND_NE, WIND_ENE,
57    WIND_E, WIND_ESE, WIND_SE, WIND_SSE,
58    WIND_S, WIND_SSW, WIND_SW, WIND_WSW,
59    WIND_W, WIND_WNW, WIND_NW, WIND_NNW
60};
61
62typedef enum _WeatherWindDirection WeatherWindDirection;
63
64extern const gchar *weather_wind_direction_string (WeatherWindDirection wind);
65
66enum _WeatherSky {
67    SKY_CLEAR,
68    SKY_BROKEN,
69    SKY_SCATTERED,
70    SKY_FEW,
71    SKY_OVERCAST
72};
73
74typedef enum _WeatherSky WeatherSky;
75
76extern const gchar *weather_sky_string (WeatherSky sky);
77
78enum _WeatherConditionPhenomenon {
79   PHENOMENON_NONE,
80
81   PHENOMENON_DRIZZLE,
82   PHENOMENON_RAIN,
83   PHENOMENON_SNOW,
84   PHENOMENON_SNOW_GRAINS,
85   PHENOMENON_ICE_CRYSTALS,
86   PHENOMENON_ICE_PELLETS,
87   PHENOMENON_HAIL,
88   PHENOMENON_SMALL_HAIL,
89   PHENOMENON_UNKNOWN_PRECIPITATION,
90
91   PHENOMENON_MIST,
92   PHENOMENON_FOG,
93   PHENOMENON_SMOKE,
94   PHENOMENON_VOLCANIC_ASH,
95   PHENOMENON_SAND,
96   PHENOMENON_HAZE,
97   PHENOMENON_SPRAY,
98   PHENOMENON_DUST,
99
100   PHENOMENON_SQUALL,
101   PHENOMENON_SANDSTORM,
102   PHENOMENON_DUSTSTORM,
103   PHENOMENON_FUNNEL_CLOUD,
104   PHENOMENON_TORNADO,
105   PHENOMENON_DUST_WHIRLS
106};
107
108typedef enum _WeatherConditionPhenomenon WeatherConditionPhenomenon;
109
110enum _WeatherConditionQualifier {
111   QUALIFIER_NONE,
112
113   QUALIFIER_VICINITY,
114
115   QUALIFIER_LIGHT,
116   QUALIFIER_MODERATE,
117   QUALIFIER_HEAVY,
118   QUALIFIER_SHALLOW,
119   QUALIFIER_PATCHES,
120   QUALIFIER_PARTIAL,
121   QUALIFIER_THUNDERSTORM,
122   QUALIFIER_BLOWING,
123   QUALIFIER_SHOWERS,
124   QUALIFIER_DRIFTING,
125   QUALIFIER_FREEZING
126};
127
128typedef enum _WeatherConditionQualifier WeatherConditionQualifier;
129
130struct _WeatherConditions {
131    gboolean significant;
132    WeatherConditionPhenomenon phenomenon;
133    WeatherConditionQualifier qualifier;
134};
135
136typedef struct _WeatherConditions WeatherConditions;
137
138extern const gchar *weather_conditions_string (WeatherConditions cond);
139
140enum _WeatherForecastType {
141    FORECAST_STATE,
142    FORECAST_ZONE
143};
144
145typedef enum _WeatherForecastType WeatherForecastType;
146
147typedef gdouble WeatherTemperature;
148typedef gdouble WeatherHumidity;
149typedef gint WeatherWindSpeed;
150typedef gdouble WeatherPressure;
151typedef gdouble WeatherVisibility;
152
153
154extern void weather_forecast_set (WeatherForecastType forecast);
155extern WeatherForecastType weather_forecast_get (void);
156
157extern void weather_radar_set (gboolean enable);
158extern gboolean weather_radar_get (void);
159
160extern void weather_proxy_set (const gchar *url, const gchar *user, const gchar *passwd);
161
162typedef time_t WeatherUpdate;
163
164struct _WeatherInfo {
165    gboolean valid;
166    WeatherLocation *location;
167    WeatherUpdate update;
168    WeatherSky sky;
169    WeatherConditions cond;
170    WeatherTemperature temp;
171    WeatherTemperature dew;
172    WeatherWindDirection wind;
173    WeatherWindSpeed windspeed;
174    WeatherPressure pressure;
175    WeatherVisibility visibility;
176    gchar *forecast;
177    gchar *metar_buffer;
178    gchar *iwin_buffer;
179    gchar *met_buffer;
180    gchar *bom_buffer;
181    gchar *radar_buffer;
182    gchar *radar_url;
183    GdkPixbufLoader *radar_loader;
184    GdkPixmap *radar;
185    GdkBitmap *radar_mask;
186    GnomeVFSAsyncHandle *metar_handle;
187    GnomeVFSAsyncHandle *iwin_handle;
188    GnomeVFSAsyncHandle *wx_handle;
189    GnomeVFSAsyncHandle *met_handle;
190    GnomeVFSAsyncHandle *bom_handle;
191    gboolean requests_pending;
192    GWeatherApplet *applet;
193};
194
195
196
197typedef void (*WeatherInfoFunc) (WeatherInfo *info);
198
199extern gboolean _weather_info_fill (GWeatherApplet *applet, WeatherInfo *info, WeatherLocation *location, WeatherInfoFunc cb);
200#define weather_info_new(applet, location,cb) _weather_info_fill((applet), NULL, (location), (cb))
201#define weather_info_update(applet, info,cb) _weather_info_fill((applet), (info), NULL, (cb));
202extern WeatherInfo *weather_info_clone (const WeatherInfo *info);
203extern void weather_info_free (WeatherInfo *info);
204
205extern void weather_info_config_write (WeatherInfo *info);
206extern WeatherInfo *weather_info_config_read (PanelApplet *applet);
207
208extern void weather_info_to_metric (WeatherInfo *info);
209extern void weather_info_to_imperial (WeatherInfo *info);
210
211extern const gchar *weather_info_get_location (WeatherInfo *info);
212extern const gchar *weather_info_get_update (WeatherInfo *info);
213extern const gchar *weather_info_get_sky (WeatherInfo *info);
214extern const gchar *weather_info_get_conditions (WeatherInfo *info);
215extern const gchar *weather_info_get_temp (WeatherInfo *info);
216extern const gchar *weather_info_get_dew (WeatherInfo *info);
217extern const gchar *weather_info_get_humidity (WeatherInfo *info);
218extern const gchar *weather_info_get_wind (WeatherInfo *info);
219extern const gchar *weather_info_get_pressure (WeatherInfo *info);
220extern const gchar *weather_info_get_visibility (WeatherInfo *info);
221extern const gchar *weather_info_get_apparent (WeatherInfo *info);
222extern const gchar *weather_info_get_forecast (WeatherInfo *info);
223extern GdkPixmap *weather_info_get_radar (WeatherInfo *info);
224
225extern const gchar *weather_info_get_temp_summary (WeatherInfo *info);
226extern gchar *weather_info_get_weather_summary (WeatherInfo *info);
227
228extern void update_finish (WeatherInfo *info);
229
230extern time_t make_time (gint date, gint hour, gint min);
231
232extern void _weather_info_get_pixbuf (WeatherInfo *info, gboolean mini, GdkPixbuf **pixbuf);
233#define weather_info_get_pixbuf_mini(info,pixbuf) _weather_info_get_pixbuf((info), TRUE, (pixbuf))
234#define weather_info_get_pixbuf(info,pixbuf) _weather_info_get_pixbuf((info), FALSE, (pixbuf))
235
236G_END_DECLS
237
238#endif /* __WEATHER_H_ */
Note: See TracBrowser for help on using the repository browser.