diff options
author | Not Zed <NotZed@Ximian.com> | 2003-11-13 11:57:54 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-11-13 11:57:54 +0800 |
commit | 8e302d84a481b9788ca071f824af598176e78df8 (patch) | |
tree | a527579a23ea5bec3179d82757472962010c2e52 | |
parent | 61b1ec94bae6c13d7d1f6dade48a51bfc40f04ef (diff) | |
download | gsoc2013-evolution-8e302d84a481b9788ca071f824af598176e78df8.tar.gz gsoc2013-evolution-8e302d84a481b9788ca071f824af598176e78df8.tar.zst gsoc2013-evolution-8e302d84a481b9788ca071f824af598176e78df8.zip |
implement the key selector popup using e-cert-selector.
2003-11-12 Not Zed <NotZed@Ximian.com>
* mail-account-gui.c (smime_sign_key_select)
(smime_encrypt_key_select, smime_encrypt_key_selected)
(smime_sign_key_selected): implement the key selector popup using
e-cert-selector.
2003-11-11 Not Zed <NotZed@Ximian.com>
* em-format-html.c (efh_application_xpkcs7mime): output icons of the status.
(em_format_html_add_pobject): Changed to take a size specificier,
return the pobject, and re-ordered args to be more consistent with
puri stuff.
(em_format_html_remove_pobject): handle the free callback if set.
* em-format.c (emf_application_xpkcs7mime): moved this to
em-format-html since it needs to do icon stuff.
svn path=/trunk/; revision=23312
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 197 | ||||
-rw-r--r-- | mail/em-format-html.c | 116 | ||||
-rw-r--r-- | mail/em-format-html.h | 7 | ||||
-rw-r--r-- | mail/em-format.c | 62 | ||||
-rw-r--r-- | mail/mail-account-gui.c | 45 |
6 files changed, 365 insertions, 78 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 54d5f10d6f..63f74f3f8b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,21 @@ +2003-11-12 Not Zed <NotZed@Ximian.com> + + * mail-account-gui.c (smime_sign_key_select) + (smime_encrypt_key_select, smime_encrypt_key_selected) + (smime_sign_key_selected): implement the key selector popup using + e-cert-selector. + 2003-11-11 Not Zed <NotZed@Ximian.com> + * em-format-html.c (efh_application_xpkcs7mime): output icons of the status. + (em_format_html_add_pobject): Changed to take a size specificier, + return the pobject, and re-ordered args to be more consistent with + puri stuff. + (em_format_html_remove_pobject): handle the free callback if set. + + * em-format.c (emf_application_xpkcs7mime): moved this to + em-format-html since it needs to do icon stuff. + * mail-security.glade: new glade file for security related stuff. * mail-config.glade: removed the message security dialogue, it diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index d7497cfac5..1b36fbbdb0 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -564,6 +564,196 @@ efhd_complete(EMFormat *emf) /* ********************************************************************** */ +static const struct { + const char *icon, *description; +} smime_sign_table[4] = { + { NULL, N_("This message is not signed. There is no guarantee the sender of the message is authentic.") }, + { "pgp-signature-ok.png", N_("This message is signed and is valid, the sender of this message is very likely who they claim to be.") }, + { "pgp-signature-bad.png", N_("The signature of this message cannot be verified, it may have been altered in transit.") }, + { "pgp-signature-nokey.png", N_("This message is signed with a valid signature, but the sender of the message cannot be verified.") }, +}; + +static const struct { + const char *icon, *description; +} smime_encrypt_table[4] = { + { NULL, N_("This message is not encrypted. It's content may be viewed in transit across The Internet.") }, + { "pgp-signature-ok.png", N_("This message is encrypted, but with a weak encryption algorithm. It would be difficult, but not impossible for an outsider to view the content of this message in a practical amount of time.") }, + { "pgp-signature-ok.png", N_("This message is encrypted. It would be difficult for an outsider to view the content of this message.") }, + { "pgp-signature-ok.png", N_("This message is encrypted, with a strong encryption algorithm. It would be very difficult for an outsider to view the content of this message in a practical amount of time.") }, +}; + +struct _smime_pobject { + EMFormatHTMLPObject object; + + int signature; + CamelCipherValidity *valid; + GtkWidget *widget; +}; + +static void +efhd_xpkcs7mime_free(EMFormatHTMLPObject *o) +{ + struct _smime_pobject *po = (struct _smime_pobject *)o; + + if (po->widget) + gtk_widget_destroy(po->widget); + camel_cipher_validity_free(po->valid); +} + +static void +efhd_xpkcs7mime_info_response(GtkWidget *w, guint button, struct _smime_pobject *po) +{ + gtk_widget_destroy(w); + po->widget = NULL; +} + +static void +efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject) +{ + struct _smime_pobject *po = (struct _smime_pobject *)pobject; + GladeXML *xml; + GtkWidget *vbox, *w; + + printf("validity clicked\n"); + + if (po->widget) + /* FIXME: window raise? */ + return; + + xml = glade_xml_new(EVOLUTION_GLADEDIR "/mail-security.glade", "message_security_dialog", NULL); + po->widget = glade_xml_get_widget(xml, "message_security_dialog"); + + vbox = glade_xml_get_widget(xml, "signature_vbox"); + w = gtk_label_new(_(smime_sign_table[po->valid->sign.status].description)); + gtk_label_set_line_wrap((GtkLabel *)w, TRUE); + gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + if (po->valid->sign.description) { + w = gtk_label_new(po->valid->sign.description); + gtk_label_set_line_wrap((GtkLabel *)w, TRUE); + gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + } + gtk_widget_show_all(vbox); + + vbox = glade_xml_get_widget(xml, "encryption_vbox"); + w = gtk_label_new(_(smime_encrypt_table[po->valid->encrypt.status].description)); + gtk_label_set_line_wrap((GtkLabel *)w, TRUE); + gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + if (po->valid->encrypt.description) { + w = gtk_label_new(po->valid->encrypt.description); + gtk_label_set_line_wrap((GtkLabel *)w, TRUE); + gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6); + } + gtk_widget_show_all(vbox); + + g_object_unref(xml); + + g_signal_connect(po->widget, "response", G_CALLBACK(efhd_xpkcs7mime_info_response), po); + gtk_widget_show(po->widget); +} + +static gboolean +efhd_xpkcs7mime_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) +{ + GtkWidget *icon, *button; + GdkPixbuf *pixbuf; + struct _smime_pobject *po = (struct _smime_pobject *)pobject; + char *file; + const char *name; + + if (po->signature) + name = smime_sign_table[po->valid->sign.status].icon; + else + name = smime_encrypt_table[po->valid->encrypt.status].icon; + + file = g_build_filename(EVOLUTION_ICONSDIR, name, NULL); + pixbuf = gdk_pixbuf_new_from_file(file, NULL); + g_free(file); + if (pixbuf == NULL) + return FALSE; + + /* wtf isn't this just scaled on disk? */ + icon = gtk_image_new_from_pixbuf(gdk_pixbuf_scale_simple(pixbuf, 24, 24, GDK_INTERP_BILINEAR)); + g_object_unref(pixbuf); + gtk_widget_show(icon); + + button = gtk_button_new(); + g_signal_connect(button, "clicked", G_CALLBACK(efhd_xpkcs7mime_validity_clicked), pobject); + + gtk_container_add((GtkContainer *)button, icon); + gtk_widget_show(button); + gtk_container_add((GtkContainer *)eb, button); + + return TRUE; +} + +static void +efhd_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) +{ + CamelCipherContext *context; + CamelException *ex; + extern CamelSession *session; + CamelMimePart *opart; + CamelCipherValidity *valid; + + ex = camel_exception_new(); + + context = camel_smime_context_new(session); + + opart = camel_mime_part_new(); + valid = camel_cipher_decrypt(context, part, opart, ex); + if (valid == NULL) { + em_format_format_error(emf, stream, ex->desc?ex->desc:_("Could not parse S/MIME message: Unknown error")); + em_format_part_as(emf, stream, part, NULL); + } else { + CamelCipherValidity *save = ((EMFormatHTML *)emf)->enveloped_validity; + + if (save != NULL) + camel_cipher_validity_envelope(valid, save); + + ((EMFormatHTML *)emf)->enveloped_validity = valid; + em_format_part(emf, stream, opart); + ((EMFormatHTML *)emf)->enveloped_validity = save; + + if (save != NULL + && (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE + || valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)) { + char *classid; + struct _smime_pobject *pobj; + + camel_stream_printf(stream, "<table border=1 width=\"100%%\" cellpadding=3 cellspacing=0><tr>"); + + if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) { + classid = g_strdup_printf("smime:///em-format-html/%p/icon/signed", part); + pobj = (struct _smime_pobject *)em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(*pobj), classid, part, efhd_xpkcs7mime_button); + pobj->valid = camel_cipher_validity_clone(valid); + pobj->signature = TRUE; + pobj->object.free = efhd_xpkcs7mime_free; + camel_stream_printf(stream, "<td valign=top><object classid=\"%s\"></object><br>%s</td>", classid, valid->sign.description); + g_free(classid); + } + + if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) { + classid = g_strdup_printf("smime:///em-format-html/%p/icon/encrypted", part); + pobj = (struct _smime_pobject *)em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(*pobj), classid, part, efhd_xpkcs7mime_button); + pobj->valid = camel_cipher_validity_clone(valid); + pobj->object.free = efhd_xpkcs7mime_free; + camel_stream_printf(stream, "<td valign=top><object classid=\"%s\"></object><br>%s</td>", classid, valid->encrypt.description); + g_free(classid); + } + + camel_stream_printf(stream, "</tr></table>"); + } + + camel_cipher_validity_free(valid); + } + + camel_object_unref(opart); + camel_object_unref(context); + camel_exception_free(ex); +} + +/* ********************************************************************** */ + static void efhd_signature_check(GtkWidget *w, EMFormatHTMLPObject *pobject) { @@ -637,7 +827,7 @@ efhd_multipart_signed (EMFormat *emf, CamelStream *stream, CamelMimePart *part, classid, _("This message is digitally signed. Click the lock icon for more information.")); - em_format_html_add_pobject((EMFormatHTML *)emf, classid, efhd_signature_button, part); + em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_signature_button); g_free(classid); } } @@ -645,6 +835,7 @@ efhd_multipart_signed (EMFormat *emf, CamelStream *stream, CamelMimePart *part, /* ********************************************************************** */ static EMFormatHandler type_builtin_table[] = { + { "application/x-pkcs7-mime", (EMFormatFunc)efhd_application_xpkcs7mime }, { "multipart/signed", (EMFormatFunc)efhd_multipart_signed }, }; @@ -1116,7 +1307,7 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, classid = g_strdup_printf("attachment-%p", part); info = (struct _attach_puri *)em_format_add_puri(emf, sizeof(*info), classid, part, efhd_attachment_frame); - em_format_html_add_pobject((EMFormatHTML *)emf, classid, efhd_attachment_button, part); + em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_button); info->handle = handle; info->shown = em_format_is_inline(emf, info->puri.part) && handle != NULL; @@ -1151,7 +1342,7 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, g_free(classid); /* messy */ classid = g_strdup_printf("bonobo-unknown:///em-formath-html-display/%p/%d", part, partid++); - em_format_html_add_pobject((EMFormatHTML *)emf, classid, efhd_bonobo_object, part); + em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_bonobo_object); camel_stream_printf(stream, "<object classid=\"%s\" type=\"%s\">\n", classid, mime_type); } diff --git a/mail/em-format-html.c b/mail/em-format-html.c index c2d2a153fd..3c8fd56aa0 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -314,13 +314,14 @@ em_format_html_file_part(EMFormatHTML *efh, const char *mime_type, const char *p /* all this api is a pain in the bum ... */ -/* should it have a user-data field? */ -const char * -em_format_html_add_pobject(EMFormatHTML *efh, const char *classid, EMFormatHTMLPObjectFunc func, CamelMimePart *part) +EMFormatHTMLPObject * +em_format_html_add_pobject(EMFormatHTML *efh, size_t size, const char *classid, CamelMimePart *part, EMFormatHTMLPObjectFunc func) { EMFormatHTMLPObject *pobj; - pobj = g_malloc(sizeof(*pobj)); + g_assert(size >= sizeof(EMFormatHTMLPObject)); + + pobj = g_malloc(size); if (classid) { pobj->classid = g_strdup(classid); } else { @@ -335,7 +336,7 @@ em_format_html_add_pobject(EMFormatHTML *efh, const char *classid, EMFormatHTMLP e_dlist_addtail(&efh->pending_object_list, (EDListNode *)pobj); - return pobj->classid; + return pobj; } EMFormatHTMLPObject * @@ -372,6 +373,8 @@ void em_format_html_remove_pobject(EMFormatHTML *emf, EMFormatHTMLPObject *pobject) { e_dlist_remove((EDListNode *)pobject); + if (pobject->free) + pobject->free(pobject); g_free(pobject->classid); g_free(pobject); } @@ -551,6 +554,98 @@ efh_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTML *efh) #include "em-inline-filter.h" #include <camel/camel-stream-null.h> +static const struct { + const char *icon; +} smime_sign_table[4] = { + { NULL }, + { "pgp-signature-ok.png" }, + { "pgp-signature-bad.png" }, + { "pgp-signature-nokey.png" }, +}; + +static const struct { + const char *icon; +} smime_encrypt_table[4] = { + { NULL }, + { "pgp-signature-ok.png" }, + { "pgp-signature-ok.png" }, + { "pgp-signature-ok.png" }, +}; + +static void +efh_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) +{ + CamelCipherContext *context; + CamelException *ex; + extern CamelSession *session; + CamelMimePart *opart; + CamelCipherValidity *valid; + + ex = camel_exception_new(); + + context = camel_smime_context_new(session); + + opart = camel_mime_part_new(); + valid = camel_cipher_decrypt(context, part, opart, ex); + if (valid == NULL) { + em_format_format_error(emf, stream, ex->desc?ex->desc:_("Could not parse S/MIME message: Unknown error")); + em_format_part_as(emf, stream, part, NULL); + } else { + CamelCipherValidity *save = ((EMFormatHTML *)emf)->enveloped_validity; + + if (save != NULL) + camel_cipher_validity_envelope(valid, save); + + ((EMFormatHTML *)emf)->enveloped_validity = valid; + em_format_part(emf, stream, opart); + ((EMFormatHTML *)emf)->enveloped_validity = save; + + if (save != NULL + && (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE + || valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)) { + char *classid; + CamelMimePart *iconpart; + EMFormatPURI *iconpuri; + + camel_stream_printf(stream, "<table border=1 width=\"100%%\" cellpadding=3 cellspacing=0><tr>"); + + if (valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE) { + classid = g_strdup_printf("smime:///em-format-html/%p/icon/signed", part); + iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", + EVOLUTION_ICONSDIR, smime_sign_table[valid->sign.status].icon); + if (iconpart) { + iconpuri = em_format_add_puri(emf, sizeof(*iconpuri), classid, iconpart, efh_write_image); + camel_object_unref(iconpart); + } + + camel_stream_printf(stream, "<td valign=top><img src=\"%s\"><br>%s</td>", classid, valid->sign.description); + g_free(classid); + } + + if (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE) { + classid = g_strdup_printf("smime:///em-format-html/%p/icon/encrypted", part); + iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", + EVOLUTION_ICONSDIR, smime_encrypt_table[valid->encrypt.status].icon); + if (iconpart) { + iconpuri = em_format_add_puri(emf, sizeof(*iconpuri), classid, iconpart, efh_write_image); + camel_object_unref(iconpart); + } + + camel_stream_printf(stream, "<td valign=top><img src=\"%s\"><br>%s</td>", classid, valid->encrypt.description); + g_free(classid); + } + + camel_stream_printf(stream, "</tr></table>"); + } + + camel_cipher_validity_free(valid); + } + + camel_object_unref(opart); + camel_object_unref(context); + camel_exception_free(ex); +} + static void efh_text_plain(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { @@ -921,7 +1016,7 @@ em_format_html_multipart_signed_sign(EMFormat *emf, CamelStream *stream, CamelMi mps = (CamelMultipartSigned *)camel_medium_get_content_object((CamelMedium *)part); - /* FIXME: This sequence is also copied in em-format-html.c */ + /* FIXME: This sequence is also copied in em-format.c */ camel_exception_init(&ex); if (emf->session == NULL) { @@ -1017,6 +1112,8 @@ efh_image(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatH } static EMFormatHandler type_builtin_table[] = { + { "application/x-pkcs7-mime", (EMFormatFunc)efh_application_xpkcs7mime }, + { "image/gif", (EMFormatFunc)efh_image }, { "image/jpeg", (EMFormatFunc)efh_image }, { "image/png", (EMFormatFunc)efh_image }, @@ -1484,6 +1581,9 @@ em_format_html_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMediu static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMedium *part) { #define efh ((EMFormatHTML *)emf) + CamelCipherValidity *save = efh->enveloped_validity; + + efh->enveloped_validity = NULL; if (!efh->hide_headers) em_format_html_format_headers(efh, stream, part); @@ -1495,6 +1595,8 @@ static void efh_format_message(EMFormat *emf, CamelStream *stream, CamelMedium * if (emf->message != part) camel_stream_printf(stream, "</blockquote>"); + + efh->enveloped_validity = save; #undef efh } @@ -1527,7 +1629,7 @@ efh_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c /* this could probably be cleaned up ... */ camel_stream_write_string(stream, - "<table cellspacing=0 cellpadding=0><tr><td>" + "<table border=1 cellspacing=0 cellpadding=0><tr><td>" "<table width=10 cellspacing=0 cellpadding=0>" "<tr><td></td></tr></table></td>" "<td><table width=3 cellspacing=0 cellpadding=0>" diff --git a/mail/em-format-html.h b/mail/em-format-html.h index 31675f62fd..892a6d8461 100644 --- a/mail/em-format-html.h +++ b/mail/em-format-html.h @@ -79,6 +79,7 @@ typedef gboolean (*EMFormatHTMLPObjectFunc)(EMFormatHTML *md, struct _GtkHTMLEmb struct _EMFormatHTMLPObject { struct _EMFormatHTMLPObject *next, *prev; + void (*free)(struct _EMFormatHTMLPObject *); struct _EMFormatHTML *format; char *classid; @@ -105,6 +106,8 @@ struct _EMFormatHTML { EDList pending_object_list; + struct _CamelCipherValidity *enveloped_validity; + GSList *headers; guint32 text_html_flags; /* default flags for text to html conversion */ @@ -139,8 +142,8 @@ void em_format_html_format_headers(EMFormatHTML *efh, struct _CamelStream *strea struct _CamelMimePart *em_format_html_file_part(EMFormatHTML *efh, const char *mime_type, const char *path, const char *name); /* for implementers */ -const char *em_format_html_add_pobject(EMFormatHTML *efh, const char *classid, EMFormatHTMLPObjectFunc func, struct _CamelMimePart *part); -EMFormatHTMLPObject * em_format_html_find_pobject(EMFormatHTML *emf, const char *classid); +EMFormatHTMLPObject *em_format_html_add_pobject(EMFormatHTML *efh, size_t size, const char *classid, struct _CamelMimePart *part, EMFormatHTMLPObjectFunc func); +EMFormatHTMLPObject *em_format_html_find_pobject(EMFormatHTML *emf, const char *classid); EMFormatHTMLPObject *em_format_html_find_pobject_func(EMFormatHTML *emf, struct _CamelMimePart *part, EMFormatHTMLPObjectFunc func); void em_format_html_remove_pobject(EMFormatHTML *emf, EMFormatHTMLPObject *pobject); void em_format_html_clear_pobject(EMFormatHTML *emf); diff --git a/mail/em-format.c b/mail/em-format.c index d2333de83e..b5f24716d9 100644 --- a/mail/em-format.c +++ b/mail/em-format.c @@ -1235,65 +1235,6 @@ emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons em_format_format_message(emf, stream, (CamelMedium *)dw); } -static void -emf_application_xpkcs7mime(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) -{ - CamelCipherContext *context; - CamelException *ex; - extern CamelSession *session; - CamelMimePart *opart; - CamelCipherValidity *valid; - - ex = camel_exception_new(); - - context = camel_smime_context_new(session); - - opart = camel_mime_part_new(); - valid = camel_cipher_decrypt(context, part, opart, ex); - if (valid == NULL) { - em_format_format_error(emf, stream, ex->desc?ex->desc:_("Could not parse S/MIME message: Unknown error")); - em_format_part_as(emf, stream, part, NULL); - } else { - switch (valid->encrypt.status) { - case CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE: - em_format_format_error(emf, stream, "No encryption?"); - break; - case CAMEL_CIPHER_VALIDITY_ENCRYPT_WEAK: - case CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED: - case CAMEL_CIPHER_VALIDITY_ENCRYPT_STRONG: - em_format_format_error(emf, stream, valid->encrypt.description); - break; - } - - em_format_part(emf, stream, opart); - - /* TODO: this is temporary */ - switch (valid->sign.status) { - case CAMEL_CIPHER_VALIDITY_SIGN_NONE: - em_format_format_error(emf, stream, "No signature?"); - break; - case CAMEL_CIPHER_VALIDITY_SIGN_GOOD: - em_format_format_error(emf, stream, "Good signature"); - em_format_format_error(emf, stream, valid->sign.description); - break; - case CAMEL_CIPHER_VALIDITY_SIGN_BAD: - em_format_format_error(emf, stream, "Bad signature"); - em_format_format_error(emf, stream, valid->sign.description); - break; - case CAMEL_CIPHER_VALIDITY_SIGN_UNKNOWN: - em_format_format_error(emf, stream, "Unknown signature"); - em_format_format_error(emf, stream, valid->sign.description); - break; - } - - camel_cipher_validity_free(valid); - } - - camel_object_unref(opart); - camel_object_unref(context); - camel_exception_free(ex); -} - static EMFormatHandler type_builtin_table[] = { { "multipart/alternative", emf_multipart_alternative }, { "multipart/appledouble", emf_multipart_appledouble }, @@ -1305,9 +1246,6 @@ static EMFormatHandler type_builtin_table[] = { { "message/rfc822", emf_message_rfc822 }, { "message/news", emf_message_rfc822 }, { "message/*", emf_message_rfc822 }, - - /* TODO: This should be done via a plugin? */ - { "application/x-pkcs7-mime",(EMFormatFunc)emf_application_xpkcs7mime }, }; static void diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c index 0aec7dcd32..10d8c8f1ff 100644 --- a/mail/mail-account-gui.c +++ b/mail/mail-account-gui.c @@ -50,6 +50,9 @@ #include "e-storage.h" +#if defined (HAVE_NSS) +#include "smime/gui/e-cert-selector.h" +#endif #define d(x) @@ -1432,9 +1435,26 @@ smime_changed(MailAccountGui *gui) } static void -smime_sign_key_select(GtkWidget *w, MailAccountGui *gui) +smime_sign_key_selected(GtkWidget *dialog, const char *key, MailAccountGui *gui) { - smime_changed(gui); + if (key != NULL) { + gtk_entry_set_text(gui->smime_sign_key, key); + smime_changed(gui); + } + + gtk_widget_destroy(dialog); +} + +static void +smime_sign_key_select(GtkWidget *button, MailAccountGui *gui) +{ + GtkWidget *w; + + w = e_cert_selector_new(E_CERT_SELECTOR_SIGNER, gtk_entry_get_text(gui->smime_sign_key)); + gtk_window_set_modal((GtkWindow *)w, TRUE); + gtk_window_set_transient_for((GtkWindow *)w, (GtkWindow *)gui->dialog); + g_signal_connect(w, "selected", G_CALLBACK(smime_sign_key_selected), gui); + gtk_widget_show(w); } static void @@ -1445,9 +1465,26 @@ smime_sign_key_clear(GtkWidget *w, MailAccountGui *gui) } static void -smime_encrypt_key_select(GtkWidget *w, MailAccountGui *gui) +smime_encrypt_key_selected(GtkWidget *dialog, const char *key, MailAccountGui *gui) { - smime_changed(gui); + if (key != NULL) { + gtk_entry_set_text(gui->smime_encrypt_key, key); + smime_changed(gui); + } + + gtk_widget_destroy(dialog); +} + +static void +smime_encrypt_key_select(GtkWidget *button, MailAccountGui *gui) +{ + GtkWidget *w; + + w = e_cert_selector_new(E_CERT_SELECTOR_SIGNER, gtk_entry_get_text(gui->smime_encrypt_key)); + gtk_window_set_modal((GtkWindow *)w, TRUE); + gtk_window_set_transient_for((GtkWindow *)w, (GtkWindow *)gui->dialog); + g_signal_connect(w, "selected", G_CALLBACK(smime_encrypt_key_selected), gui); + gtk_widget_show(w); } static void |