| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: (C) 2020 Red Hat (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-m365.h" |
| 9 |
|
| 10 |
G_DEFINE_DYNAMIC_TYPE (ECalConfigM365, e_cal_config_m365, E_TYPE_SOURCE_CONFIG_BACKEND) |
| 11 |
|
| 12 |
static gboolean |
| 13 |
cal_config_m365_allow_creation (ESourceConfigBackend *backend) |
| 14 |
{ |
| 15 |
#if 0 |
| 16 |
ESourceConfig *config; |
| 17 |
ECalSourceConfig *cal_config; |
| 18 |
ECalClientSourceType source_type; |
| 19 |
gboolean allow_creation = FALSE; |
| 20 |
|
| 21 |
config = e_source_config_backend_get_config (backend); |
| 22 |
|
| 23 |
cal_config = E_CAL_SOURCE_CONFIG (config); |
| 24 |
source_type = e_cal_source_config_get_source_type (cal_config); |
| 25 |
|
| 26 |
switch (source_type) { |
| 27 |
case E_CAL_CLIENT_SOURCE_TYPE_EVENTS: |
| 28 |
case E_CAL_CLIENT_SOURCE_TYPE_TASKS: |
| 29 |
allow_creation = TRUE; |
| 30 |
break; |
| 31 |
|
| 32 |
default: |
| 33 |
break; |
| 34 |
} |
| 35 |
|
| 36 |
return allow_creation; |
| 37 |
#endif |
| 38 |
return FALSE; |
| 39 |
} |
| 40 |
|
| 41 |
static void |
| 42 |
cal_config_m365_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_m365_class_init (ECalConfigM365Class *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 = "microsoft365"; |
| 67 |
backend_class->allow_creation = cal_config_m365_allow_creation; |
| 68 |
backend_class->insert_widgets = cal_config_m365_insert_widgets; |
| 69 |
} |
| 70 |
|
| 71 |
static void |
| 72 |
e_cal_config_m365_class_finalize (ECalConfigM365Class *class) |
| 73 |
{ |
| 74 |
} |
| 75 |
|
| 76 |
static void |
| 77 |
e_cal_config_m365_init (ECalConfigM365 *backend) |
| 78 |
{ |
| 79 |
} |
| 80 |
|
| 81 |
void |
| 82 |
e_cal_config_m365_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_m365_register_type (type_module); |
| 88 |
} |