2 * e-mail-config-security-page.c
4 * This program 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.
8 * This program 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 General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #include "evolution-config.h"
20 #include <glib/gi18n-lib.h>
22 #include <e-util/e-util.h>
23 #include <libebackend/libebackend.h>
25 #if defined (ENABLE_SMIME)
26 #include <smime/gui/e-cert-selector.h>
27 #endif /* ENABLE_SMIME */
29 #ifdef HAVE_LIBCRYPTUI
30 #define LIBCRYPTUI_API_SUBJECT_TO_CHANGE
31 #include <libcryptui/cryptui.h>
32 #undef LIBCRYPTUI_API_SUBJECT_TO_CHANGE
33 #endif /* HAVE_LIBCRYPTUI */
35 #include "e-mail-config-security-page.h"
37 #define E_MAIL_CONFIG_SECURITY_PAGE_GET_PRIVATE(obj) \
38 (G_TYPE_INSTANCE_GET_PRIVATE \
39 ((obj), E_TYPE_MAIL_CONFIG_SECURITY_PAGE, EMailConfigSecurityPagePrivate))
41 struct _EMailConfigSecurityPagePrivate
{
42 ESource
*identity_source
;
50 /* Forward Declarations */
51 static void e_mail_config_security_page_interface_init
52 (EMailConfigPageInterface
*iface
);
54 G_DEFINE_TYPE_WITH_CODE (
55 EMailConfigSecurityPage
,
56 e_mail_config_security_page
,
57 GTK_TYPE_SCROLLED_WINDOW
,
58 G_IMPLEMENT_INTERFACE (
59 E_TYPE_EXTENSIBLE
, NULL
)
60 G_IMPLEMENT_INTERFACE (
61 E_TYPE_MAIL_CONFIG_PAGE
,
62 e_mail_config_security_page_interface_init
))
66 mail_config_security_page_cert_selected (ECertSelector
*selector
,
71 gtk_entry_set_text (entry
, key
);
73 gtk_widget_destroy (GTK_WIDGET (selector
));
77 mail_config_security_page_select_encrypt_cert (GtkButton
*button
,
83 parent
= gtk_widget_get_toplevel (GTK_WIDGET (button
));
84 parent
= GTK_IS_WIDGET (parent
) ? parent
: NULL
;
86 selector
= e_cert_selector_new (
87 E_CERT_SELECTOR_RECIPIENT
,
88 gtk_entry_get_text (entry
));
89 gtk_window_set_transient_for (
90 GTK_WINDOW (selector
), parent
);
91 gtk_widget_show (selector
);
95 G_CALLBACK (mail_config_security_page_cert_selected
),
100 mail_config_security_page_select_sign_cert (GtkButton
*button
,
106 parent
= gtk_widget_get_toplevel (GTK_WIDGET (button
));
107 parent
= GTK_IS_WIDGET (parent
) ? parent
: NULL
;
109 selector
= e_cert_selector_new (
110 E_CERT_SELECTOR_SIGNER
,
111 gtk_entry_get_text (entry
));
112 gtk_window_set_transient_for (
113 GTK_WINDOW (selector
), parent
);
114 gtk_widget_show (selector
);
117 selector
, "selected",
118 G_CALLBACK (mail_config_security_page_cert_selected
),
123 mail_config_security_page_clear_cert (GtkButton
*button
,
126 gtk_entry_set_text (entry
, "");
128 #endif /* ENABLE_SMIME */
131 mail_config_security_page_set_identity_source (EMailConfigSecurityPage
*page
,
132 ESource
*identity_source
)
134 g_return_if_fail (E_IS_SOURCE (identity_source
));
135 g_return_if_fail (page
->priv
->identity_source
== NULL
);
137 page
->priv
->identity_source
= g_object_ref (identity_source
);
141 mail_config_security_page_set_property (GObject
*object
,
146 switch (property_id
) {
147 case PROP_IDENTITY_SOURCE
:
148 mail_config_security_page_set_identity_source (
149 E_MAIL_CONFIG_SECURITY_PAGE (object
),
150 g_value_get_object (value
));
154 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, property_id
, pspec
);
158 mail_config_security_page_get_property (GObject
*object
,
163 switch (property_id
) {
164 case PROP_IDENTITY_SOURCE
:
167 e_mail_config_security_page_get_identity_source (
168 E_MAIL_CONFIG_SECURITY_PAGE (object
)));
172 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, property_id
, pspec
);
176 mail_config_security_page_dispose (GObject
*object
)
178 EMailConfigSecurityPagePrivate
*priv
;
180 priv
= E_MAIL_CONFIG_SECURITY_PAGE_GET_PRIVATE (object
);
182 if (priv
->identity_source
!= NULL
) {
183 g_object_unref (priv
->identity_source
);
184 priv
->identity_source
= NULL
;
187 /* Chain up to parent's dispose() method. */
188 G_OBJECT_CLASS (e_mail_config_security_page_parent_class
)->
192 #ifdef HAVE_LIBCRYPTUI
194 mail_security_page_get_openpgpg_combo (void)
198 CryptUIKeyset
*keyset
;
199 GtkCellRenderer
*cell
;
202 store
= GTK_LIST_STORE (gtk_list_store_new (2, G_TYPE_STRING
, G_TYPE_STRING
));
204 keyset
= cryptui_keyset_new ("openpgp", FALSE
);
205 cryptui_keyset_set_expand_keys (keyset
, TRUE
);
207 keys
= cryptui_keyset_get_keys (keyset
);
208 for (kiter
= keys
; kiter
; kiter
= g_list_next (kiter
)) {
209 const gchar
*key
= kiter
->data
;
212 flags
= cryptui_keyset_key_flags (keyset
, key
);
214 if ((flags
& CRYPTUI_FLAG_CAN_SIGN
) != 0 &&
215 (flags
& CRYPTUI_FLAG_IS_VALID
) != 0 &&
216 (flags
& (CRYPTUI_FLAG_EXPIRED
| CRYPTUI_FLAG_REVOKED
| CRYPTUI_FLAG_DISABLED
)) == 0) {
217 gchar
*keyid
, *display_name
, *display_id
, *description
;
219 keyid
= cryptui_keyset_key_raw_keyid (keyset
, key
);
220 if (keyid
&& *keyid
) {
223 display_name
= cryptui_keyset_key_display_name (keyset
, key
);
224 display_id
= cryptui_keyset_key_display_id (keyset
, key
);
226 if (!display_id
|| !*display_id
) {
228 display_id
= g_strdup (keyid
);
231 /* Translators: This string is to describe a PGP key in a combo box in mail account's preferences.
232 The first '%s' is a key ID, the second '%s' is a display name of the key. */
233 description
= g_strdup_printf (C_("PGPKeyDescription", "%s — %s"), display_id
, display_name
);
235 gtk_list_store_append (store
, &iter
);
236 gtk_list_store_set (store
, &iter
,
241 g_free (display_name
);
243 g_free (description
);
251 g_object_unref (keyset
);
253 widget
= gtk_combo_box_new_with_model_and_entry (GTK_TREE_MODEL (store
));
254 g_object_unref (store
);
256 gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (widget
), 0);
257 gtk_cell_layout_clear (GTK_CELL_LAYOUT (widget
));
259 cell
= gtk_cell_renderer_text_new ();
260 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (widget
), cell
, TRUE
);
261 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (widget
), cell
, "text", 1, NULL
);
265 #endif /* HAVE_LIBCRYPTUI */
268 mail_config_security_page_constructed (GObject
*object
)
270 EMailConfigSecurityPage
*page
;
272 ESourceMailComposition
*composition_ext
;
273 ESourceOpenPGP
*openpgp_ext
;
276 GtkWidget
*container
;
278 GtkSizeGroup
*size_group
;
279 const gchar
*extension_name
;
283 #if defined (ENABLE_SMIME)
284 ESourceSMIME
*smime_ext
;
286 #endif /* ENABLE_SMIME */
288 page
= E_MAIL_CONFIG_SECURITY_PAGE (object
);
290 /* Chain up to parent's constructed() method. */
291 G_OBJECT_CLASS (e_mail_config_security_page_parent_class
)->constructed (object
);
293 source
= e_mail_config_security_page_get_identity_source (page
);
295 extension_name
= E_SOURCE_EXTENSION_MAIL_COMPOSITION
;
296 composition_ext
= e_source_get_extension (source
, extension_name
);
298 extension_name
= E_SOURCE_EXTENSION_OPENPGP
;
299 openpgp_ext
= e_source_get_extension (source
, extension_name
);
301 #if defined (ENABLE_SMIME)
302 extension_name
= E_SOURCE_EXTENSION_SMIME
;
303 smime_ext
= e_source_get_extension (source
, extension_name
);
304 #endif /* ENABLE_SMIME */
306 main_box
= gtk_box_new (GTK_ORIENTATION_VERTICAL
, 12);
308 size_group
= gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL
);
312 widget
= gtk_grid_new ();
313 gtk_grid_set_row_spacing (GTK_GRID (widget
), 6);
314 gtk_grid_set_column_spacing (GTK_GRID (widget
), 6);
315 gtk_box_pack_start (GTK_BOX (main_box
), widget
, FALSE
, FALSE
, 0);
316 gtk_widget_show (widget
);
321 markup
= g_markup_printf_escaped ("<b>%s</b>", text
);
322 widget
= gtk_label_new (markup
);
323 gtk_label_set_use_markup (GTK_LABEL (widget
), TRUE
);
324 gtk_misc_set_alignment (GTK_MISC (widget
), 0.0, 0.5);
325 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 0, 1, 1);
326 gtk_widget_show (widget
);
329 text
= _("_Do not sign meeting requests (for Outlook compatibility)");
330 widget
= gtk_check_button_new_with_mnemonic (text
);
331 gtk_widget_set_margin_left (widget
, 12);
332 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 1, 1, 1);
333 gtk_widget_show (widget
);
335 e_binding_bind_property (
336 composition_ext
, "sign-imip",
338 G_BINDING_BIDIRECTIONAL
|
339 G_BINDING_SYNC_CREATE
);
341 /*** Pretty Good Privacy (OpenPGP) ***/
343 widget
= gtk_grid_new ();
344 gtk_grid_set_row_spacing (GTK_GRID (widget
), 6);
345 gtk_grid_set_column_spacing (GTK_GRID (widget
), 6);
346 gtk_box_pack_start (GTK_BOX (main_box
), widget
, FALSE
, FALSE
, 0);
347 gtk_widget_show (widget
);
351 text
= _("Pretty Good Privacy (OpenPGP)");
352 markup
= g_markup_printf_escaped ("<b>%s</b>", text
);
353 widget
= gtk_label_new (markup
);
354 gtk_label_set_use_markup (GTK_LABEL (widget
), TRUE
);
355 gtk_misc_set_alignment (GTK_MISC (widget
), 0.0, 0.5);
356 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 0, 2, 1);
357 gtk_widget_show (widget
);
360 text
= _("OpenPGP _Key ID:");
361 widget
= gtk_label_new_with_mnemonic (text
);
362 gtk_widget_set_margin_left (widget
, 12);
363 gtk_size_group_add_widget (size_group
, widget
);
364 gtk_misc_set_alignment (GTK_MISC (widget
), 1.0, 0.5);
365 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 1, 1, 1);
366 gtk_widget_show (widget
);
368 label
= GTK_LABEL (widget
);
370 #ifdef HAVE_LIBCRYPTUI
371 widget
= mail_security_page_get_openpgpg_combo ();
372 #else /* HAVE_LIBCRYPTUI */
373 widget
= gtk_entry_new ();
374 #endif /* HAVE_LIBCRYPTUI */
376 gtk_widget_set_hexpand (widget
, TRUE
);
377 gtk_label_set_mnemonic_widget (label
, widget
);
378 gtk_grid_attach (GTK_GRID (container
), widget
, 1, 1, 1, 1);
379 gtk_widget_show (widget
);
381 #ifdef HAVE_LIBCRYPTUI
382 /* There's expected an entry, thus provide it. */
383 widget
= gtk_bin_get_child (GTK_BIN (widget
));
384 g_warn_if_fail (GTK_IS_ENTRY (widget
));
385 #endif /* HAVE_LIBCRYPTUI */
387 e_binding_bind_object_text_property (
388 openpgp_ext
, "key-id",
390 G_BINDING_SYNC_CREATE
|
391 G_BINDING_BIDIRECTIONAL
);
393 text
= _("Si_gning algorithm:");
394 widget
= gtk_label_new_with_mnemonic (text
);
395 gtk_widget_set_margin_left (widget
, 12);
396 gtk_size_group_add_widget (size_group
, widget
);
397 gtk_misc_set_alignment (GTK_MISC (widget
), 1.0, 0.5);
398 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 2, 1, 1);
399 gtk_widget_show (widget
);
401 label
= GTK_LABEL (widget
);
403 widget
= gtk_combo_box_text_new ();
404 gtk_combo_box_text_append (
405 GTK_COMBO_BOX_TEXT (widget
),
407 gtk_combo_box_text_append (
408 GTK_COMBO_BOX_TEXT (widget
),
410 gtk_combo_box_text_append (
411 GTK_COMBO_BOX_TEXT (widget
),
412 "sha256", _("SHA256"));
413 gtk_combo_box_text_append (
414 GTK_COMBO_BOX_TEXT (widget
),
415 "sha384", _("SHA384"));
416 gtk_combo_box_text_append (
417 GTK_COMBO_BOX_TEXT (widget
),
418 "sha512", _("SHA512"));
419 gtk_widget_set_halign (widget
, GTK_ALIGN_START
);
420 gtk_label_set_mnemonic_widget (label
, widget
);
421 gtk_grid_attach (GTK_GRID (container
), widget
, 1, 2, 1, 1);
422 gtk_widget_show (widget
);
424 e_binding_bind_property (
425 openpgp_ext
, "signing-algorithm",
427 G_BINDING_SYNC_CREATE
|
428 G_BINDING_BIDIRECTIONAL
);
430 /* Make sure the combo box has an active item. */
431 if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (widget
)) == NULL
)
432 gtk_combo_box_set_active (GTK_COMBO_BOX (widget
), 0);
434 text
= _("Al_ways sign outgoing messages when using this account");
435 widget
= gtk_check_button_new_with_mnemonic (text
);
436 gtk_widget_set_margin_left (widget
, 12);
437 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 3, 2, 1);
438 gtk_widget_show (widget
);
440 e_binding_bind_property (
441 openpgp_ext
, "sign-by-default",
443 G_BINDING_SYNC_CREATE
|
444 G_BINDING_BIDIRECTIONAL
);
446 text
= _("Always enc_rypt outgoing messages when using this account");
447 widget
= gtk_check_button_new_with_mnemonic (text
);
448 gtk_widget_set_margin_left (widget
, 12);
449 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 4, 2, 1);
450 gtk_widget_show (widget
);
452 e_binding_bind_property (
453 openpgp_ext
, "encrypt-by-default",
455 G_BINDING_SYNC_CREATE
|
456 G_BINDING_BIDIRECTIONAL
);
458 text
= _("Always encrypt to _myself when sending encrypted messages");
459 widget
= gtk_check_button_new_with_mnemonic (text
);
460 gtk_widget_set_margin_left (widget
, 12);
461 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 5, 2, 1);
462 gtk_widget_show (widget
);
464 e_binding_bind_property (
465 openpgp_ext
, "encrypt-to-self",
467 G_BINDING_SYNC_CREATE
|
468 G_BINDING_BIDIRECTIONAL
);
470 text
= _("Always _trust keys in my keyring when encrypting");
471 widget
= gtk_check_button_new_with_mnemonic (text
);
472 gtk_widget_set_margin_left (widget
, 12);
473 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 6, 2, 1);
474 gtk_widget_show (widget
);
476 e_binding_bind_property (
477 openpgp_ext
, "always-trust",
479 G_BINDING_SYNC_CREATE
|
480 G_BINDING_BIDIRECTIONAL
);
482 text
= _("Prefer _inline sign/encrypt for plain text messages");
483 widget
= gtk_check_button_new_with_mnemonic (text
);
484 gtk_widget_set_margin_left (widget
, 12);
485 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 7, 2, 1);
486 gtk_widget_show (widget
);
488 e_binding_bind_property (
489 openpgp_ext
, "prefer-inline",
491 G_BINDING_SYNC_CREATE
|
492 G_BINDING_BIDIRECTIONAL
);
494 #if defined (ENABLE_SMIME)
496 /*** Security MIME (S/MIME) ***/
498 widget
= gtk_grid_new ();
499 gtk_grid_set_row_spacing (GTK_GRID (widget
), 6);
500 gtk_grid_set_column_spacing (GTK_GRID (widget
), 6);
501 gtk_box_pack_start (GTK_BOX (main_box
), widget
, FALSE
, FALSE
, 0);
502 gtk_widget_show (widget
);
506 text
= _("Secure MIME (S/MIME)");
507 markup
= g_markup_printf_escaped ("<b>%s</b>", text
);
508 widget
= gtk_label_new (markup
);
509 gtk_label_set_use_markup (GTK_LABEL (widget
), TRUE
);
510 gtk_misc_set_alignment (GTK_MISC (widget
), 0.0, 0.5);
511 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 0, 4, 1);
512 gtk_widget_show (widget
);
515 text
= _("Sig_ning certificate:");
516 widget
= gtk_label_new_with_mnemonic (text
);
517 gtk_widget_set_margin_left (widget
, 12);
518 gtk_size_group_add_widget (size_group
, widget
);
519 gtk_misc_set_alignment (GTK_MISC (widget
), 1.0, 0.5);
520 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 1, 1, 1);
521 gtk_widget_show (widget
);
523 label
= GTK_LABEL (widget
);
525 widget
= gtk_entry_new ();
526 gtk_widget_set_hexpand (widget
, TRUE
);
527 gtk_label_set_mnemonic_widget (label
, widget
);
528 gtk_grid_attach (GTK_GRID (container
), widget
, 1, 1, 1, 1);
529 gtk_widget_show (widget
);
531 e_binding_bind_object_text_property (
532 smime_ext
, "signing-certificate",
534 G_BINDING_BIDIRECTIONAL
|
535 G_BINDING_SYNC_CREATE
);
537 entry
= GTK_ENTRY (widget
);
539 widget
= gtk_button_new_with_label (_("Select"));
540 gtk_grid_attach (GTK_GRID (container
), widget
, 2, 1, 1, 1);
541 gtk_widget_show (widget
);
545 G_CALLBACK (mail_config_security_page_select_sign_cert
),
548 widget
= e_dialog_button_new_with_icon ("edit-clear", _("_Clear"));
549 gtk_grid_attach (GTK_GRID (container
), widget
, 3, 1, 1, 1);
550 gtk_widget_show (widget
);
554 G_CALLBACK (mail_config_security_page_clear_cert
),
557 text
= _("Signing _algorithm:");
558 widget
= gtk_label_new_with_mnemonic (text
);
559 gtk_widget_set_margin_left (widget
, 12);
560 gtk_size_group_add_widget (size_group
, widget
);
561 gtk_misc_set_alignment (GTK_MISC (widget
), 1.0, 0.5);
562 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 2, 1, 1);
563 gtk_widget_show (widget
);
565 label
= GTK_LABEL (widget
);
567 widget
= gtk_combo_box_text_new ();
568 gtk_combo_box_text_append (
569 GTK_COMBO_BOX_TEXT (widget
),
571 gtk_combo_box_text_append (
572 GTK_COMBO_BOX_TEXT (widget
),
574 gtk_combo_box_text_append (
575 GTK_COMBO_BOX_TEXT (widget
),
576 "sha256", _("SHA256"));
577 gtk_combo_box_text_append (
578 GTK_COMBO_BOX_TEXT (widget
),
579 "sha384", _("SHA384"));
580 gtk_combo_box_text_append (
581 GTK_COMBO_BOX_TEXT (widget
),
582 "sha512", _("SHA512"));
583 gtk_widget_set_halign (widget
, GTK_ALIGN_START
);
584 gtk_label_set_mnemonic_widget (label
, widget
);
585 gtk_grid_attach (GTK_GRID (container
), widget
, 1, 2, 1, 1);
586 gtk_widget_show (widget
);
588 e_binding_bind_property (
589 smime_ext
, "signing-algorithm",
591 G_BINDING_SYNC_CREATE
|
592 G_BINDING_BIDIRECTIONAL
);
594 /* Make sure the combo box has an active item. */
595 if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (widget
)) == NULL
)
596 gtk_combo_box_set_active (GTK_COMBO_BOX (widget
), 0);
598 text
= _("Always sign outgoing messages when using this account");
599 widget
= gtk_check_button_new_with_mnemonic (text
);
600 gtk_widget_set_margin_left (widget
, 12);
601 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 3, 4, 1);
602 gtk_widget_show (widget
);
604 e_binding_bind_property (
605 smime_ext
, "sign-by-default",
607 G_BINDING_SYNC_CREATE
|
608 G_BINDING_BIDIRECTIONAL
);
610 /* Add extra padding between signing stuff and encryption stuff. */
611 gtk_widget_set_margin_bottom (widget
, 6);
613 text
= _("Encryption certificate:");
614 widget
= gtk_label_new_with_mnemonic (text
);
615 gtk_widget_set_margin_left (widget
, 12);
616 gtk_size_group_add_widget (size_group
, widget
);
617 gtk_misc_set_alignment (GTK_MISC (widget
), 1.0, 0.5);
618 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 4, 1, 1);
619 gtk_widget_show (widget
);
621 label
= GTK_LABEL (widget
);
623 widget
= gtk_entry_new ();
624 gtk_widget_set_hexpand (widget
, TRUE
);
625 gtk_label_set_mnemonic_widget (label
, widget
);
626 gtk_grid_attach (GTK_GRID (container
), widget
, 1, 4, 1, 1);
627 gtk_widget_show (widget
);
629 e_binding_bind_object_text_property (
630 smime_ext
, "encryption-certificate",
632 G_BINDING_BIDIRECTIONAL
|
633 G_BINDING_SYNC_CREATE
);
635 entry
= GTK_ENTRY (widget
);
637 widget
= gtk_button_new_with_label (_("Select"));
638 gtk_grid_attach (GTK_GRID (container
), widget
, 2, 4, 1, 1);
639 gtk_widget_show (widget
);
643 G_CALLBACK (mail_config_security_page_select_encrypt_cert
),
646 widget
= e_dialog_button_new_with_icon ("edit-clear", _("_Clear"));
647 gtk_grid_attach (GTK_GRID (container
), widget
, 3, 4, 1, 1);
648 gtk_widget_show (widget
);
652 G_CALLBACK (mail_config_security_page_clear_cert
),
655 text
= _("Always encrypt outgoing messages when using this account");
656 widget
= gtk_check_button_new_with_mnemonic (text
);
657 gtk_widget_set_margin_left (widget
, 12);
658 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 5, 4, 1);
659 gtk_widget_show (widget
);
661 e_binding_bind_property (
662 smime_ext
, "encrypt-by-default",
664 G_BINDING_SYNC_CREATE
|
665 G_BINDING_BIDIRECTIONAL
);
667 text
= _("Always encrypt to myself when sending encrypted messages");
668 widget
= gtk_check_button_new_with_mnemonic (text
);
669 gtk_widget_set_margin_left (widget
, 12);
670 gtk_grid_attach (GTK_GRID (container
), widget
, 0, 6, 4, 1);
671 gtk_widget_show (widget
);
673 e_binding_bind_property (
674 smime_ext
, "encrypt-to-self",
676 G_BINDING_SYNC_CREATE
|
677 G_BINDING_BIDIRECTIONAL
);
679 #endif /* ENABLE_SMIME */
681 g_object_unref (size_group
);
683 e_mail_config_page_set_content (E_MAIL_CONFIG_PAGE (page
), main_box
);
685 e_extensible_load_extensions (E_EXTENSIBLE (page
));
689 e_mail_config_security_page_class_init (EMailConfigSecurityPageClass
*class)
691 GObjectClass
*object_class
;
693 g_type_class_add_private (
694 class, sizeof (EMailConfigSecurityPagePrivate
));
696 object_class
= G_OBJECT_CLASS (class);
697 object_class
->set_property
= mail_config_security_page_set_property
;
698 object_class
->get_property
= mail_config_security_page_get_property
;
699 object_class
->dispose
= mail_config_security_page_dispose
;
700 object_class
->constructed
= mail_config_security_page_constructed
;
702 g_object_class_install_property (
704 PROP_IDENTITY_SOURCE
,
705 g_param_spec_object (
708 "Mail identity source being edited",
711 G_PARAM_CONSTRUCT_ONLY
|
712 G_PARAM_STATIC_STRINGS
));
716 e_mail_config_security_page_interface_init (EMailConfigPageInterface
*iface
)
718 iface
->title
= _("Security");
719 iface
->sort_order
= E_MAIL_CONFIG_SECURITY_PAGE_SORT_ORDER
;
723 e_mail_config_security_page_init (EMailConfigSecurityPage
*page
)
725 page
->priv
= E_MAIL_CONFIG_SECURITY_PAGE_GET_PRIVATE (page
);
729 e_mail_config_security_page_new (ESource
*identity_source
)
731 g_return_val_if_fail (E_IS_SOURCE (identity_source
), NULL
);
733 return g_object_new (
734 E_TYPE_MAIL_CONFIG_SECURITY_PAGE
,
735 "identity-source", identity_source
, NULL
);
739 e_mail_config_security_page_get_identity_source (EMailConfigSecurityPage
*page
)
741 g_return_val_if_fail (E_IS_MAIL_CONFIG_SECURITY_PAGE (page
), NULL
);
743 return page
->priv
->identity_source
;