No issues found
Tool | Failure ID | Location | Function | Message | Data |
---|---|---|---|---|---|
clang-analyzer | no-output-found | e-mail-config-confirm-page.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None | |
clang-analyzer | no-output-found | e-mail-config-confirm-page.c | Message(text='Unable to locate XML output from invoke-clang-analyzer') | None |
1 /*
2 * e-mail-config-confirm-page.h
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 "e-mail-config-confirm-page.h"
20
21 #include <config.h>
22 #include <glib/gi18n-lib.h>
23
24 #include <libebackend/libebackend.h>
25
26 #define E_MAIL_CONFIG_CONFIRM_PAGE_GET_PRIVATE(obj) \
27 (G_TYPE_INSTANCE_GET_PRIVATE \
28 ((obj), E_TYPE_MAIL_CONFIG_CONFIRM_PAGE, EMailConfigConfirmPagePrivate))
29
30 struct _EMailConfigConfirmPagePrivate {
31 gchar *text;
32 };
33
34 enum {
35 PROP_0,
36 PROP_TEXT
37 };
38
39 /* Forward Declarations */
40 static void e_mail_config_confirm_page_interface_init
41 (EMailConfigPageInterface *interface);
42
43 G_DEFINE_TYPE_WITH_CODE (
44 EMailConfigConfirmPage,
45 e_mail_config_confirm_page,
46 GTK_TYPE_BOX,
47 G_IMPLEMENT_INTERFACE (
48 E_TYPE_EXTENSIBLE, NULL)
49 G_IMPLEMENT_INTERFACE (
50 E_TYPE_MAIL_CONFIG_PAGE,
51 e_mail_config_confirm_page_interface_init))
52
53 static void
54 mail_config_confirm_page_set_property (GObject *object,
55 guint property_id,
56 const GValue *value,
57 GParamSpec *pspec)
58 {
59 switch (property_id) {
60 case PROP_TEXT:
61 e_mail_config_confirm_page_set_text (
62 E_MAIL_CONFIG_CONFIRM_PAGE (object),
63 g_value_get_string (value));
64 return;
65 }
66
67 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
68 }
69
70 static void
71 mail_config_confirm_page_get_property (GObject *object,
72 guint property_id,
73 GValue *value,
74 GParamSpec *pspec)
75 {
76 switch (property_id) {
77 case PROP_TEXT:
78 g_value_set_string (
79 value,
80 e_mail_config_confirm_page_get_text (
81 E_MAIL_CONFIG_CONFIRM_PAGE (object)));
82 return;
83 }
84
85 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
86 }
87
88 static void
89 mail_config_confirm_page_finalize (GObject *object)
90 {
91 EMailConfigConfirmPagePrivate *priv;
92
93 priv = E_MAIL_CONFIG_CONFIRM_PAGE_GET_PRIVATE (object);
94
95 g_free (priv->text);
96
97 /* Chain up to parent's finalize() method. */
98 G_OBJECT_CLASS (e_mail_config_confirm_page_parent_class)->
99 finalize (object);
100 }
101
102 static void
103 mail_config_confirm_page_constructed (GObject *object)
104 {
105 EMailConfigConfirmPage *page;
106 GtkWidget *widget;
107
108 page = E_MAIL_CONFIG_CONFIRM_PAGE (object);
109
110 /* Chain up to parent's constructed() method. */
111 G_OBJECT_CLASS (e_mail_config_confirm_page_parent_class)->
112 constructed (object);
113
114 gtk_orientable_set_orientation (
115 GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL);
116
117 gtk_box_set_spacing (GTK_BOX (page), 12);
118
119 gtk_widget_set_valign (GTK_WIDGET (page), GTK_ALIGN_CENTER);
120
121 widget = gtk_label_new (NULL);
122 gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
123 gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
124 gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
125 gtk_widget_show (widget);
126
127 g_object_bind_property (
128 page, "text",
129 widget, "label",
130 G_BINDING_BIDIRECTIONAL |
131 G_BINDING_SYNC_CREATE);
132
133 e_extensible_load_extensions (E_EXTENSIBLE (page));
134 }
135
136 static void
137 e_mail_config_confirm_page_class_init (EMailConfigConfirmPageClass *class)
138 {
139 GObjectClass *object_class;
140
141 g_type_class_add_private (
142 class, sizeof (EMailConfigConfirmPagePrivate));
143
144 object_class = G_OBJECT_CLASS (class);
145 object_class->set_property = mail_config_confirm_page_set_property;
146 object_class->get_property = mail_config_confirm_page_get_property;
147 object_class->finalize = mail_config_confirm_page_finalize;
148 object_class->constructed = mail_config_confirm_page_constructed;
149
150 g_object_class_install_property (
151 object_class,
152 PROP_TEXT,
153 g_param_spec_string (
154 "text",
155 "Text",
156 "Confirmation message",
157 _("Congratulations, your mail configuration is "
158 "complete.\n\nYou are now ready to send and "
159 "receive email using Evolution.\n\nClick "
160 "\"Apply\" to save your settings."),
161 G_PARAM_READWRITE |
162 G_PARAM_CONSTRUCT |
163 G_PARAM_STATIC_STRINGS));
164 }
165
166 static void
167 e_mail_config_confirm_page_interface_init (EMailConfigPageInterface *interface)
168 {
169 interface->title = _("Done");
170 interface->page_type = GTK_ASSISTANT_PAGE_CONFIRM;
171 interface->sort_order = E_MAIL_CONFIG_CONFIRM_PAGE_SORT_ORDER;
172 }
173
174 static void
175 e_mail_config_confirm_page_init (EMailConfigConfirmPage *page)
176 {
177 page->priv = E_MAIL_CONFIG_CONFIRM_PAGE_GET_PRIVATE (page);
178 }
179
180 EMailConfigPage *
181 e_mail_config_confirm_page_new (void)
182 {
183 return g_object_new (E_TYPE_MAIL_CONFIG_CONFIRM_PAGE, NULL);
184 }
185
186 const gchar *
187 e_mail_config_confirm_page_get_text (EMailConfigConfirmPage *page)
188 {
189 g_return_val_if_fail (E_IS_MAIL_CONFIG_CONFIRM_PAGE (page), NULL);
190
191 return page->priv->text;
192 }
193
194 void
195 e_mail_config_confirm_page_set_text (EMailConfigConfirmPage *page,
196 const gchar *text)
197 {
198 g_return_if_fail (E_IS_MAIL_CONFIG_CONFIRM_PAGE (page));
199
200 if (g_strcmp0 (page->priv->text, (text != NULL) ? text : "") == 0)
201 return;
202
203 g_free (page->priv->text);
204 page->priv->text = g_strdup ((text != NULL) ? text : "");
205
206 g_object_notify (G_OBJECT (page), "text");
207 }