1 /* Evolution calendar - weather backend source class
3 * Copyright (C) 2005 Novell, Inc (www.novell.com)
5 * Authors: David Trowbridge <trowbrds@cs.colorado.edu>
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.
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.
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.
21 #ifndef E_WEATHER_SOURCE_H
22 #define E_WEATHER_SOURCE_H
24 #include <glib-object.h>
33 WEATHER_PARTLY_CLOUDY,
35 WEATHER_THUNDERSTORMS,
41 WEATHER_MOSTLY_CLOUDY,
45 WEATHER_RAIN_OR_SNOW_MIXED,
47 WEATHER_VERY_HOT_OR_HOT_HUMID,
49 WEATHER_FREEZING_RAIN,
52 WEATHER_FREEZING_DRIZZLE,
53 WEATHER_VERY_COLD_WIND_CHILL,
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 */
65 /* probability of precipitation */
67 /* snowfall forecast - internal storage in cm */
68 float snowhigh, snowlow;
71 typedef void (*EWeatherSourceFinished)(GList *results, gpointer data);
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))
79 typedef struct _EWeatherSource EWeatherSource;
80 typedef struct _EWeatherSourceClass EWeatherSourceClass;
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 {
89 struct _EWeatherSourceClass {
90 GObjectClass parent_class;
92 /* Returns a list of WeatherForecast objects containing the
93 * data for the forecast. */
94 void (*parse) (EWeatherSource *source, EWeatherSourceFinished done, gpointer data);
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);