[evolution] Use certificate widget provided by libedataserverui
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Use certificate widget provided by libedataserverui
- Date: Mon, 15 Aug 2022 13:43:27 +0000 (UTC)
commit 09bb9987eced7892cb1f55d247a4bb1cc64dc54b
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 15 15:40:46 2022 +0200
Use certificate widget provided by libedataserverui
This drops direct dependency on gcr as a side effect.
CMakeLists.txt | 13 ---
config.h.in | 3 -
flatpak/org.gnome.Evolution-master.json | 18 ---
src/addressbook/gui/contact-editor/CMakeLists.txt | 4 +
.../gui/contact-editor/e-contact-editor.c | 114 ++++++++++++-------
src/smime/gui/certificate-manager.c | 122 ++++-----------------
src/smime/gui/e-cert-selector.c | 54 ++-------
src/smime/lib/e-cert.c | 46 +-------
8 files changed, 116 insertions(+), 258 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14b7de2f79..8f5c10fe1e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,8 +75,6 @@ add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
set(eds_minimum_version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
set(enchant1_minimum_version 1.6.0)
set(enchant2_minimum_version 2.2.0)
-set(gcr3_minimum_version 3.4)
-set(gcr4_minimum_version 3.90.0)
set(gdk_pixbuf_minimum_version 2.24.0)
set(gnome_desktop_minimum_version 2.91.3)
set(gsettings_desktop_schemas_minimum_version 2.91.92)
@@ -253,20 +251,9 @@ else(ENABLE_GNOME_DESKTOP)
set(HAVE_GNOME_DESKTOP OFF)
endif(ENABLE_GNOME_DESKTOP)
-add_printable_option(WITH_GCR3 "Use gcr3, instead of gcr4" OFF)
-
-if(WITH_GCR3)
- set(GCR_DEPENDENCY gcr-3)
- set(gcr_minimum_version ${gcr3_minimum_version})
-else(WITH_GCR3)
- set(GCR_DEPENDENCY gcr-4-gtk3)
- set(gcr_minimum_version ${gcr4_minimum_version})
-endif(WITH_GCR3)
-
pkg_check_modules(GNOME_PLATFORM REQUIRED
cairo-gobject
gail-3.0>=${gdk_minimum_version}
- ${GCR_DEPENDENCY}>=${gcr_minimum_version}
gdk-pixbuf-2.0>=${gdk_pixbuf_minimum_version}
gio-2.0>=${glib_minimum_version}
${GIO_UNIX_REQUIREMENT}
diff --git a/config.h.in b/config.h.in
index 90f15a8394..0b6ea1fb1c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -122,6 +122,3 @@
/* Define if libical-glib has I_CAL_EMAIL_PARAMETER */
#cmakedefine HAVE_I_CAL_EMAIL_PARAMETER 1
-
-/* Defined, when using gcr3, not gcr4 */
-#cmakedefine WITH_GCR3 1
diff --git a/flatpak/org.gnome.Evolution-master.json b/flatpak/org.gnome.Evolution-master.json
index 8a64787054..2a19161354 100644
--- a/flatpak/org.gnome.Evolution-master.json
+++ b/flatpak/org.gnome.Evolution-master.json
@@ -327,24 +327,6 @@
]
},
- {
- "name": "gcr",
- "buildsystem": "meson",
- "config-opts": [
- "-Dintrospection=false",
- "-Dvapi=false",
- "-Dgtk4=false",
- "-Dgtk_doc=false"
- ],
- "sources": [
- {
- "type": "git",
- "url": "https://gitlab.gnome.org/GNOME/gcr.git",
- "branch": "master"
- }
- ]
- },
-
{
"name": "webkit2gtk3",
"buildsystem": "cmake-ninja",
diff --git a/src/addressbook/gui/contact-editor/CMakeLists.txt
b/src/addressbook/gui/contact-editor/CMakeLists.txt
index aca6e8fba9..0051446a41 100644
--- a/src/addressbook/gui/contact-editor/CMakeLists.txt
+++ b/src/addressbook/gui/contact-editor/CMakeLists.txt
@@ -9,6 +9,10 @@ set(DEPENDENCIES
evolution-util
)
+if(ENABLE_SMIME)
+ list(APPEND DEPENDENCIES essmime)
+endif(ENABLE_SMIME)
+
set(SOURCES
eab-editor.c
eab-editor.h
diff --git a/src/addressbook/gui/contact-editor/e-contact-editor.c
b/src/addressbook/gui/contact-editor/e-contact-editor.c
index ff52cde4da..40258a9adb 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -33,13 +33,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#define GCR_API_SUBJECT_TO_CHANGE
-#ifdef WITH_GCR3
-#include <gcr/gcr.h>
-#else
-#include <gcr-gtk3/gcr-gtk3.h>
-#endif
-#undef GCR_API_SUBJECT_TO_CHANGE
+#include <libedataserverui/libedataserverui.h>
#include "shell/e-shell.h"
#include "e-util/e-util.h"
@@ -53,6 +47,10 @@
#include "e-contact-editor-fullname.h"
#include "e-contact-editor-dyntable.h"
+#ifdef ENABLE_SMIME
+#include "smime/lib/e-cert.h"
+#endif
+
#define SLOTS_PER_LINE 2
#define SLOTS_IN_COLLAPSED_STATE SLOTS_PER_LINE
#define EMAIL_SLOTS 50
@@ -3177,8 +3175,7 @@ enum CertColumns {
CERT_COLUMN_SUBJECT_STRING,
CERT_COLUMN_KIND_STRING,
CERT_COLUMN_KIND_INT,
- CERT_COLUMN_DATA_ECONTACTCERT,
- CERT_COLUMN_CERT_GCRCERTIFICATE,
+ CERT_COLUMN_CERT_BYTES,
N_CERT_COLUMNS
};
@@ -3213,18 +3210,18 @@ cert_tab_selection_changed_cb (GtkTreeSelection *selection,
if (GTK_IS_VIEWPORT (widget))
widget = gtk_bin_get_child (GTK_BIN (widget));
- g_return_if_fail (GCR_IS_CERTIFICATE_WIDGET (widget));
+ g_return_if_fail (E_IS_CERTIFICATE_WIDGET (widget));
if (has_selected) {
- GcrCertificate *cert = NULL;
+ GBytes *cert_bytes = NULL;
- gtk_tree_model_get (model, &iter, CERT_COLUMN_CERT_GCRCERTIFICATE, &cert, -1);
+ gtk_tree_model_get (model, &iter, CERT_COLUMN_CERT_BYTES, &cert_bytes, -1);
- gcr_certificate_widget_set_certificate (GCR_CERTIFICATE_WIDGET (widget), cert);
+ e_certificate_widget_set_der (E_CERTIFICATE_WIDGET (widget), g_bytes_get_data (cert_bytes,
NULL), g_bytes_get_size (cert_bytes));
- g_clear_object (&cert);
+ g_clear_pointer (&cert_bytes, g_bytes_unref);
} else {
- gcr_certificate_widget_set_certificate (GCR_CERTIFICATE_WIDGET (widget), NULL);
+ e_certificate_widget_set_der (E_CERTIFICATE_WIDGET (widget), NULL, 0);
}
}
@@ -3313,7 +3310,7 @@ cert_update_row_with_cert (GtkListStore *list_store,
EContactCert *cert,
enum CertKind kind)
{
- GcrCertificate *gcr_cert = NULL;
+ GBytes *cert_bytes;
gchar *subject = NULL;
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
@@ -3321,21 +3318,65 @@ cert_update_row_with_cert (GtkListStore *list_store,
g_return_if_fail (cert != NULL);
g_return_if_fail (kind == CERT_KIND_PGP || kind == CERT_KIND_X509);
- if (kind == CERT_KIND_X509) {
- gcr_cert = gcr_simple_certificate_new ((const guchar *) cert->data, cert->length);
- if (gcr_cert)
- subject = gcr_certificate_get_subject_name (gcr_cert);
+ if (kind == CERT_KIND_X509 && cert->data && cert->length) {
+ #ifdef ENABLE_SMIME
+ ECert *ecert;
+
+ ecert = e_cert_new_from_der (cert->data, cert->length);
+ if (ecert) {
+ const gchar *ident;
+
+ ident = e_cert_get_cn (ecert);
+ if (!ident || !*ident)
+ ident = e_cert_get_email (ecert);
+ if (!ident || !*ident)
+ ident = e_cert_get_subject_name (ecert);
+
+ subject = g_strdup (ident);
+
+ g_object_unref (ecert);
+ }
+ #else
+ GTlsCertificate *tls_cert;
+
+ tls_cert = g_tls_certificate_new_from_pem (cert->data, cert->length, NULL);
+ if (!tls_cert) {
+ gchar *encoded;
+
+ encoded = g_base64_encode ((const guchar *) cert->data, cert->length);
+ if (encoded) {
+ GString *pem = g_string_sized_new (cert->length + 60);
+
+ g_string_append (pem, "-----BEGIN CERTIFICATE-----\n");
+ g_string_append (pem, encoded);
+ g_string_append (pem, "\n-----END CERTIFICATE-----\n");
+
+ tls_cert = g_tls_certificate_new_from_pem (pem->str, pem->len, NULL);
+
+ g_string_free (pem, TRUE);
+ }
+
+ g_free (encoded);
+ }
+
+ if (tls_cert) {
+ subject = g_tls_certificate_get_subject_name (tls_cert);
+
+ g_clear_object (&tls_cert);
+ }
+ #endif
}
+ cert_bytes = g_bytes_new (cert->data, cert->length);
+
gtk_list_store_set (list_store, iter,
CERT_COLUMN_SUBJECT_STRING, subject,
CERT_COLUMN_KIND_STRING, kind == CERT_KIND_X509 ? C_("cert-kind", "X.509") : C_("cert-kind",
"PGP"),
CERT_COLUMN_KIND_INT, kind,
- CERT_COLUMN_DATA_ECONTACTCERT, cert,
- CERT_COLUMN_CERT_GCRCERTIFICATE, gcr_cert,
+ CERT_COLUMN_CERT_BYTES, cert_bytes,
-1);
- g_clear_object (&gcr_cert);
+ g_clear_pointer (&cert_bytes, g_bytes_unref);
g_free (subject);
}
@@ -3475,7 +3516,7 @@ cert_save_btn_clicked_cb (GtkWidget *button,
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
- EContactCert *cert = NULL;
+ GBytes *cert_bytes = NULL;
gint kind = -1;
GtkWindow *parent;
GtkFileChooserNative *native;
@@ -3492,11 +3533,11 @@ cert_save_btn_clicked_cb (GtkWidget *button,
gtk_tree_model_get (model, &iter,
CERT_COLUMN_KIND_INT, &kind,
- CERT_COLUMN_DATA_ECONTACTCERT, &cert,
+ CERT_COLUMN_CERT_BYTES, &cert_bytes,
-1);
g_return_if_fail (kind == CERT_KIND_X509 || kind == CERT_KIND_PGP);
- g_return_if_fail (cert != NULL);
+ g_return_if_fail (cert_bytes != NULL);
parent = eab_editor_get_window (EAB_EDITOR (editor));
native = gtk_file_chooser_native_new (
@@ -3517,14 +3558,14 @@ cert_save_btn_clicked_cb (GtkWidget *button,
if (!filename) {
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("Chosen file is
not a local file."));
} else {
- g_file_set_contents (filename, cert->data, cert->length, &error);
+ g_file_set_contents (filename, g_bytes_get_data (cert_bytes, NULL), g_bytes_get_size
(cert_bytes), &error);
}
g_free (filename);
}
g_object_unref (native);
- e_contact_cert_free (cert);
+ g_bytes_unref (cert_bytes);
if (error) {
e_notice (parent, GTK_MESSAGE_ERROR, _("Failed to save certificate: %s"), error->message);
@@ -3567,13 +3608,12 @@ init_certs (EContactEditor *editor)
G_TYPE_STRING, /* CERT_COLUMN_SUBJECT_STRING */
G_TYPE_STRING, /* CERT_COLUMN_KIND_STRING */
G_TYPE_INT, /* CERT_COLUMN_KIND_INT */
- E_TYPE_CONTACT_CERT, /* CERT_COLUMN_DATA_ECONTACTCERT */
- GCR_TYPE_CERTIFICATE); /* CERT_COLUMN_CERT_GCRCERTIFICATE */
+ G_TYPE_BYTES); /* CERT_COLUMN_CERT_BYTES */
gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
- certificate_widget = GTK_WIDGET (gcr_certificate_widget_new (NULL));
- gtk_widget_show_all (certificate_widget);
+ certificate_widget = e_certificate_widget_new ();
+ gtk_widget_show (certificate_widget);
widget = e_builder_get_widget (editor->priv->builder, "cert-preview-scw");
gtk_container_add (GTK_CONTAINER (widget), certificate_widget);
@@ -3676,15 +3716,15 @@ extract_certs_for_kind (EContactEditor *editor,
if (is_field_supported (editor, field)) {
valid = gtk_tree_model_get_iter_first (model, &iter);
while (valid) {
- EContactCert *cert = NULL;
+ GBytes *cert_bytes = NULL;
gint set_kind = -1;
gtk_tree_model_get (model, &iter,
CERT_COLUMN_KIND_INT, &set_kind,
- CERT_COLUMN_DATA_ECONTACTCERT, &cert,
+ CERT_COLUMN_CERT_BYTES, &cert_bytes,
-1);
- if (cert && set_kind == kind) {
+ if (cert_bytes && set_kind == kind) {
EVCardAttribute *attr;
attr = e_vcard_attribute_new ("", e_contact_vcard_attribute (field));
@@ -3696,12 +3736,12 @@ extract_certs_for_kind (EContactEditor *editor,
e_vcard_attribute_param_new (EVC_ENCODING),
"b");
- e_vcard_attribute_add_value_decoded (attr, cert->data, cert->length);
+ e_vcard_attribute_add_value_decoded (attr, g_bytes_get_data (cert_bytes,
NULL), g_bytes_get_size (cert_bytes));
attrs = g_list_prepend (attrs, attr);
}
- e_contact_cert_free (cert);
+ g_clear_pointer (&cert_bytes, g_bytes_unref);
valid = gtk_tree_model_iter_next (model, &iter);
}
diff --git a/src/smime/gui/certificate-manager.c b/src/smime/gui/certificate-manager.c
index c00dbeab12..0353f69c3e 100644
--- a/src/smime/gui/certificate-manager.c
+++ b/src/smime/gui/certificate-manager.c
@@ -43,17 +43,7 @@
#include <pkcs11.h>
#include <pk11func.h>
-/* XXX Hack to disable p11-kit's pkcs11.h header, since
- * NSS headers supply the same PKCS #11 definitions. */
-#define PKCS11_H 1
-
-/* XXX Yeah, yeah... */
-#define GCR_API_SUBJECT_TO_CHANGE
-#ifdef WITH_GCR3
-#include <gcr/gcr.h>
-#else
-#include <gcr-gtk3/gcr-gtk3.h>
-#endif
+#include <libedataserverui/libedataserverui.h>
#include "shell/e-shell.h"
@@ -1221,87 +1211,14 @@ load_mail_certs (ECertManagerConfig *ecmc)
g_slist_free_full (camel_certs, (GDestroyNotify) camel_cert_unref);
}
-static void
-cert_manager_parser_parsed_cb (GcrParser *parser,
- GcrParsed **out_parsed)
-{
- GcrParsed *parsed;
-
- parsed = gcr_parser_get_parsed (parser);
- g_return_if_fail (parsed != NULL);
-
- *out_parsed = gcr_parsed_ref (parsed);
-}
-
static GtkWidget *
-cm_prepare_certificate_widget (GcrCertificate *certificate)
+cm_prepare_certificate_widget (gconstpointer data,
+ gsize length)
{
- GcrParser *parser;
- GcrParsed *parsed = NULL;
GtkWidget *widget;
- const guchar *der_data = NULL;
- gsize der_length;
- GError *local_error = NULL;
-
- g_return_val_if_fail (GCR_IS_CERTIFICATE (certificate), NULL);
-
- der_data = gcr_certificate_get_der_data (certificate, &der_length);
-
- parser = gcr_parser_new ();
- g_signal_connect (
- parser, "parsed",
- G_CALLBACK (cert_manager_parser_parsed_cb), &parsed);
- gcr_parser_parse_data (
- parser, der_data, der_length, &local_error);
- g_object_unref (parser);
-
- /* Sanity check. */
- g_return_val_if_fail (
- ((parsed != NULL) && (local_error == NULL)) ||
- ((parsed == NULL) && (local_error != NULL)), NULL);
-
- if (local_error != NULL) {
- g_warning ("%s: %s", G_STRFUNC, local_error->message);
- g_clear_error (&local_error);
- return NULL;
- }
-
- #ifdef WITH_GCR3
- {
- GcrCertificateWidget *certificate_widget;
- GckAttributes *attributes;
- attributes = gcr_parsed_get_attributes (parsed);
- certificate_widget = gcr_certificate_widget_new (certificate);
- gcr_certificate_widget_set_attributes (certificate_widget, attributes);
-
- widget = GTK_WIDGET (certificate_widget);
- }
- #else
- {
- GtkWidget *scrolled_window;
-
- widget = gcr_certificate_widget_new (certificate);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- g_object_set (scrolled_window,
- "halign", GTK_ALIGN_FILL,
- "hexpand", TRUE,
- "valign", GTK_ALIGN_FILL,
- "vexpand", TRUE,
- "hscrollbar-policy", GTK_POLICY_NEVER,
- "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
- "propagate-natural-height", TRUE,
- "shadow-type", GTK_SHADOW_NONE,
- NULL);
-
- gtk_container_add (GTK_CONTAINER (scrolled_window), widget);
-
- widget = scrolled_window;
- }
- #endif
-
- gcr_parsed_unref (parsed);
+ widget = e_certificate_widget_new ();
+ e_certificate_widget_set_der (E_CERTIFICATE_WIDGET (widget), data, length);
return widget;
}
@@ -1343,7 +1260,6 @@ mail_cert_edit_trust (GtkWidget *parent,
GtkWidget *dialog, *label, *expander, *content_area, *certificate_widget;
GtkWidget *runknown, *rtemporary, *rnever, *rmarginal, *rfully, *rultimate;
GtkGrid *grid;
- GcrCertificate *certificate;
gchar *text;
gboolean changed = FALSE;
gint row;
@@ -1351,9 +1267,7 @@ mail_cert_edit_trust (GtkWidget *parent,
g_return_val_if_fail (camel_cert != NULL, FALSE);
g_return_val_if_fail (camel_cert->rawcert != NULL, FALSE);
- certificate = gcr_simple_certificate_new (g_bytes_get_data (camel_cert->rawcert, NULL),
g_bytes_get_size (camel_cert->rawcert));
- certificate_widget = cm_prepare_certificate_widget (certificate);
- g_clear_object (&certificate);
+ certificate_widget = cm_prepare_certificate_widget (g_bytes_get_data (camel_cert->rawcert, NULL),
g_bytes_get_size (camel_cert->rawcert));
g_return_val_if_fail (certificate_widget != NULL, FALSE);
@@ -1365,6 +1279,7 @@ mail_cert_edit_trust (GtkWidget *parent,
NULL);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
@@ -2189,27 +2104,36 @@ GtkWidget *
e_cert_manager_new_certificate_viewer (GtkWindow *parent,
ECert *cert)
{
- GcrCertificate *certificate;
GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *widget, *certificate_widget;
- gchar *subject_name;
+ gchar *data = NULL;
+ guint32 len = 0;
+ const gchar *title;
g_return_val_if_fail (cert != NULL, NULL);
- certificate = GCR_CERTIFICATE (cert);
+ if (!e_cert_get_raw_der (cert, &data, &len)) {
+ data = NULL;
+ len = 0;
+ }
- certificate_widget = cm_prepare_certificate_widget (certificate);
+ certificate_widget = cm_prepare_certificate_widget (data, (gsize) len);
- subject_name = gcr_certificate_get_subject_name (certificate);
+ title = e_cert_get_cn (cert);
+ if (!title || !*title)
+ title = e_cert_get_email (cert);
+ if (!title || !*title)
+ title = e_cert_get_subject_name (cert);
dialog = gtk_dialog_new_with_buttons (
- subject_name, parent,
+ title, parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
_("_Close"), GTK_RESPONSE_CLOSE,
NULL);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
@@ -2218,7 +2142,5 @@ e_cert_manager_new_certificate_viewer (GtkWindow *parent,
gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
gtk_widget_show_all (widget);
- g_free (subject_name);
-
return dialog;
}
diff --git a/src/smime/gui/e-cert-selector.c b/src/smime/gui/e-cert-selector.c
index 24e084683b..b267641bcb 100644
--- a/src/smime/gui/e-cert-selector.c
+++ b/src/smime/gui/e-cert-selector.c
@@ -24,6 +24,8 @@
#include <glib/gi18n.h>
+#include <libedataserverui/libedataserverui.h>
+
#include "nss.h"
#include "pk11func.h"
#include "certdb.h"
@@ -34,17 +36,6 @@
#include "e-util/e-util.h"
#include "e-util/e-util-private.h"
-/* XXX Hack to disable p11-kit's pkcs11.h header, since
- * NSS headers supply the same PKCS #11 definitions. */
-#define PKCS11_H 1
-
-#define GCR_API_SUBJECT_TO_CHANGE
-#ifdef WITH_GCR3
-#include <gcr/gcr.h>
-#else
-#include <gcr-gtk3/gcr-gtk3.h>
-#endif
-
#include "smime/lib/e-cert.h"
#define E_CERT_SELECTOR_GET_PRIVATE(obj) \
@@ -55,7 +46,7 @@ struct _ECertSelectorPrivate {
CERTCertList *certlist;
GtkWidget *combobox;
- GcrCertificateWidget *cert_widget;
+ GtkWidget *cert_widget;
};
enum {
@@ -125,11 +116,10 @@ ecs_cert_changed (GtkWidget *w,
CERTCertListNode *node;
node = ecs_find_current (ecs);
- if (node) {
- ECert *ecert = e_cert_new (CERT_DupCertificate ((CERTCertificate *) node->cert));
- gcr_certificate_widget_set_certificate (p->cert_widget, GCR_CERTIFICATE (ecert));
- g_object_unref (ecert);
- }
+ if (node && node->cert)
+ e_certificate_widget_set_der (E_CERTIFICATE_WIDGET (p->cert_widget),
node->cert->derCert.data, node->cert->derCert.len);
+ else
+ e_certificate_widget_set_der (E_CERTIFICATE_WIDGET (p->cert_widget), NULL, 0);
}
/**
@@ -161,9 +151,6 @@ e_cert_selector_new (gint type,
GtkBuilder *builder;
GtkWidget *content_area;
GtkWidget *w;
- #ifndef WITH_GCR3
- GtkWidget *scrolled_window;
- #endif
GtkListStore *store;
GtkTreeIter iter;
gint n = 0, active = 0;
@@ -175,29 +162,11 @@ e_cert_selector_new (gint type,
e_load_ui_builder_definition (builder, "smime-ui.ui");
p->combobox = e_builder_get_widget (builder, "cert_combobox");
- p->cert_widget = GCR_CERTIFICATE_WIDGET (gcr_certificate_widget_new (NULL));
+ p->cert_widget = e_certificate_widget_new ();
w = e_builder_get_widget (builder, "cert_selector_vbox");
content_area = gtk_dialog_get_content_area (GTK_DIALOG (ecs));
- #ifdef WITH_GCR3
- gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (p->cert_widget));
- #else
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- g_object_set (scrolled_window,
- "halign", GTK_ALIGN_FILL,
- "hexpand", TRUE,
- "valign", GTK_ALIGN_FILL,
- "vexpand", TRUE,
- "hscrollbar-policy", GTK_POLICY_NEVER,
- "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
- "propagate-natural-height", TRUE,
- "shadow-type", GTK_SHADOW_NONE,
- NULL);
-
- gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (p->cert_widget));
-
- gtk_container_add (GTK_CONTAINER (w), scrolled_window);
- #endif
+ gtk_container_add (GTK_CONTAINER (w), p->cert_widget);
gtk_widget_show_all (w);
gtk_box_pack_start (GTK_BOX (content_area), w, TRUE, TRUE, 3);
gtk_window_set_title (GTK_WINDOW (ecs), _("Select certificate"));
@@ -255,12 +224,13 @@ e_cert_selector_new (gint type,
static void
e_cert_selector_init (ECertSelector *ecs)
{
+ ecs->priv = E_CERT_SELECTOR_GET_PRIVATE (ecs);
+ gtk_window_set_default_size (GTK_WINDOW (ecs), 400, 300);
+
gtk_dialog_add_buttons (
GTK_DIALOG (ecs),
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK, NULL);
-
- ecs->priv = E_CERT_SELECTOR_GET_PRIVATE (ecs);
}
static void
diff --git a/src/smime/lib/e-cert.c b/src/smime/lib/e-cert.c
index 55a34eb71e..b6daa00233 100644
--- a/src/smime/lib/e-cert.c
+++ b/src/smime/lib/e-cert.c
@@ -55,19 +55,6 @@
#include "certdb.h"
#include "hasht.h"
-/* XXX Hack to disable p11-kit's pkcs11.h header, since
- * NSS headers supply the same PKCS #11 definitions. */
-#define PKCS11_H 1
-
-/* XXX Yeah, yeah */
-#define GCR_API_SUBJECT_TO_CHANGE
-
-#ifdef WITH_GCR3
-#include <gcr/gcr-base.h>
-#else
-#include <gcr/gcr.h>
-#endif
-
#define E_CERT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_CERT, ECertPrivate))
@@ -102,18 +89,7 @@ struct _ECertPrivate {
gboolean delete;
};
-/* Forward Declarations */
-static void e_cert_gcr_certificate_init
- (GcrCertificateIface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (
- ECert,
- e_cert,
- G_TYPE_OBJECT,
- GCR_CERTIFICATE_MIXIN_IMPLEMENT_COMPARABLE ()
- G_IMPLEMENT_INTERFACE (
- GCR_TYPE_CERTIFICATE,
- e_cert_gcr_certificate_init))
+G_DEFINE_TYPE (ECert, e_cert, G_TYPE_OBJECT)
static void
e_cert_finalize (GObject *object)
@@ -170,17 +146,6 @@ e_cert_finalize (GObject *object)
G_OBJECT_CLASS (e_cert_parent_class)->finalize (object);
}
-static const guchar *
-cert_get_der_data (GcrCertificate *certificate,
- gsize *n_data)
-{
- ECertPrivate *priv = E_CERT_GET_PRIVATE (certificate);
-
- *n_data = priv->cert->derCert.len;
-
- return priv->cert->derCert.data;
-}
-
static void
e_cert_class_init (ECertClass *class)
{
@@ -189,16 +154,7 @@ e_cert_class_init (ECertClass *class)
g_type_class_add_private (class, sizeof (ECertPrivate));
object_class = G_OBJECT_CLASS (class);
- object_class->get_property = gcr_certificate_mixin_get_property;
object_class->finalize = e_cert_finalize;
-
- gcr_certificate_mixin_class_init (object_class);
-}
-
-static void
-e_cert_gcr_certificate_init (GcrCertificateIface *iface)
-{
- iface->get_der_data = cert_get_der_data;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]