"Fossies" - the Fresh Open Source Software Archive 
Member "evolution-mapi-3.46.1/src/configuration/e-mail-config-mapi-extension.c" (2 Dec 2022, 3716 Bytes) of package /linux/misc/evolution-mapi-3.46.1.tar.xz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "e-mail-config-mapi-extension.c" see the
Fossies "Dox" file reference documentation.
1 /*
2 * e-mail-config-mapi-extension.c
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with the program; if not, see <http://www.gnu.org/licenses/>
16 *
17 */
18
19 #include "evolution-mapi-config.h"
20
21 #include <mail/e-mail-config-notebook.h>
22
23 #include "e-mail-config-mapi-page.h"
24 #include "camel-mapi-settings.h"
25
26 #include "e-mail-config-mapi-extension.h"
27
28 G_DEFINE_DYNAMIC_TYPE (
29 EMailConfigMapiExtension,
30 e_mail_config_mapi_extension,
31 E_TYPE_EXTENSION)
32
33 static void
34 e_mail_config_mapi_extension_constructed (GObject *object)
35 {
36 EExtension *extension;
37 EExtensible *extensible;
38 ESource *source;
39 ESourceBackend *backend_ext;
40 EMailConfigNotebook *notebook;
41 const gchar *backend_name;
42 const gchar *extension_name;
43
44 extension = E_EXTENSION (object);
45 extensible = e_extension_get_extensible (extension);
46
47 /* Chain up to parent's constructed() method. */
48 G_OBJECT_CLASS (e_mail_config_mapi_extension_parent_class)->constructed (object);
49
50 notebook = E_MAIL_CONFIG_NOTEBOOK (extensible);
51 source = e_mail_config_notebook_get_account_source (notebook);
52
53 extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
54 backend_ext = e_source_get_extension (source, extension_name);
55 backend_name = e_source_backend_get_backend_name (backend_ext);
56
57 if (g_strcmp0 (backend_name, "mapi") == 0) {
58 ESource *profile_source;
59 ESourceCamel *camel_ext;
60 ESourceRegistry *registry;
61 EMailSession *mail_session;
62 CamelSettings *settings;
63 const gchar *profile;
64
65 mail_session = e_mail_config_notebook_get_session (notebook);
66 registry = e_mail_session_get_registry (mail_session);
67
68 if (e_source_get_parent (source))
69 profile_source = e_source_registry_ref_source (registry, e_source_get_parent (source));
70 else
71 profile_source = g_object_ref (source);
72
73 camel_ext = e_source_get_extension (profile_source, e_source_camel_get_extension_name (backend_name));
74 settings = e_source_camel_get_settings (camel_ext);
75 profile = camel_mapi_settings_get_profile (CAMEL_MAPI_SETTINGS (settings));
76
77 /* add page only when editing already configured accounts */
78 if (profile && *profile) {
79 EMailConfigPage *page;
80
81 page = e_mail_config_mapi_page_new (source, registry);
82 e_mail_config_notebook_add_page (notebook, page);
83 }
84
85 g_object_unref (profile_source);
86 }
87 }
88
89 static void
90 e_mail_config_mapi_extension_class_init (EMailConfigMapiExtensionClass *class)
91 {
92 GObjectClass *object_class;
93 EExtensionClass *extension_class;
94
95 object_class = G_OBJECT_CLASS (class);
96 object_class->constructed = e_mail_config_mapi_extension_constructed;
97
98 extension_class = E_EXTENSION_CLASS (class);
99 extension_class->extensible_type = E_TYPE_MAIL_CONFIG_NOTEBOOK;
100 }
101
102 static void
103 e_mail_config_mapi_extension_class_finalize (EMailConfigMapiExtensionClass *class)
104 {
105 }
106
107 static void
108 e_mail_config_mapi_extension_init (EMailConfigMapiExtension *extension)
109 {
110 }
111
112 void
113 e_mail_config_mapi_extension_type_register (GTypeModule *type_module)
114 {
115 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
116 * function, so we have to wrap it with a public function in
117 * order to register types from a separate compilation unit. */
118 e_mail_config_mapi_extension_register_type (type_module);
119 }