Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / calendar / backends / weather / e-weather-source.c
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 #include "e-weather-source.h"
22 #include "e-weather-source-ccf.h"
23
24 #include <string.h>
25
26 void
27 e_weather_source_parse (EWeatherSource *source, EWeatherSourceFinished done, gpointer data)
28 {
29         EWeatherSourceClass *class;
30         g_return_if_fail (source != NULL);
31         class = (EWeatherSourceClass*) G_OBJECT_GET_CLASS (source);
32         class->parse (source, done, data);
33 }
34
35 static void
36 e_weather_source_class_init (EWeatherSourceClass *class)
37 {
38         /* nothing to do here */
39 }
40
41 static void
42 e_weather_source_init (EWeatherSource *source)
43 {
44         /* nothing to do here */
45 }
46
47 GType
48 e_weather_source_get_type (void)
49 {
50         static GType e_weather_source_type = 0;
51
52         if (!e_weather_source_type) {
53                 static GTypeInfo info = {
54                         sizeof (EWeatherSourceClass),
55                         (GBaseInitFunc) NULL,
56                         (GBaseFinalizeFunc) NULL,
57                         (GClassInitFunc) e_weather_source_class_init,
58                         NULL, NULL,
59                         sizeof (EWeatherSource),
60                         0,
61                         (GInstanceInitFunc) e_weather_source_init
62                 };
63                 e_weather_source_type = g_type_register_static (G_TYPE_OBJECT, "EWeatherSource", &info, 0);
64         }
65
66         return e_weather_source_type;
67 }
68
69 EWeatherSource* e_weather_source_new (const char *uri)
70 {
71         const char *base = uri + 10; /* skip weather:// */
72
73         if (strncmp (base, "ccf/", 4) == 0)
74                 return e_weather_source_ccf_new (base);
75         return NULL;
76 }