evolution/0001-Build-with-gcr4-by-default.patch

204 lines
6.5 KiB
Diff
Raw Normal View History

2022-07-19 19:03:08 +00:00
From f0df67904c3a71479808d56f33d22274e317b085 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Tue, 19 Jul 2022 18:54:42 +0200
Subject: [PATCH] Build with gcr4 by default
Use -DWITH_GCR3=ON to build with gcr3 instead. The gcr4 will replace gcr3
in the future, thus let the gcr4 be the default build option.
---
CMakeLists.txt | 15 +++++++++--
config.h.in | 3 +++
.../gui/contact-editor/e-contact-editor.c | 12 ++++++---
src/smime/gui/certificate-manager.c | 27 ++++++++++++++-----
src/smime/gui/e-cert-selector.c | 8 ++++--
src/smime/lib/e-cert.c | 4 +++
6 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 736428e888..21224b0606 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -75,7 +75,8 @@ 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(gcr_minimum_version 3.4)
+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)
@@ -252,10 +253,20 @@ 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-3>=${gcr_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 0b6ea1fb1c..90f15a8394 100644
--- a/config.h.in
+++ b/config.h.in
@@ -122,3 +122,6 @@
/* 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/src/addressbook/gui/contact-editor/e-contact-editor.c b/src/addressbook/gui/contact-editor/e-contact-editor.c
index 7bda5826da..d517f5f598 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -34,7 +34,11 @@
#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 "shell/e-shell.h"
@@ -3536,7 +3540,7 @@ init_certs (EContactEditor *editor)
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
- GcrCertificateWidget *certificate_widget;
+ GtkWidget *certificate_widget;
GtkWidget *widget;
tree_view = GTK_TREE_VIEW (e_builder_get_widget (editor->priv->builder, "certs-treeview"));
@@ -3568,10 +3572,10 @@ init_certs (EContactEditor *editor)
gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
- certificate_widget = gcr_certificate_widget_new (NULL);
- gtk_widget_show (GTK_WIDGET (certificate_widget));
+ certificate_widget = GTK_WIDGET (gcr_certificate_widget_new (NULL));
+ gtk_widget_show (certificate_widget);
widget = e_builder_get_widget (editor->priv->builder, "cert-preview-scw");
- gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (certificate_widget));
+ gtk_container_add (GTK_CONTAINER (widget), certificate_widget);
selection = gtk_tree_view_get_selection (tree_view);
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
diff --git a/src/smime/gui/certificate-manager.c b/src/smime/gui/certificate-manager.c
index 9e630f4921..58568e5533 100644
--- a/src/smime/gui/certificate-manager.c
+++ b/src/smime/gui/certificate-manager.c
@@ -49,8 +49,11 @@
/* 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 "shell/e-shell.h"
@@ -1235,8 +1238,7 @@ cm_prepare_certificate_widget (GcrCertificate *certificate)
{
GcrParser *parser;
GcrParsed *parsed = NULL;
- GckAttributes *attributes;
- GcrCertificateWidget *certificate_widget;
+ GtkWidget *widget;
const guchar *der_data = NULL;
gsize der_length;
GError *local_error = NULL;
@@ -1264,13 +1266,24 @@ cm_prepare_certificate_widget (GcrCertificate *certificate)
return NULL;
}
- attributes = gcr_parsed_get_attributes (parsed);
- certificate_widget = gcr_certificate_widget_new (certificate);
- gcr_certificate_widget_set_attributes (certificate_widget, attributes);
+ #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
+ widget = gcr_certificate_widget_new (certificate);
+ #endif
gcr_parsed_unref (parsed);
- return GTK_WIDGET (certificate_widget);
+ return widget;
}
static void
diff --git a/src/smime/gui/e-cert-selector.c b/src/smime/gui/e-cert-selector.c
index 77e492b1f9..4986047c01 100644
--- a/src/smime/gui/e-cert-selector.c
+++ b/src/smime/gui/e-cert-selector.c
@@ -39,7 +39,11 @@
#define PKCS11_H 1
#define GCR_API_SUBJECT_TO_CHANGE
-#include "gcr/gcr.h"
+#ifdef WITH_GCR3
+#include <gcr/gcr.h>
+#else
+#include <gcr-gtk3/gcr-gtk3.h>
+#endif
#include "smime/lib/e-cert.h"
@@ -168,7 +172,7 @@ 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_new (NULL);
+ p->cert_widget = GCR_CERTIFICATE_WIDGET (gcr_certificate_widget_new (NULL));
w = e_builder_get_widget (builder, "cert_selector_vbox");
content_area = gtk_dialog_get_content_area (GTK_DIALOG (ecs));
diff --git a/src/smime/lib/e-cert.c b/src/smime/lib/e-cert.c
index f6792cb352..88ffbffa83 100644
--- a/src/smime/lib/e-cert.c
+++ b/src/smime/lib/e-cert.c
@@ -62,7 +62,11 @@
/* 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 \
--
2.35.1