Debian Codegraph @

src/EWS/evolution/e-cal-config-ews.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-cal-config-ews.h"
9
10 G_DEFINE_DYNAMIC_TYPE (
11 ECalConfigEws,
12 e_cal_config_ews,
13 E_TYPE_SOURCE_CONFIG_BACKEND)
14
15 static gboolean
16 cal_config_ews_allow_creation (ESourceConfigBackend *backend)
17 {
18 ESourceConfig *config;
19 ECalSourceConfig *cal_config;
20 ECalClientSourceType source_type;
21 gboolean allow_creation = FALSE;
22
23 config = e_source_config_backend_get_config (backend);
24
25 cal_config = E_CAL_SOURCE_CONFIG (config);
26 source_type = e_cal_source_config_get_source_type (cal_config);
27
28 switch (source_type) {
29 case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
30 case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
31 allow_creation = TRUE;
32 break;
33
34 default:
35 break;
36 }
37
38 return allow_creation;
39 }
40
41 static void
42 cal_config_ews_insert_widgets (ESourceConfigBackend *backend,
43 ESource *scratch_source)
44 {
45 ESourceConfig *config;
46
47 if (!scratch_source)
48 return;
49
50 config = e_source_config_backend_get_config (backend);
51
52 e_source_config_add_refresh_interval (config, scratch_source);
53 e_source_config_add_refresh_on_metered_network (config, scratch_source);
54 }
55
56 static void
57 e_cal_config_ews_class_init (ECalConfigEwsClass *class)
58 {
59 EExtensionClass *extension_class;
60 ESourceConfigBackendClass *backend_class;
61
62 extension_class = E_EXTENSION_CLASS (class);
63 extension_class->extensible_type = E_TYPE_CAL_SOURCE_CONFIG;
64
65 backend_class = E_SOURCE_CONFIG_BACKEND_CLASS (class);
66 backend_class->backend_name = "ews";
67 backend_class->allow_creation = cal_config_ews_allow_creation;
68 backend_class->insert_widgets = cal_config_ews_insert_widgets;
69 }
70
71 static void
72 e_cal_config_ews_class_finalize (ECalConfigEwsClass *class)
73 {
74 }
75
76 static void
77 e_cal_config_ews_init (ECalConfigEws *backend)
78 {
79 }
80
81 void
82 e_cal_config_ews_type_register (GTypeModule *type_module)
83 {
84 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
85 * function, so we have to wrap it with a public function in
86 * order to register types from a separate compilation unit. */
87 e_cal_config_ews_register_type (type_module);
88 }
89