Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / calendar / backends / weather / e-weather-source.h
1 /* Evolution calendar - weather backend source class
2  *
3  * Copyright (C) 2005 Novell, Inc (www.novell.com)
4  *
5  * Authors: David Trowbridge <trowbrds@cs.colorado.edu>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of version 2 of the GNU Lesser General Public
9  * License as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef E_WEATHER_SOURCE_H
22 #define E_WEATHER_SOURCE_H
23
24 #include <glib-object.h>
25 #include <time.h>
26
27 G_BEGIN_DECLS
28
29 typedef enum {
30         WEATHER_FAIR,
31         WEATHER_SNOW_SHOWERS,
32         WEATHER_SNOW,
33         WEATHER_PARTLY_CLOUDY,
34         WEATHER_SMOKE,
35         WEATHER_THUNDERSTORMS,
36         WEATHER_CLOUDY,
37         WEATHER_DRIZZLE,
38         WEATHER_SUNNY,
39         WEATHER_DUST,
40         WEATHER_CLEAR,
41         WEATHER_MOSTLY_CLOUDY,
42         WEATHER_WINDY,
43         WEATHER_RAIN_SHOWERS,
44         WEATHER_FOGGY,
45         WEATHER_RAIN_OR_SNOW_MIXED,
46         WEATHER_SLEET,
47         WEATHER_VERY_HOT_OR_HOT_HUMID,
48         WEATHER_BLIZZARD,
49         WEATHER_FREEZING_RAIN,
50         WEATHER_HAZE,
51         WEATHER_BLOWING_SNOW,
52         WEATHER_FREEZING_DRIZZLE,
53         WEATHER_VERY_COLD_WIND_CHILL,
54         WEATHER_RAIN,
55 } WeatherConditions;
56
57 typedef struct {
58         /* date, in UTC */
59         time_t date;
60         /* expected conditions */
61         WeatherConditions conditions;
62         /* internal storage is always in celcius and should be
63          * converted based on the user's current locale setting */
64         float high, low;
65         /* probability of precipitation */
66         int pop;
67         /* snowfall forecast - internal storage in cm */
68         float snowhigh, snowlow;
69 } WeatherForecast;
70
71 typedef void (*EWeatherSourceFinished)(GList *results, gpointer data);
72
73 #define E_TYPE_WEATHER_SOURCE            (e_weather_source_get_type ())
74 #define E_WEATHER_SOURCE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_WEATHER_SOURCE, EWeatherSource))
75 #define E_WEATHER_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_WEATHER_SOURCE, EWeatherSource))
76 #define E_IS_WEATHER_SOURCE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_WEATHER_SOURCE))
77 #define E_IS_WEATHER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_WEATHER_SOURCE))
78
79 typedef struct _EWeatherSource EWeatherSource;
80 typedef struct _EWeatherSourceClass EWeatherSourceClass;
81
82 /* This class is an abstract base-class for any weather data source.
83  * All the URL fetching is handled outside of this, and all this has
84  * to know how to do is parse the specific format. */
85 struct _EWeatherSource {
86         GObject object;
87 };
88
89 struct _EWeatherSourceClass {
90         GObjectClass parent_class;
91
92         /* Returns a list of WeatherForecast objects containing the
93          * data for the forecast. */
94         void (*parse)   (EWeatherSource *source, EWeatherSourceFinished done, gpointer data);
95 };
96
97 EWeatherSource* e_weather_source_new (const char *uri);
98 GType   e_weather_source_get_type (void);
99 void    e_weather_source_parse (EWeatherSource *source, EWeatherSourceFinished done, gpointer data);
100
101 G_END_DECLS
102
103 #endif