"Fossies" - the Fresh Open Source Software Archive 
Member "evolution-mapi-3.46.1/src/configuration/e-mail-config-mapi-offline-options.c" (2 Dec 2022, 4475 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-offline-options.c" see the
Fossies "Dox" file reference documentation.
1 /*
2 * Copyright (C) 2016 Red Hat, Inc. (www.redhat.com)
3 *
4 * This library is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #include "evolution-mapi-config.h"
18
19 #include <libebackend/libebackend.h>
20 #include <libedataserver/libedataserver.h>
21
22 #include <e-util/e-util.h>
23 #include <mail/e-mail-config-provider-page.h>
24
25 #include "e-mail-config-mapi-offline-options.h"
26
27 /* Standard GObject macros */
28 #define E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS \
29 (e_mail_config_mapi_offline_options_get_type ())
30 #define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS(obj) \
31 (G_TYPE_CHECK_INSTANCE_CAST \
32 ((obj), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS, EMailConfigMapiOfflineOptions))
33 #define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_CLASS(cls) \
34 (G_TYPE_CHECK_CLASS_CAST \
35 ((cls), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS, EMailConfigMapiOfflineOptionsClass))
36 #define E_IS_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS(obj) \
37 (G_TYPE_CHECK_INSTANCE_TYPE \
38 ((obj), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS))
39 #define E_IS_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_CLASS(cls) \
40 (G_TYPE_CHECK_CLASS_TYPE \
41 ((cls), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS))
42 #define E_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS_GET_CLASS(obj) \
43 (G_TYPE_INSTANCE_GET_CLASS \
44 ((obj), E_TYPE_MAIL_CONFIG_MAPI_OFFLINE_OPTIONS, EMailConfigMapiOfflineOptionsClass))
45
46 typedef struct _EMailConfigMapiOfflineOptions EMailConfigMapiOfflineOptions;
47 typedef struct _EMailConfigMapiOfflineOptionsClass EMailConfigMapiOfflineOptionsClass;
48
49 struct _EMailConfigMapiOfflineOptions {
50 EExtension parent;
51 };
52
53 struct _EMailConfigMapiOfflineOptionsClass {
54 EExtensionClass parent_class;
55 };
56
57 GType e_mail_config_mapi_offline_options_get_type
58 (void) G_GNUC_CONST;
59
60 G_DEFINE_DYNAMIC_TYPE (EMailConfigMapiOfflineOptions, e_mail_config_mapi_offline_options, E_TYPE_EXTENSION)
61
62 static void
63 mail_config_mapi_offline_options_constructed (GObject *object)
64 {
65 EMailConfigProviderPage *provider_page;
66 EMailConfigServiceBackend *backend;
67 CamelProvider *provider;
68 CamelSettings *settings;
69 GtkBox *placeholder;
70 GtkWidget *hbox;
71
72 /* Chain up to parent's constructed() method. */
73 G_OBJECT_CLASS (e_mail_config_mapi_offline_options_parent_class)->constructed (object);
74
75 provider_page = E_MAIL_CONFIG_PROVIDER_PAGE (e_extension_get_extensible (E_EXTENSION (object)));
76 backend = e_mail_config_provider_page_get_backend (provider_page);
77 provider = e_mail_config_service_backend_get_provider (backend);
78 settings = e_mail_config_service_backend_get_settings (backend);
79
80 if (e_mail_config_provider_page_is_empty (provider_page) ||
81 !provider || g_strcmp0 (provider->protocol, "mapi") != 0)
82 return;
83
84 g_return_if_fail (CAMEL_IS_OFFLINE_SETTINGS (settings));
85
86 placeholder = e_mail_config_provider_page_get_placeholder (provider_page, "mapi-limit-by-age-placeholder");
87 g_return_if_fail (placeholder != NULL);
88
89 hbox = e_dialog_offline_settings_new_limit_box (CAMEL_OFFLINE_SETTINGS (settings));
90 gtk_box_pack_start (placeholder, hbox, FALSE, FALSE, 0);
91 gtk_widget_show (hbox);
92 }
93
94 static void
95 e_mail_config_mapi_offline_options_class_init (EMailConfigMapiOfflineOptionsClass *class)
96 {
97 GObjectClass *object_class;
98 EExtensionClass *extension_class;
99
100 object_class = G_OBJECT_CLASS (class);
101 object_class->constructed = mail_config_mapi_offline_options_constructed;
102
103 extension_class = E_EXTENSION_CLASS (class);
104 extension_class->extensible_type = E_TYPE_MAIL_CONFIG_PROVIDER_PAGE;
105 }
106
107 static void
108 e_mail_config_mapi_offline_options_class_finalize (EMailConfigMapiOfflineOptionsClass *class)
109 {
110 }
111
112 static void
113 e_mail_config_mapi_offline_options_init (EMailConfigMapiOfflineOptions *extension)
114 {
115 }
116
117 void
118 e_mail_config_mapi_offline_options_type_register (GTypeModule *type_module)
119 {
120 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
121 * function, so we have to wrap it with a public function in
122 * order to register types from a separate compilation unit. */
123 e_mail_config_mapi_offline_options_register_type (type_module);
124 }