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

No issues found

Incomplete coverage

Tool Failure ID Location Function Message Data
clang-analyzer no-output-found e-mail-config-identity-page.c Message(text='Unable to locate XML output from invoke-clang-analyzer') None
clang-analyzer no-output-found e-mail-config-identity-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-identity-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-identity-page.h"
 20 
 21 #include <config.h>
 22 #include <glib/gi18n-lib.h>
 23 
 24 #include <libebackend/libebackend.h>
 25 
 26 #include <e-util/e-marshal.h>
 27 #include <misc/e-mail-signature-combo-box.h>
 28 #include <misc/e-mail-signature-editor.h>
 29 
 30 #define E_MAIL_CONFIG_IDENTITY_PAGE_GET_PRIVATE(obj) \
 31 	(G_TYPE_INSTANCE_GET_PRIVATE \
 32 	((obj), E_TYPE_MAIL_CONFIG_IDENTITY_PAGE, EMailConfigIdentityPagePrivate))
 33 
 34 struct _EMailConfigIdentityPagePrivate {
 35 	ESource *identity_source;
 36 	ESourceRegistry *registry;
 37 	gboolean show_account_info;
 38 	gboolean show_email_address;
 39 	gboolean show_instructions;
 40 	gboolean show_signatures;
 41 };
 42 
 43 enum {
 44 	PROP_0,
 45 	PROP_IDENTITY_SOURCE,
 46 	PROP_REGISTRY,
 47 	PROP_SHOW_ACCOUNT_INFO,
 48 	PROP_SHOW_EMAIL_ADDRESS,
 49 	PROP_SHOW_INSTRUCTIONS,
 50 	PROP_SHOW_SIGNATURES
 51 };
 52 
 53 /* Forward Declarations */
 54 static void	e_mail_config_identity_page_interface_init
 55 					(EMailConfigPageInterface *interface);
 56 
 57 G_DEFINE_TYPE_WITH_CODE (
 58 	EMailConfigIdentityPage,
 59 	e_mail_config_identity_page,
 60 	GTK_TYPE_BOX,
 61 	G_IMPLEMENT_INTERFACE (
 62 		E_TYPE_EXTENSIBLE, NULL)
 63 	G_IMPLEMENT_INTERFACE (
 64 		E_TYPE_MAIL_CONFIG_PAGE,
 65 		e_mail_config_identity_page_interface_init))
 66 
 67 static gboolean
 68 mail_config_identity_page_is_email (const gchar *email_address)
 69 {
 70 	const gchar *cp;
 71 
 72 	/* Make sure we have a '@' between a name and domain part. */
 73 	cp = strchr (email_address, '@');
 74 
 75 	return (cp != NULL && cp != email_address && *(cp + 1) != '\0');
 76 }
 77 
 78 static void
 79 mail_config_identity_page_add_signature_cb (GtkButton *button,
 80                                             EMailConfigIdentityPage *page)
 81 {
 82 	ESourceRegistry *registry;
 83 	GtkWidget *editor;
 84 
 85 	registry = e_mail_config_identity_page_get_registry (page);
 86 
 87 	editor = e_mail_signature_editor_new (registry, NULL);
 88 	gtk_window_set_position (GTK_WINDOW (editor), GTK_WIN_POS_CENTER);
 89 	gtk_widget_show (editor);
 90 }
 91 
 92 static void
 93 mail_config_identity_page_set_registry (EMailConfigIdentityPage *page,
 94                                         ESourceRegistry *registry)
 95 {
 96 	g_return_if_fail (E_IS_SOURCE_REGISTRY (registry));
 97 	g_return_if_fail (page->priv->registry == NULL);
 98 
 99 	page->priv->registry = g_object_ref (registry);
100 }
101 
102 static void
103 mail_config_identity_page_set_identity_source (EMailConfigIdentityPage *page,
104                                                ESource *identity_source)
105 {
106 	g_return_if_fail (E_IS_SOURCE (identity_source));
107 	g_return_if_fail (page->priv->identity_source == NULL);
108 
109 	page->priv->identity_source = g_object_ref (identity_source);
110 }
111 
112 static void
113 mail_config_identity_page_set_property (GObject *object,
114                                         guint property_id,
115                                         const GValue *value,
116                                         GParamSpec *pspec)
117 {
118 	switch (property_id) {
119 		case PROP_IDENTITY_SOURCE:
120 			mail_config_identity_page_set_identity_source (
121 				E_MAIL_CONFIG_IDENTITY_PAGE (object),
122 				g_value_get_object (value));
123 			return;
124 
125 		case PROP_REGISTRY:
126 			mail_config_identity_page_set_registry (
127 				E_MAIL_CONFIG_IDENTITY_PAGE (object),
128 				g_value_get_object (value));
129 			return;
130 
131 		case PROP_SHOW_ACCOUNT_INFO:
132 			e_mail_config_identity_page_set_show_account_info (
133 				E_MAIL_CONFIG_IDENTITY_PAGE (object),
134 				g_value_get_boolean (value));
135 			return;
136 
137 		case PROP_SHOW_EMAIL_ADDRESS:
138 			e_mail_config_identity_page_set_show_email_address (
139 				E_MAIL_CONFIG_IDENTITY_PAGE (object),
140 				g_value_get_boolean (value));
141 			return;
142 
143 		case PROP_SHOW_INSTRUCTIONS:
144 			e_mail_config_identity_page_set_show_instructions (
145 				E_MAIL_CONFIG_IDENTITY_PAGE (object),
146 				g_value_get_boolean (value));
147 			return;
148 
149 		case PROP_SHOW_SIGNATURES:
150 			e_mail_config_identity_page_set_show_signatures (
151 				E_MAIL_CONFIG_IDENTITY_PAGE (object),
152 				g_value_get_boolean (value));
153 			return;
154 	}
155 
156 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
157 }
158 
159 static void
160 mail_config_identity_page_get_property (GObject *object,
161                                         guint property_id,
162                                         GValue *value,
163                                         GParamSpec *pspec)
164 {
165 	switch (property_id) {
166 		case PROP_IDENTITY_SOURCE:
167 			g_value_set_object (
168 				value,
169 				e_mail_config_identity_page_get_identity_source (
170 				E_MAIL_CONFIG_IDENTITY_PAGE (object)));
171 			return;
172 
173 		case PROP_REGISTRY:
174 			g_value_set_object (
175 				value,
176 				e_mail_config_identity_page_get_registry (
177 				E_MAIL_CONFIG_IDENTITY_PAGE (object)));
178 			return;
179 
180 		case PROP_SHOW_ACCOUNT_INFO:
181 			g_value_set_boolean (
182 				value,
183 				e_mail_config_identity_page_get_show_account_info (
184 				E_MAIL_CONFIG_IDENTITY_PAGE (object)));
185 			return;
186 
187 		case PROP_SHOW_EMAIL_ADDRESS:
188 			g_value_set_boolean (
189 				value,
190 				e_mail_config_identity_page_get_show_email_address (
191 				E_MAIL_CONFIG_IDENTITY_PAGE (object)));
192 			return;
193 
194 		case PROP_SHOW_INSTRUCTIONS:
195 			g_value_set_boolean (
196 				value,
197 				e_mail_config_identity_page_get_show_instructions (
198 				E_MAIL_CONFIG_IDENTITY_PAGE (object)));
199 			return;
200 
201 		case PROP_SHOW_SIGNATURES:
202 			g_value_set_boolean (
203 				value,
204 				e_mail_config_identity_page_get_show_signatures (
205 				E_MAIL_CONFIG_IDENTITY_PAGE (object)));
206 			return;
207 	}
208 
209 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
210 }
211 
212 static void
213 mail_config_identity_page_dispose (GObject *object)
214 {
215 	EMailConfigIdentityPagePrivate *priv;
216 
217 	priv = E_MAIL_CONFIG_IDENTITY_PAGE_GET_PRIVATE (object);
218 
219 	if (priv->identity_source != NULL) {
220 		g_object_unref (priv->identity_source);
221 		priv->identity_source = NULL;
222 	}
223 
224 	if (priv->registry != NULL) {
225 		g_object_unref (priv->registry);
226 		priv->registry = NULL;
227 	}
228 
229 	/* Chain up to parent's dispose() method. */
230 	G_OBJECT_CLASS (e_mail_config_identity_page_parent_class)->
231 		dispose (object);
232 }
233 
234 static void
235 mail_config_identity_page_constructed (GObject *object)
236 {
237 	EMailConfigIdentityPage *page;
238 	ESource *source;
239 	ESourceRegistry *registry;
240 	ESourceMailIdentity *extension;
241 	GtkLabel *label;
242 	GtkWidget *widget;
243 	GtkWidget *container;
244 	GtkSizeGroup *size_group;
245 	const gchar *extension_name;
246 	const gchar *text;
247 	gchar *markup;
248 
249 	page = E_MAIL_CONFIG_IDENTITY_PAGE (object);
250 
251 	/* Chain up to parent's constructed() method. */
252 	G_OBJECT_CLASS (e_mail_config_identity_page_parent_class)->
253 		constructed (object);
254 
255 	extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
256 	registry = e_mail_config_identity_page_get_registry (page);
257 	source = e_mail_config_identity_page_get_identity_source (page);
258 	extension = e_source_get_extension (source, extension_name);
259 
260 	gtk_orientable_set_orientation (
261 		GTK_ORIENTABLE (page), GTK_ORIENTATION_VERTICAL);
262 
263 	gtk_box_set_spacing (GTK_BOX (page), 12);
264 
265 	/* This keeps all mnemonic labels the same width. */
266 	size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
267 
268 	text = _("Please enter your name and email address below. "
269 		 "The \"optional\" fields below do not need to be filled "
270 		 "in, unless you wish to include this information in email "
271 		 "you send.");
272 	widget = gtk_label_new (text);
273 	gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
274 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
275 	gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
276 
277 	g_object_bind_property (
278 		page, "show-instructions",
279 		widget, "visible",
280 		G_BINDING_SYNC_CREATE);
281 
282 	/*** Account Information ***/
283 
284 	widget = gtk_grid_new ();
285 	gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
286 	gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
287 	gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
288 
289 	g_object_bind_property (
290 		page, "show-account-info",
291 		widget, "visible",
292 		G_BINDING_SYNC_CREATE);
293 
294 	container = widget;
295 
296 	text = _("Account Information");
297 	markup = g_markup_printf_escaped ("<b>%s</b>", text);
298 	widget = gtk_label_new (markup);
299 	gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
300 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
301 	gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 2, 1);
302 	gtk_widget_show (widget);
303 	g_free (markup);
304 
305 	text = _("Type the name by which you would like to refer to "
306 		 "this account.\nFor example, \"Work\" or \"Personal\".");
307 	widget = gtk_label_new (text);
308 	gtk_widget_set_margin_left (widget, 12);
309 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
310 	gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 2, 1);
311 	gtk_widget_show (widget);
312 
313 	text = _("_Name:");
314 	widget = gtk_label_new_with_mnemonic (text);
315 	gtk_widget_set_margin_left (widget, 12);
316 	gtk_size_group_add_widget (size_group, widget);
317 	gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
318 	gtk_grid_attach (GTK_GRID (container), widget, 0, 2, 1, 1);
319 	gtk_widget_show (widget);
320 
321 	label = GTK_LABEL (widget);
322 
323 	widget = gtk_entry_new ();
324 	gtk_widget_set_hexpand (widget, TRUE);
325 	gtk_label_set_mnemonic_widget (label, widget);
326 	gtk_grid_attach (GTK_GRID (container), widget, 1, 2, 1, 1);
327 	gtk_widget_show (widget);
328 
329 	g_object_bind_property (
330 		source, "display-name",
331 		widget, "text",
332 		G_BINDING_BIDIRECTIONAL |
333 		G_BINDING_SYNC_CREATE);
334 
335 	/* This entry affects the "check-complete" result. */
336 	g_signal_connect_swapped (
337 		widget, "changed",
338 		G_CALLBACK (e_mail_config_page_changed), page);
339 
340 	/*** Required Information ***/
341 
342 	widget = gtk_grid_new ();
343 	gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
344 	gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
345 	gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
346 	gtk_widget_show (widget);
347 
348 	container = widget;
349 
350 	text = _("Required Information");
351 	markup = g_markup_printf_escaped ("<b>%s</b>", text);
352 	widget = gtk_label_new (markup);
353 	gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
354 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
355 	gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 2, 1);
356 	gtk_widget_show (widget);
357 	g_free (markup);
358 
359 	text = _("Full Nam_e:");
360 	widget = gtk_label_new_with_mnemonic (text);
361 	gtk_widget_set_margin_left (widget, 12);
362 	gtk_size_group_add_widget (size_group, widget);
363 	gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
364 	gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
365 	gtk_widget_show (widget);
366 
367 	label = GTK_LABEL (widget);
368 
369 	widget = gtk_entry_new ();
370 	gtk_widget_set_hexpand (widget, TRUE);
371 	gtk_label_set_mnemonic_widget (label, widget);
372 	gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 1, 1);
373 	gtk_widget_show (widget);
374 
375 	g_object_bind_property (
376 		extension, "name",
377 		widget, "text",
378 		G_BINDING_BIDIRECTIONAL |
379 		G_BINDING_SYNC_CREATE);
380 
381 	/* This entry affects the "check-complete" result. */
382 	g_signal_connect_swapped (
383 		widget, "changed",
384 		G_CALLBACK (e_mail_config_page_changed), page);
385 
386 	text = _("Email _Address:");
387 	widget = gtk_label_new_with_mnemonic (text);
388 	gtk_widget_set_margin_left (widget, 12);
389 	gtk_size_group_add_widget (size_group, widget);
390 	gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
391 	gtk_grid_attach (GTK_GRID (container), widget, 0, 2, 1, 1);
392 	gtk_widget_show (widget);
393 
394 	g_object_bind_property (
395 		page, "show-email-address",
396 		widget, "visible",
397 		G_BINDING_SYNC_CREATE);
398 
399 	label = GTK_LABEL (widget);
400 
401 	widget = gtk_entry_new ();
402 	gtk_widget_set_hexpand (widget, TRUE);
403 	gtk_label_set_mnemonic_widget (label, widget);
404 	gtk_grid_attach (GTK_GRID (container), widget, 1, 2, 1, 1);
405 	gtk_widget_show (widget);
406 
407 	g_object_bind_property (
408 		extension, "address",
409 		widget, "text",
410 		G_BINDING_BIDIRECTIONAL |
411 		G_BINDING_SYNC_CREATE);
412 
413 	g_object_bind_property (
414 		page, "show-email-address",
415 		widget, "visible",
416 		G_BINDING_SYNC_CREATE);
417 
418 	/* This entry affects the "check-complete" result. */
419 	g_signal_connect_swapped (
420 		widget, "changed",
421 		G_CALLBACK (e_mail_config_page_changed), page);
422 
423 	/*** Optional Information ***/
424 
425 	widget = gtk_grid_new ();
426 	gtk_grid_set_row_spacing (GTK_GRID (widget), 6);
427 	gtk_grid_set_column_spacing (GTK_GRID (widget), 6);
428 	gtk_box_pack_start (GTK_BOX (page), widget, FALSE, FALSE, 0);
429 	gtk_widget_show (widget);
430 
431 	container = widget;
432 
433 	text = _("Optional Information");
434 	markup = g_markup_printf_escaped ("<b>%s</b>", text);
435 	widget = gtk_label_new (markup);
436 	gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
437 	gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
438 	gtk_grid_attach (GTK_GRID (container), widget, 0, 0, 3, 1);
439 	gtk_widget_show (widget);
440 
441 	text = _("Re_ply-To:");
442 	widget = gtk_label_new_with_mnemonic (text);
443 	gtk_widget_set_margin_left (widget, 12);
444 	gtk_size_group_add_widget (size_group, widget);
445 	gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
446 	gtk_grid_attach (GTK_GRID (container), widget, 0, 1, 1, 1);
447 	gtk_widget_show (widget);
448 
449 	label = GTK_LABEL (widget);
450 
451 	widget = gtk_entry_new ();
452 	gtk_widget_set_hexpand (widget, TRUE);
453 	gtk_label_set_mnemonic_widget (label, widget);
454 	gtk_grid_attach (GTK_GRID (container), widget, 1, 1, 2, 1);
455 	gtk_widget_show (widget);
456 
457 	g_object_bind_property (
458 		extension, "reply-to",
459 		widget, "text",
460 		G_BINDING_BIDIRECTIONAL |
461 		G_BINDING_SYNC_CREATE);
462 
463 	/* This entry affects the "check-complete" result. */
464 	g_signal_connect_swapped (
465 		widget, "changed",
466 		G_CALLBACK (e_mail_config_page_changed), page);
467 
468 	text = _("Or_ganization:");
469 	widget = gtk_label_new_with_mnemonic (text);
470 	gtk_widget_set_margin_left (widget, 12);
471 	gtk_size_group_add_widget (size_group, widget);
472 	gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
473 	gtk_grid_attach (GTK_GRID (container), widget, 0, 2, 1, 1);
474 	gtk_widget_show (widget);
475 
476 	label = GTK_LABEL (widget);
477 
478 	widget = gtk_entry_new ();
479 	gtk_widget_set_hexpand (widget, TRUE);
480 	gtk_label_set_mnemonic_widget (label, widget);
481 	gtk_grid_attach (GTK_GRID (container), widget, 1, 2, 2, 1);
482 	gtk_widget_show (widget);
483 
484 	g_object_bind_property (
485 		extension, "organization",
486 		widget, "text",
487 		G_BINDING_BIDIRECTIONAL |
488 		G_BINDING_SYNC_CREATE);
489 
490 	text = _("Si_gnature:");
491 	widget = gtk_label_new_with_mnemonic (text);
492 	gtk_widget_set_margin_left (widget, 12);
493 	gtk_size_group_add_widget (size_group, widget);
494 	gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5);
495 	gtk_grid_attach (GTK_GRID (container), widget, 0, 3, 1, 1);
496 	gtk_widget_show (widget);
497 
498 	g_object_bind_property (
499 		page, "show-signatures",
500 		widget, "visible",
501 		G_BINDING_SYNC_CREATE);
502 
503 	label = GTK_LABEL (widget);
504 
505 	widget = e_mail_signature_combo_box_new (registry);
506 	gtk_widget_set_hexpand (widget, TRUE);
507 	gtk_widget_set_halign (widget, GTK_ALIGN_START);
508 	gtk_label_set_mnemonic_widget (label, widget);
509 	gtk_grid_attach (GTK_GRID (container), widget, 1, 3, 1, 1);
510 	gtk_widget_show (widget);
511 
512 	g_object_bind_property (
513 		extension, "signature-uid",
514 		widget, "active-id",
515 		G_BINDING_BIDIRECTIONAL |
516 		G_BINDING_SYNC_CREATE);
517 
518 	g_object_bind_property (
519 		page, "show-signatures",
520 		widget, "visible",
521 		G_BINDING_SYNC_CREATE);
522 
523 	text = _("Add Ne_w Signature...");
524 	widget = gtk_button_new_with_mnemonic (text);
525 	gtk_grid_attach (GTK_GRID (container), widget, 2, 3, 1, 1);
526 	gtk_widget_show (widget);
527 
528 	g_object_bind_property (
529 		page, "show-signatures",
530 		widget, "visible",
531 		G_BINDING_SYNC_CREATE);
532 
533 	g_signal_connect (
534 		widget, "clicked",
535 		G_CALLBACK (mail_config_identity_page_add_signature_cb), page);
536 
537 	g_object_unref (size_group);
538 
539 	e_extensible_load_extensions (E_EXTENSIBLE (page));
540 }
541 
542 static gboolean
543 mail_config_identity_page_check_complete (EMailConfigPage *page)
544 {
545 	EMailConfigIdentityPage *id_page;
546 	ESource *source;
547 	ESourceMailIdentity *extension;
548 	const gchar *extension_name;
549 	const gchar *name;
550 	const gchar *address;
551 	const gchar *reply_to;
552 	const gchar *display_name;
553 
554 	id_page = E_MAIL_CONFIG_IDENTITY_PAGE (page);
555 	extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
556 	source = e_mail_config_identity_page_get_identity_source (id_page);
557 	extension = e_source_get_extension (source, extension_name);
558 
559 	name = e_source_mail_identity_get_name (extension);
560 	address = e_source_mail_identity_get_address (extension);
561 	reply_to = e_source_mail_identity_get_reply_to (extension);
562 
563 	display_name = e_source_get_display_name (source);
564 
565 	if (name == NULL)
566 		return FALSE;
567 
568 	/* Only enforce when the email address is visible. */
569 	if (e_mail_config_identity_page_get_show_email_address (id_page)) {
570 		if (address == NULL)
571 			return FALSE;
572 
573 		if (!mail_config_identity_page_is_email (address))
574 			return FALSE;
575 	}
576 
577 	/* A NULL reply_to string is allowed. */
578 	if (reply_to != NULL && !mail_config_identity_page_is_email (reply_to))
579 		return FALSE;
580 
581 	/* Only enforce when account information is visible. */
582 	if (e_mail_config_identity_page_get_show_account_info (id_page))
583 		if (display_name == NULL || *display_name == '\0')
584 			return FALSE;
585 
586 	return TRUE;
587 }
588 
589 static void
590 e_mail_config_identity_page_class_init (EMailConfigIdentityPageClass *class)
591 {
592 	GObjectClass *object_class;
593 
594 	g_type_class_add_private (
595 		class, sizeof (EMailConfigIdentityPagePrivate));
596 
597 	object_class = G_OBJECT_CLASS (class);
598 	object_class->set_property = mail_config_identity_page_set_property;
599 	object_class->get_property = mail_config_identity_page_get_property;
600 	object_class->dispose = mail_config_identity_page_dispose;
601 	object_class->constructed = mail_config_identity_page_constructed;
602 
603 	g_object_class_install_property (
604 		object_class,
605 		PROP_REGISTRY,
606 		g_param_spec_object (
607 			"registry",
608 			"Registry",
609 			"Registry of data sources",
610 			E_TYPE_SOURCE_REGISTRY,
611 			G_PARAM_READWRITE |
612 			G_PARAM_CONSTRUCT_ONLY |
613 			G_PARAM_STATIC_STRINGS));
614 
615 	g_object_class_install_property (
616 		object_class,
617 		PROP_IDENTITY_SOURCE,
618 		g_param_spec_object (
619 			"identity-source",
620 			"Identity Source",
621 			"Mail identity source being edited",
622 			E_TYPE_SOURCE,
623 			G_PARAM_READWRITE |
624 			G_PARAM_CONSTRUCT_ONLY |
625 			G_PARAM_STATIC_STRINGS));
626 
627 	g_object_class_install_property (
628 		object_class,
629 		PROP_SHOW_ACCOUNT_INFO,
630 		g_param_spec_boolean (
631 			"show-account-info",
632 			"Show Account Info",
633 			"Show the \"Account Information\" section",
634 			TRUE,
635 			G_PARAM_READWRITE |
636 			G_PARAM_CONSTRUCT |
637 			G_PARAM_STATIC_STRINGS));
638 
639 	g_object_class_install_property (
640 		object_class,
641 		PROP_SHOW_EMAIL_ADDRESS,
642 		g_param_spec_boolean (
643 			"show-email-address",
644 			"Show Email Address",
645 			"Show the \"Email Address\" field",
646 			TRUE,
647 			G_PARAM_READWRITE |
648 			G_PARAM_CONSTRUCT |
649 			G_PARAM_STATIC_STRINGS));
650 
651 	g_object_class_install_property (
652 		object_class,
653 		PROP_SHOW_INSTRUCTIONS,
654 		g_param_spec_boolean (
655 			"show-instructions",
656 			"Show Instructions",
657 			"Show helpful instructions",
658 			TRUE,
659 			G_PARAM_READWRITE |
660 			G_PARAM_CONSTRUCT |
661 			G_PARAM_STATIC_STRINGS));
662 
663 	g_object_class_install_property (
664 		object_class,
665 		PROP_SHOW_SIGNATURES,
666 		g_param_spec_boolean (
667 			"show-signatures",
668 			"Show Signatures",
669 			"Show mail signature options",
670 			TRUE,
671 			G_PARAM_READWRITE |
672 			G_PARAM_CONSTRUCT |
673 			G_PARAM_STATIC_STRINGS));
674 }
675 
676 static void
677 e_mail_config_identity_page_interface_init (EMailConfigPageInterface *interface)
678 {
679 	interface->title = _("Identity");
680 	interface->sort_order = E_MAIL_CONFIG_IDENTITY_PAGE_SORT_ORDER;
681 	interface->check_complete = mail_config_identity_page_check_complete;
682 }
683 
684 static void
685 e_mail_config_identity_page_init (EMailConfigIdentityPage *page)
686 {
687 	page->priv = E_MAIL_CONFIG_IDENTITY_PAGE_GET_PRIVATE (page);
688 }
689 
690 EMailConfigPage *
691 e_mail_config_identity_page_new (ESourceRegistry *registry,
692                                  ESource *identity_source)
693 {
694 	g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
695 	g_return_val_if_fail (E_IS_SOURCE (identity_source), NULL);
696 
697 	return g_object_new (
698 		E_TYPE_MAIL_CONFIG_IDENTITY_PAGE,
699 		"registry", registry,
700 		"identity-source", identity_source,
701 		NULL);
702 }
703 
704 ESourceRegistry *
705 e_mail_config_identity_page_get_registry (EMailConfigIdentityPage *page)
706 {
707 	g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), NULL);
708 
709 	return page->priv->registry;
710 }
711 
712 ESource *
713 e_mail_config_identity_page_get_identity_source (EMailConfigIdentityPage *page)
714 {
715 	g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), NULL);
716 
717 	return page->priv->identity_source;
718 }
719 
720 gboolean
721 e_mail_config_identity_page_get_show_account_info (EMailConfigIdentityPage *page)
722 {
723 	g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE);
724 
725 	return page->priv->show_account_info;
726 }
727 
728 void
729 e_mail_config_identity_page_set_show_account_info (EMailConfigIdentityPage *page,
730                                                    gboolean show_account_info)
731 {
732 	g_return_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page));
733 
734 	if (page->priv->show_account_info == show_account_info)
735 		return;
736 
737 	page->priv->show_account_info = show_account_info;
738 
739 	g_object_notify (G_OBJECT (page), "show-account-info");
740 }
741 
742 gboolean
743 e_mail_config_identity_page_get_show_email_address (EMailConfigIdentityPage *page)
744 {
745 	g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE);
746 
747 	return page->priv->show_email_address;
748 }
749 
750 void
751 e_mail_config_identity_page_set_show_email_address (EMailConfigIdentityPage *page,
752                                                     gboolean show_email_address)
753 {
754 	g_return_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page));
755 
756 	if (page->priv->show_email_address == show_email_address)
757 		return;
758 
759 	page->priv->show_email_address = show_email_address;
760 
761 	g_object_notify (G_OBJECT (page), "show-email-address");
762 }
763 
764 gboolean
765 e_mail_config_identity_page_get_show_instructions (EMailConfigIdentityPage *page)
766 {
767 	g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE);
768 
769 	return page->priv->show_instructions;
770 }
771 
772 void
773 e_mail_config_identity_page_set_show_instructions (EMailConfigIdentityPage *page,
774                                                    gboolean show_instructions)
775 {
776 	g_return_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page));
777 
778 	if (page->priv->show_instructions == show_instructions)
779 		return;
780 
781 	page->priv->show_instructions = show_instructions;
782 
783 	g_object_notify (G_OBJECT (page), "show-instructions");
784 }
785 
786 gboolean
787 e_mail_config_identity_page_get_show_signatures (EMailConfigIdentityPage *page)
788 {
789 	g_return_val_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page), FALSE);
790 
791 	return page->priv->show_signatures;
792 }
793 
794 void
795 e_mail_config_identity_page_set_show_signatures (EMailConfigIdentityPage *page,
796                                                  gboolean show_signatures)
797 {
798 	g_return_if_fail (E_IS_MAIL_CONFIG_IDENTITY_PAGE (page));
799 
800 	if (page->priv->show_signatures == show_signatures)
801 		return;
802 
803 	page->priv->show_signatures = show_signatures;
804 
805 	g_object_notify (G_OBJECT (page), "show-signatures");
806 }