Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / calendar / backends / weather / e-cal-backend-weather-factory.c
1 /* Evolution calendar - weather backend factory
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 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24
25 #include <string.h>
26
27 #include "e-cal-backend-weather-factory.h"
28 #include "e-cal-backend-weather.h"
29
30 typedef struct {
31         ECalBackendFactory parent_object;
32 } ECalBackendWeatherFactory;
33
34 typedef struct {
35         ECalBackendWeatherClass parent_class;
36 } ECalBackendWeatherFactoryClass;
37
38 static void
39 e_cal_backend_weather_factory_instance_init (ECalBackendWeatherFactory *factory)
40 {
41 }
42
43 static const char *
44 _get_protocol (ECalBackendFactory *factory)
45 {
46         return "weather";
47 }
48
49 static ECalBackend*
50 _events_new_backend (ECalBackendFactory *factory, ESource *source)
51 {
52         return g_object_new (e_cal_backend_weather_get_type (),
53                              "source", source,
54                              "kind", ICAL_VEVENT_COMPONENT,
55                              NULL);
56 }
57
58 static icalcomponent_kind
59 _events_get_kind (ECalBackendFactory *factory)
60 {
61         return ICAL_VEVENT_COMPONENT;
62 }
63
64 static void
65 events_backend_factory_class_init (ECalBackendWeatherFactoryClass *klass)
66 {
67         E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol;
68         E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind     = _events_get_kind;
69         E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend  = _events_new_backend;
70 }
71
72 static GType
73 events_backend_factory_get_type (GTypeModule *module)
74 {
75         GType type;
76         GTypeInfo info = {
77                 sizeof (ECalBackendWeatherFactoryClass),
78                 NULL, /* base_class_init */
79                 NULL, /* base_class_finalize */
80                 (GClassInitFunc) events_backend_factory_class_init,
81                 NULL, /* class_finalize */
82                 NULL, /* class_data */
83                 sizeof (ECalBackend),
84                 0, /* n_preallocs */
85                 (GInstanceInitFunc) e_cal_backend_weather_factory_instance_init
86         };
87         type = g_type_module_register_type (module,
88                                             E_TYPE_CAL_BACKEND_FACTORY,
89                                             "ECalBackendWeatherEventsFactory",
90                                             &info, 0);
91
92         return type;
93 }
94
95 static GType weather_type[1];
96
97 void
98 eds_module_initialize (GTypeModule *module)
99 {
100         weather_type[0] = events_backend_factory_get_type (module);
101 }
102
103 void
104 eds_module_shutdown (void)
105 {
106 }
107
108 void
109 eds_module_list_types (const GType **types, int *num_types)
110 {
111         *types = weather_type;
112         *num_types = 1;
113 }