/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * * Author: * Chris Toshok (toshok@ximian.com) * * Copyright 2000, Ximian, Inc. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "e-cal-backend-http-factory.h" #include "e-cal-backend-http.h" typedef struct { ECalBackendFactory parent_object; } ECalBackendHttpFactory; typedef struct { ECalBackendFactoryClass parent_class; } ECalBackendHttpFactoryClass; static void e_cal_backend_http_factory_instance_init (ECalBackendHttpFactory *factory) { } static const char * _get_protocol (ECalBackendFactory *factory) { return "webcal"; } static ECalBackend* _todos_new_backend (ECalBackendFactory *factory, ESource *source) { return g_object_new (e_cal_backend_http_get_type (), "source", source, "kind", ICAL_VTODO_COMPONENT, NULL); } static icalcomponent_kind _todos_get_kind (ECalBackendFactory *factory) { return ICAL_VTODO_COMPONENT; } static ECalBackend* _events_new_backend (ECalBackendFactory *factory, ESource *source) { return g_object_new (e_cal_backend_http_get_type (), "source", source, "kind", ICAL_VEVENT_COMPONENT, NULL); } static icalcomponent_kind _events_get_kind (ECalBackendFactory *factory) { return ICAL_VEVENT_COMPONENT; } static ECalBackend* _memos_new_backend (ECalBackendFactory *factory, ESource *source) { return g_object_new (e_cal_backend_http_get_type (), "source", source, "kind", ICAL_VJOURNAL_COMPONENT, NULL); } static icalcomponent_kind _memos_get_kind (ECalBackendFactory *factory) { return ICAL_VJOURNAL_COMPONENT; } static void todos_backend_factory_class_init (ECalBackendHttpFactoryClass *klass) { E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _todos_get_kind; E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _todos_new_backend; } static void events_backend_factory_class_init (ECalBackendHttpFactoryClass *klass) { E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _events_get_kind; E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _events_new_backend; } static void memos_backend_factory_class_init (ECalBackendHttpFactoryClass *klass) { E_CAL_BACKEND_FACTORY_CLASS (klass)->get_protocol = _get_protocol; E_CAL_BACKEND_FACTORY_CLASS (klass)->get_kind = _memos_get_kind; E_CAL_BACKEND_FACTORY_CLASS (klass)->new_backend = _memos_new_backend; } static GType events_backend_factory_get_type (GTypeModule *module) { GType type; GTypeInfo info = { sizeof (ECalBackendHttpFactoryClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc) events_backend_factory_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (ECalBackend), 0, /* n_preallocs */ (GInstanceInitFunc) e_cal_backend_http_factory_instance_init }; type = g_type_module_register_type (module, E_TYPE_CAL_BACKEND_FACTORY, "ECalBackendHttpEventsFactory", &info, 0); return type; } static GType todos_backend_factory_get_type (GTypeModule *module) { GType type; GTypeInfo info = { sizeof (ECalBackendHttpFactoryClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc) todos_backend_factory_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (ECalBackend), 0, /* n_preallocs */ (GInstanceInitFunc) e_cal_backend_http_factory_instance_init }; type = g_type_module_register_type (module, E_TYPE_CAL_BACKEND_FACTORY, "ECalBackendHttpTodosFactory", &info, 0); return type; } static GType memos_backend_factory_get_type (GTypeModule *module) { GType type; GTypeInfo info = { sizeof (ECalBackendHttpFactoryClass), NULL, /* base_class_init */ NULL, /* base_class_finalize */ (GClassInitFunc) memos_backend_factory_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof (ECalBackend), 0, /* n_preallocs */ (GInstanceInitFunc) e_cal_backend_http_factory_instance_init }; type = g_type_module_register_type (module, E_TYPE_CAL_BACKEND_FACTORY, "ECalBackendHttpMemosFactory", &info, 0); return type; } static GType http_types[3]; void eds_module_initialize (GTypeModule *module) { http_types[0] = todos_backend_factory_get_type (module); http_types[1] = events_backend_factory_get_type (module); http_types[2] = memos_backend_factory_get_type (module); } void eds_module_shutdown (void) { } void eds_module_list_types (const GType **types, int *num_types) { *types = http_types; *num_types = 3; }