evolution-3.6.4/mail/e-mail-config-welcome-page.c

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-config-welcome-page.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-config-welcome-page.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
Failure running clang-analyzer ('no-output-found')
Message
Unable to locate XML output from invoke-clang-analyzer
  1 /*
  2  * e-mail-config-welcome-page.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 "e-mail-config-welcome-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_WELCOME_PAGE_GET_PRIVATE(obj) \
 27 	(G_TYPE_INSTANCE_GET_PRIVATE \
 28 	((obj), E_TYPE_MAIL_CONFIG_WELCOME_PAGE, EMailConfigWelcomePagePrivate))
 29 
 30 struct _EMailConfigWelcomePagePrivate {
 31 	gchar *text;
 32 };
 33 
 34 enum {
 35 	PROP_0,
 36 	PROP_TEXT
 37 };
 38 
 39 /* Forward Declarations */
 40 static void	e_mail_config_welcome_page_interface_init
 41 					(EMailConfigPageInterface *interface);
 42 
 43 G_DEFINE_TYPE_WITH_CODE (
 44 	EMailConfigWelcomePage,
 45 	e_mail_config_welcome_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_welcome_page_interface_init))
 52 
 53 static void
 54 mail_config_welcome_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_welcome_page_set_text (
 62 				E_MAIL_CONFIG_WELCOME_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_welcome_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_welcome_page_get_text (
 81 				E_MAIL_CONFIG_WELCOME_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_welcome_page_finalize (GObject *object)
 90 {
 91 	EMailConfigWelcomePagePrivate *priv;
 92 
 93 	priv = E_MAIL_CONFIG_WELCOME_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_welcome_page_parent_class)->
 99 		finalize (object);
100 }
101 
102 static void
103 mail_config_welcome_page_constructed (GObject *object)
104 {
105 	EMailConfigWelcomePage *page;
106 	GtkWidget *widget;
107 
108 	page = E_MAIL_CONFIG_WELCOME_PAGE (object);
109 
110 	/* Chain up to parent's constructed() method. */
111 	G_OBJECT_CLASS (e_mail_config_welcome_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_welcome_page_class_init (EMailConfigWelcomePageClass *class)
138 {
139 	GObjectClass *object_class;
140 
141 	g_type_class_add_private (
142 		class, sizeof (EMailConfigWelcomePagePrivate));
143 
144 	object_class = G_OBJECT_CLASS (class);
145 	object_class->set_property = mail_config_welcome_page_set_property;
146 	object_class->get_property = mail_config_welcome_page_get_property;
147 	object_class->finalize = mail_config_welcome_page_finalize;
148 	object_class->constructed = mail_config_welcome_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 			"Welcome message",
157 			_("Welcome to the Evolution Mail Configuration "
158 			"Assistant.\n\nClick \"Continue\" to begin."),
159 			G_PARAM_READWRITE |
160 			G_PARAM_CONSTRUCT |
161 			G_PARAM_STATIC_STRINGS));
162 }
163 
164 static void
165 e_mail_config_welcome_page_interface_init (EMailConfigPageInterface *interface)
166 {
167 	interface->title = _("Welcome");
168 	interface->page_type = GTK_ASSISTANT_PAGE_INTRO;
169 	interface->sort_order = E_MAIL_CONFIG_WELCOME_PAGE_SORT_ORDER;
170 }
171 
172 static void
173 e_mail_config_welcome_page_init (EMailConfigWelcomePage *page)
174 {
175 	page->priv = E_MAIL_CONFIG_WELCOME_PAGE_GET_PRIVATE (page);
176 }
177 
178 EMailConfigPage *
179 e_mail_config_welcome_page_new (void)
180 {
181 	return g_object_new (E_TYPE_MAIL_CONFIG_WELCOME_PAGE, NULL);
182 }
183 
184 const gchar *
185 e_mail_config_welcome_page_get_text (EMailConfigWelcomePage *page)
186 {
187 	g_return_val_if_fail (E_IS_MAIL_CONFIG_WELCOME_PAGE (page), NULL);
188 
189 	return page->priv->text;
190 }
191 
192 void
193 e_mail_config_welcome_page_set_text (EMailConfigWelcomePage *page,
194                                      const gchar *text)
195 {
196 	g_return_if_fail (E_IS_MAIL_CONFIG_WELCOME_PAGE (page));
197 
198 	if (g_strcmp0 (page->priv->text, (text != NULL) ? text : "") == 0)
199 		return;
200 
201 	g_free (page->priv->text);
202 	page->priv->text = g_strdup ((text != NULL) ? text : "");
203 
204 	g_object_notify (G_OBJECT (page), "text");
205 }