| 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-mail-config-ews-notebook.h" |
| 9 |
|
| 10 |
#include <mail/e-mail-config-notebook.h> |
| 11 |
|
| 12 |
#include "e-mail-config-ews-delegates-page.h" |
| 13 |
#include "e-mail-config-ews-ooo-page.h" |
| 14 |
#include "e-mail-config-ews-folder-sizes-page.h" |
| 15 |
|
| 16 |
G_DEFINE_DYNAMIC_TYPE ( |
| 17 |
EMailConfigEwsNotebook, |
| 18 |
e_mail_config_ews_notebook, |
| 19 |
E_TYPE_EXTENSION) |
| 20 |
|
| 21 |
static EMailConfigNotebook * |
| 22 |
mail_config_ews_notebook_get_extensible (EMailConfigEwsNotebook *extension) |
| 23 |
{ |
| 24 |
EExtensible *extensible; |
| 25 |
|
| 26 |
extensible = e_extension_get_extensible (E_EXTENSION (extension)); |
| 27 |
|
| 28 |
return E_MAIL_CONFIG_NOTEBOOK (extensible); |
| 29 |
} |
| 30 |
|
| 31 |
static void |
| 32 |
mail_config_ews_notebook_constructed (GObject *object) |
| 33 |
{ |
| 34 |
EMailConfigEwsNotebook *extension; |
| 35 |
EMailConfigNotebook *notebook; |
| 36 |
EMailSession *session; |
| 37 |
ESource *account_source; |
| 38 |
ESource *identity_source; |
| 39 |
ESource *collection_source; |
| 40 |
ESourceBackend *backend_ext; |
| 41 |
ESourceRegistry *registry; |
| 42 |
const gchar *backend_name; |
| 43 |
const gchar *extension_name; |
| 44 |
|
| 45 |
extension = E_MAIL_CONFIG_EWS_NOTEBOOK (object); |
| 46 |
notebook = mail_config_ews_notebook_get_extensible (extension); |
| 47 |
|
| 48 |
/* Chain up to parent's constructed() method. */ |
| 49 |
G_OBJECT_CLASS (e_mail_config_ews_notebook_parent_class)->constructed (object); |
| 50 |
|
| 51 |
session = e_mail_config_notebook_get_session (notebook); |
| 52 |
registry = e_mail_session_get_registry (session); |
| 53 |
|
| 54 |
account_source = |
| 55 |
e_mail_config_notebook_get_account_source (notebook); |
| 56 |
identity_source = |
| 57 |
e_mail_config_notebook_get_identity_source (notebook); |
| 58 |
collection_source = |
| 59 |
e_mail_config_notebook_get_collection_source (notebook); |
| 60 |
|
| 61 |
extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT; |
| 62 |
backend_ext = e_source_get_extension (account_source, extension_name); |
| 63 |
backend_name = e_source_backend_get_backend_name (backend_ext); |
| 64 |
|
| 65 |
if (g_strcmp0 (backend_name, "ews") == 0) { |
| 66 |
EMailConfigPage *page; |
| 67 |
|
| 68 |
page = e_mail_config_ews_ooo_page_new ( |
| 69 |
registry, |
| 70 |
account_source, |
| 71 |
identity_source, |
| 72 |
collection_source); |
| 73 |
e_mail_config_notebook_add_page (notebook, page); |
| 74 |
|
| 75 |
page = e_mail_config_ews_delegates_page_new ( |
| 76 |
registry, |
| 77 |
account_source, |
| 78 |
identity_source, |
| 79 |
collection_source); |
| 80 |
e_mail_config_notebook_add_page (notebook, page); |
| 81 |
|
| 82 |
page = e_mail_config_ews_folder_sizes_page_new ( |
| 83 |
account_source, |
| 84 |
collection_source, |
| 85 |
registry); |
| 86 |
e_mail_config_notebook_add_page (notebook, page); |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
static void |
| 91 |
e_mail_config_ews_notebook_class_init (EMailConfigEwsNotebookClass *class) |
| 92 |
{ |
| 93 |
GObjectClass *object_class; |
| 94 |
EExtensionClass *extension_class; |
| 95 |
|
| 96 |
object_class = G_OBJECT_CLASS (class); |
| 97 |
object_class->constructed = mail_config_ews_notebook_constructed; |
| 98 |
|
| 99 |
extension_class = E_EXTENSION_CLASS (class); |
| 100 |
extension_class->extensible_type = E_TYPE_MAIL_CONFIG_NOTEBOOK; |
| 101 |
} |
| 102 |
|
| 103 |
static void |
| 104 |
e_mail_config_ews_notebook_class_finalize (EMailConfigEwsNotebookClass *class) |
| 105 |
{ |
| 106 |
} |
| 107 |
|
| 108 |
static void |
| 109 |
e_mail_config_ews_notebook_init (EMailConfigEwsNotebook *extension) |
| 110 |
{ |
| 111 |
} |
| 112 |
|
| 113 |
void |
| 114 |
e_mail_config_ews_notebook_type_register (GTypeModule *type_module) |
| 115 |
{ |
| 116 |
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration |
| 117 |
* function, so we have to wrap it with a public function in |
| 118 |
* order to register types from a separate compilation unit. */ |
| 119 |
e_mail_config_ews_notebook_register_type (type_module); |
| 120 |
} |
| 121 |
|