Debian Codegraph @

src/EWS/registry/e-ews-backend-factory.c

raw
1 /*
2 * SPDX-FileCopyrightText: (C) 2012 Red Hat, Inc. (www.redhat.com)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6 #include "evolution-ews-config.h"
7
8 #include "e-ews-backend-factory.h"
9
10 #include "e-ews-backend.h"
11
12 G_DEFINE_DYNAMIC_TYPE (
13 EEwsBackendFactory,
14 e_ews_backend_factory,
15 E_TYPE_COLLECTION_BACKEND_FACTORY)
16
17 static void
18 ews_backend_prepare_mail_account_source (ESource *source)
19 {
20 ESourceBackend *extension;
21 const gchar *extension_name;
22
23 extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
24 extension = e_source_get_extension (source, extension_name);
25 e_source_backend_set_backend_name (extension, "ews");
26 }
27
28 static void
29 ews_backend_prepare_mail_transport_source (ESource *source)
30 {
31 ESourceBackend *extension;
32 const gchar *extension_name;
33
34 extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
35 extension = e_source_get_extension (source, extension_name);
36 e_source_backend_set_backend_name (extension, "ews");
37 }
38
39 static void
40 ews_backend_factory_prepare_mail (ECollectionBackendFactory *factory,
41 ESource *mail_account_source,
42 ESource *mail_identity_source,
43 ESource *mail_transport_source)
44 {
45 ECollectionBackendFactoryClass *parent_class;
46
47 /* Chain up to parent's prepare_mail() method. */
48 parent_class =
49 E_COLLECTION_BACKEND_FACTORY_CLASS (
50 e_ews_backend_factory_parent_class);
51 parent_class->prepare_mail (
52 factory,
53 mail_account_source,
54 mail_identity_source,
55 mail_transport_source);
56
57 ews_backend_prepare_mail_account_source (mail_account_source);
58 ews_backend_prepare_mail_transport_source (mail_transport_source);
59 }
60
61 static void
62 e_ews_backend_factory_class_init (EEwsBackendFactoryClass *class)
63 {
64 ECollectionBackendFactoryClass *factory_class;
65
66 factory_class = E_COLLECTION_BACKEND_FACTORY_CLASS (class);
67 factory_class->factory_name = "ews";
68 factory_class->backend_type = E_TYPE_EWS_BACKEND;
69 factory_class->prepare_mail = ews_backend_factory_prepare_mail;
70 }
71
72 static void
73 e_ews_backend_factory_class_finalize (EEwsBackendFactoryClass *class)
74 {
75 }
76
77 static void
78 e_ews_backend_factory_init (EEwsBackendFactory *factory)
79 {
80 }
81
82 void
83 e_ews_backend_factory_type_register (GTypeModule *type_module)
84 {
85 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
86 * function, so we have to wrap it with a public function in
87 * order to register types from a separate compilation unit. */
88 e_ews_backend_factory_register_type (type_module);
89 }
90