aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format-html-display.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-12-10 13:29:06 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-12-10 13:29:06 +0800
commit7789fb9e6646603ea84871d9c0858c12e376c804 (patch)
tree231a9d17a07d301c2d00929ddb70e0ba0dbee505 /mail/em-format-html-display.c
parentd940c0dad4a4dd5e9b4c5014893c111ebf28e9e7 (diff)
downloadgsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.tar
gsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.tar.gz
gsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.tar.bz2
gsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.tar.lz
gsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.tar.xz
gsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.tar.zst
gsoc2013-evolution-7789fb9e6646603ea84871d9c0858c12e376c804.zip
use a POSITIVE value for the response value, gtk uses -ative ones. Bug
2003-12-10 Not Zed <NotZed@Ximian.com> * em-folder-selector.h: use a POSITIVE value for the response value, gtk uses -ative ones. Bug #51752. * Makefile.am (INCLUDES): added smime/lib and smime/gui to includes. * em-folder-tree.c (emft_popup_rename_folder): removed unused 'why', why not? * em-format-html-display.c (efhd_xpkcs7mime_validity_clicked): setup a table of buttons to view any certs we have. * em-folder-browser.c (emfb_activate): separeate view_menu unreffing from view_instance. fixes a runtime warning. svn path=/trunk/; revision=23905
Diffstat (limited to 'mail/em-format-html-display.c')
-rw-r--r--mail/em-format-html-display.c78
1 files changed, 78 insertions, 0 deletions
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 808f8d030e..47c0041ff3 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -73,6 +73,9 @@
#include <e-util/e-gui-utils.h>
#include <e-util/e-dialog-utils.h>
+#include "certificate-viewer.h"
+#include "e-cert-db.h"
+
#include "mail-config.h"
#include "em-format-html-display.h"
@@ -590,6 +593,7 @@ efhd_complete(EMFormat *emf)
/* ********************************************************************** */
/* TODO: rename some of this stuff, it isn't 'smime' specific */
+/* TODO: move the dialogue elsehwere */
/* FIXME: also in em-format-html.c */
static const struct {
const char *icon, *shortdesc, *description;
@@ -635,6 +639,72 @@ efhd_xpkcs7mime_info_response(GtkWidget *w, guint button, struct _smime_pobject
}
static void
+efhd_xpkcs7mime_viewcert_clicked(GtkWidget *button, struct _smime_pobject *po)
+{
+ CamelCipherCertInfo *info = g_object_get_data((GObject *)button, "e-cert-info");
+ ECertDB *db = e_cert_db_peek();
+ ECert *ec = NULL;
+
+ if (info->email)
+ ec = e_cert_db_find_cert_by_email_address(db, info->email, NULL);
+
+ if (ec == NULL && info->name)
+ ec = e_cert_db_find_cert_by_nickname(db, info->name, NULL);
+
+ if (ec != NULL) {
+ GtkWidget *w = certificate_viewer_show(ec);
+
+ if (w && po->widget)
+ gtk_window_set_transient_for((GtkWindow *)w, (GtkWindow *)po->widget);
+
+ g_object_unref(ec);
+ } else {
+ g_warning("can't find certificate for %s <%s>", info->name?info->name:"", info->email?info->email:"");
+ }
+}
+
+static void
+efhd_xpkcs7mime_add_cert_table(GtkWidget *vbox, EDList *certlist, struct _smime_pobject *po)
+{
+ CamelCipherCertInfo *info = (CamelCipherCertInfo *)certlist->head;
+ GtkTable *table = (GtkTable *)gtk_table_new(e_dlist_length(certlist), 2, FALSE);
+ int n = 0;
+
+ while (info->next) {
+ char *la = NULL;
+ const char *l = NULL;
+
+ if (info->name) {
+ if (info->email && strcmp(info->name, info->email) != 0)
+ l = la = g_strdup_printf("%s <%s>", info->name, info->email);
+ else
+ l = info->name;
+ } else {
+ if (info->email)
+ l = info->email;
+ }
+
+ if (l) {
+ GtkWidget *w;
+
+ w = gtk_label_new(l);
+ gtk_misc_set_alignment((GtkMisc *)w, 0.0, 0.5);
+ g_free(la);
+ gtk_table_attach(table, w, 0, 1, n, n+1, GTK_FILL, GTK_FILL, 3, 3);
+ w = gtk_button_new_with_mnemonic(_("_View Certificate"));
+ gtk_table_attach(table, w, 1, 2, n, n+1, 0, 0, 3, 3);
+ g_object_set_data((GObject *)w, "e-cert-info", info);
+ g_signal_connect(w, "clicked", G_CALLBACK(efhd_xpkcs7mime_viewcert_clicked), po);
+ n++;
+ }
+
+ info = info->next;
+ }
+
+ gtk_box_pack_start((GtkBox *)vbox, (GtkWidget *)table, TRUE, TRUE, 6);
+}
+
+static void
efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject)
{
struct _smime_pobject *po = (struct _smime_pobject *)pobject;
@@ -659,6 +729,10 @@ efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject
gtk_label_set_line_wrap((GtkLabel *)w, FALSE);
gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6);
}
+
+ if (!e_dlist_empty(&po->valid->sign.signers))
+ efhd_xpkcs7mime_add_cert_table(vbox, &po->valid->sign.signers, po);
+
gtk_widget_show_all(vbox);
vbox = glade_xml_get_widget(xml, "encryption_vbox");
@@ -672,6 +746,10 @@ efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject
gtk_label_set_line_wrap((GtkLabel *)w, FALSE);
gtk_box_pack_start((GtkBox *)vbox, w, TRUE, TRUE, 6);
}
+
+ if (!e_dlist_empty(&po->valid->encrypt.encrypters))
+ efhd_xpkcs7mime_add_cert_table(vbox, &po->valid->encrypt.encrypters, po);
+
gtk_widget_show_all(vbox);
g_object_unref(xml);