[evolution-data-server/wip/mcrha/gtk4] gcr4



commit 17e1afee0abb7fdb684c6c2d7bda612164638b3e
Author: Milan Crha <mcrha redhat com>
Date:   Fri Apr 29 08:01:58 2022 +0200

    gcr4

 CMakeLists.txt                              |  9 ++++----
 src/libebackend/CMakeLists.txt              |  3 ---
 src/libedataserver/CMakeLists.txt           |  3 ---
 src/libedataserver/e-source-registry.c      |  5 -----
 src/libedataserverui/CMakeLists.txt         |  6 ------
 src/libedataserverui/e-trust-prompt.c       | 32 +++++++----------------------
 src/modules/trust-prompt/trust-prompt-gtk.c | 12 +++++------
 src/modules/trust-prompt/trust-prompt.h     |  8 ++++++--
 8 files changed, 22 insertions(+), 56 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 075a2fd8c..6438124f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,7 +116,7 @@ add_definitions(-DSOUP_VERSION_MAX_ALLOWED=${soup_encoded_version})
 add_definitions(-DGLIB_VERSION_MIN_REQUIRED=${glib_encoded_version})
 add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
 
-set(gcr_minimum_version 3.4)
+set(gcr_minimum_version 3.90)
 set(libgdata_minimum_version 0.15.1)
 set(libical_glib_minimum_version 3.0.7)
 set(libsecret_minimum_version 0.5)
@@ -395,7 +395,7 @@ add_printable_option(ENABLE_GTK "Enable gtk+ support" ON)
 
 if(ENABLE_GTK)
        pkg_check_modules_for_option(ENABLE_GTK "GTK+ support" GTK gtk+-3.0>=${gdk_minimum_version})
-       pkg_check_modules_for_option(ENABLE_GTK "GTK+ support" GCR gcr-3>=${gcr_minimum_version})
+       pkg_check_modules_for_option(ENABLE_GTK "GTK+ support" GCR gcr-4-gtk3>=${gcr_minimum_version})
 
        set(HAVE_GTK 1)
 endif(ENABLE_GTK)
@@ -403,7 +403,7 @@ endif(ENABLE_GTK)
 add_printable_option(ENABLE_GTK4 "Enable gtk4 support" ON)
 if(ENABLE_GTK4)
        pkg_check_modules_for_option(ENABLE_GTK4 "gtk4 support" GTK4 gtk4>=${gdk4_minimum_version})
-       #pkg_check_modules_for_option(ENABLE_GTK4 "gtk4 support" GCR4 gcr-4>=${gcr4_minimum_version})
+       pkg_check_modules_for_option(ENABLE_GTK4 "gtk4 support" GCR4 gcr-4-gtk4>=${gcr_minimum_version})
 
        set(HAVE_GTK4 1)
 endif(ENABLE_GTK4)
@@ -498,12 +498,11 @@ endif(ENABLE_GOA)
 add_printable_option(ENABLE_BACKEND_PER_PROCESS "Enable backend per process support" OFF)
 
 # ***********************************
-# Check for libsecret and gcr-base
+# Check for libsecret
 # ***********************************
 
 if(NOT WIN32)
        pkg_check_modules(LIBSECRET REQUIRED libsecret-unstable>=${libsecret_minimum_version})
-       pkg_check_modules(GCR_BASE REQUIRED gcr-base-3>=${gcr_minimum_version})
 endif(NOT WIN32)
 
 # ******************************
diff --git a/src/libebackend/CMakeLists.txt b/src/libebackend/CMakeLists.txt
index 61c857ed7..896fd55b9 100644
--- a/src/libebackend/CMakeLists.txt
+++ b/src/libebackend/CMakeLists.txt
@@ -101,7 +101,6 @@ target_compile_options(ebackend PUBLIC
        ${LIBDB_CFLAGS}
        ${CAMEL_CFLAGS}
        ${SQLITE3_CFLAGS}
-       ${GCR_BASE_CFLAGS}
        ${GIO_UNIX_CFLAGS}
 )
 
@@ -117,7 +116,6 @@ target_include_directories(ebackend PUBLIC
        ${LIBDB_INCLUDE_DIRS}
        ${CAMEL_INCLUDE_DIRS}
        ${SQLITE3_INCLUDE_DIRS}
-       ${GCR_BASE_INCLUDE_DIRS}
        ${GIO_UNIX_INCLUDE_DIRS}
 )
 
@@ -128,7 +126,6 @@ target_link_libraries(ebackend
        ${LIBDB_LIBS}
        ${CAMEL_LDFLAGS}
        ${SQLITE3_LDFLAGS}
-       ${GCR_BASE_LDFLAGS}
        ${GIO_UNIX_LDFLAGS}
 )
 
diff --git a/src/libedataserver/CMakeLists.txt b/src/libedataserver/CMakeLists.txt
index 32fcb543a..cd0f41e48 100644
--- a/src/libedataserver/CMakeLists.txt
+++ b/src/libedataserver/CMakeLists.txt
@@ -256,7 +256,6 @@ target_compile_definitions(edataserver PRIVATE
 
 target_compile_options(edataserver PUBLIC
        ${DATA_SERVER_CFLAGS}
-       ${GCR_BASE_CFLAGS}
        ${GIO_UNIX_CFLAGS}
        ${ICU_CFLAGS}
        ${JSON_GLIB_CFLAGS}
@@ -272,7 +271,6 @@ target_include_directories(edataserver PUBLIC
        ${CMAKE_CURRENT_BINARY_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${DATA_SERVER_INCLUDE_DIRS}
-       ${GCR_BASE_INCLUDE_DIRS}
        ${GIO_UNIX_INCLUDE_DIRS}
        ${ICU_INCLUDE_DIRS}
        ${JSON_GLIB_INCLUDE_DIRS}
@@ -282,7 +280,6 @@ target_include_directories(edataserver PUBLIC
 target_link_libraries(edataserver
        ${DEPENDENCIES}
        ${DATA_SERVER_LDFLAGS}
-       ${GCR_BASE_LDFLAGS}
        ${GIO_UNIX_LDFLAGS}
        ${ICU_LDFLAGS}
        ${JSON_GLIB_LDFLAGS}
diff --git a/src/libedataserver/e-source-registry.c b/src/libedataserver/e-source-registry.c
index 837e940f3..6701a3acf 100644
--- a/src/libedataserver/e-source-registry.c
+++ b/src/libedataserver/e-source-registry.c
@@ -46,11 +46,6 @@
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
 
-/* XXX Yeah, yeah... */
-#define GCR_API_SUBJECT_TO_CHANGE
-
-#include <gcr/gcr-base.h>
-
 /* Private D-Bus classes. */
 #include "e-dbus-source.h"
 #include "e-dbus-source-manager.h"
diff --git a/src/libedataserverui/CMakeLists.txt b/src/libedataserverui/CMakeLists.txt
index 62c10390f..f51f51372 100644
--- a/src/libedataserverui/CMakeLists.txt
+++ b/src/libedataserverui/CMakeLists.txt
@@ -67,7 +67,6 @@ target_compile_options(edataserverui PUBLIC
        ${CAMEL_CFLAGS}
        ${CODE_COVERAGE_CFLAGS}
        ${GNOME_PLATFORM_CFLAGS}
-       ${GCR_BASE_CFLAGS}
        ${GCR_CFLAGS}
        ${GTK_CFLAGS}
        ${JSON_GLIB_CFLAGS}
@@ -83,7 +82,6 @@ target_include_directories(edataserverui PUBLIC
        ${CAMEL_INCLUDE_DIRS}
        ${CODE_COVERAGE_INCLUDE_DIRS}
        ${GNOME_PLATFORM_INCLUDE_DIRS}
-       ${GCR_BASE_INCLUDE_DIRS}
        ${GCR_INCLUDE_DIRS}
        ${GTK_INCLUDE_DIRS}
        ${JSON_GLIB_INCLUDE_DIRS}
@@ -96,7 +94,6 @@ target_link_libraries(edataserverui
        ${CAMEL_LDFLAGS}
        ${CODE_COVERAGE_LDFLAGS}
        ${GNOME_PLATFORM_LDFLAGS}
-       ${GCR_BASE_LDFLAGS}
        ${GCR_LDFLAGS}
        ${GTK_LDFLAGS}
        ${JSON_GLIB_LDFLAGS}
@@ -223,7 +220,6 @@ target_compile_options(edataserverui${UI_VERSION} PUBLIC
        ${CAMEL_CFLAGS}
        ${CODE_COVERAGE_CFLAGS}
        ${GNOME_PLATFORM_CFLAGS}
-       ${GCR4_BASE_CFLAGS}
        ${GCR4_CFLAGS}
        ${GTK4_CFLAGS}
        ${JSON_GLIB_CFLAGS}
@@ -239,7 +235,6 @@ target_include_directories(edataserverui${UI_VERSION} PUBLIC
        ${CAMEL_INCLUDE_DIRS}
        ${CODE_COVERAGE_INCLUDE_DIRS}
        ${GNOME_PLATFORM_INCLUDE_DIRS}
-       ${GCR4_BASE_INCLUDE_DIRS}
        ${GCR4_INCLUDE_DIRS}
        ${GTK4_INCLUDE_DIRS}
        ${JSON_GLIB_INCLUDE_DIRS}
@@ -252,7 +247,6 @@ target_link_libraries(edataserverui${UI_VERSION}
        ${CAMEL_LDFLAGS}
        ${CODE_COVERAGE_LDFLAGS}
        ${GNOME_PLATFORM_LDFLAGS}
-       ${GCR4_BASE_LDFLAGS}
        ${GCR4_LDFLAGS}
        ${GTK4_LDFLAGS}
        ${JSON_GLIB_LDFLAGS}
diff --git a/src/libedataserverui/e-trust-prompt.c b/src/libedataserverui/e-trust-prompt.c
index 8e1bd4e93..22a83f638 100644
--- a/src/libedataserverui/e-trust-prompt.c
+++ b/src/libedataserverui/e-trust-prompt.c
@@ -23,13 +23,15 @@
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
 
+#define GCR_API_SUBJECT_TO_CHANGE
+#define GCK_API_SUBJECT_TO_CHANGE
 #if GTK_CHECK_VERSION(4, 0, 0)
-#define GcrParsed void
+#include <gcr-gtk4/gcr-certificate-widget.h>
 #else
-#define GCR_API_SUBJECT_TO_CHANGE
-#include <gcr/gcr.h>
-#undef GCR_API_SUBJECT_TO_CHANGE
+#include <gcr-gtk3/gcr-gtk3.h>
 #endif
+#undef GCK_API_SUBJECT_TO_CHANGE
+#undef GCR_API_SUBJECT_TO_CHANGE
 
 #include "camel/camel.h"
 #include "libedataserver/libedataserver.h"
@@ -112,13 +114,9 @@ trust_prompt_show (GtkWindow *parent,
                   gpointer user_data)
 {
        ETrustPromptResponse response;
-#if !GTK_CHECK_VERSION(4, 0, 0)
-       GcrCertificateWidget *certificate_widget;
        GcrCertificate *certificate;
-       GckAttributes *attributes;
        const guchar *data;
        gsize length;
-#endif
        GtkWidget *dialog, *widget;
        GtkGrid *grid;
        gchar *bhost, *tmp;
@@ -246,21 +244,15 @@ trust_prompt_show (GtkWindow *parent,
        if (error_text)
                trust_prompt_add_info_line (grid, _("Detailed error:"), error_text, FALSE, TRUE, FALSE, &row);
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
        data = gcr_parsed_get_data (parsed, &length);
-       attributes = gcr_parsed_get_attributes (parsed);
 
        certificate = gcr_simple_certificate_new (data, length);
 
-       certificate_widget = gcr_certificate_widget_new (certificate);
-       gcr_certificate_widget_set_attributes (certificate_widget, attributes);
-
-       widget = GTK_WIDGET (certificate_widget);
+       widget = gcr_certificate_widget_new (certificate);
        gtk_grid_attach (grid, widget, 1, row, 2, 1);
        gtk_widget_show (widget);
 
        g_clear_object (&certificate);
-#endif
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
        gtk_widget_show_all (GTK_WIDGET (grid));
@@ -342,7 +334,6 @@ e_trust_prompt_describe_certificate_errors (GTlsCertificateFlags flags)
        return g_string_free (reason, FALSE);
 }
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
 static void
 trust_prompt_parser_parsed_cb (GcrParser *parser,
                               GcrParsed **out_parsed)
@@ -354,7 +345,6 @@ trust_prompt_parser_parsed_cb (GcrParser *parser,
 
        *out_parsed = gcr_parsed_ref (parsed);
 }
-#endif
 
 static ETrustPromptResponse
 e_trust_prompt_run_with_dialog_ready_callback (GtkWindow *parent,
@@ -368,9 +358,7 @@ e_trust_prompt_run_with_dialog_ready_callback (GtkWindow *parent,
                                               gpointer user_data)
 {
        ETrustPromptResponse response = E_TRUST_PROMPT_RESPONSE_UNKNOWN;
-#if !GTK_CHECK_VERSION(4, 0, 0)
        GcrParser *parser;
-#endif
        GcrParsed *parsed = NULL;
        GError *local_error = NULL;
 
@@ -379,7 +367,6 @@ e_trust_prompt_run_with_dialog_ready_callback (GtkWindow *parent,
        g_return_val_if_fail (host != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
        g_return_val_if_fail (certificate_pem != NULL, E_TRUST_PROMPT_RESPONSE_UNKNOWN);
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
        /* Continue even if PKCS#11 module registration fails.
         * Certificate details won't display correctly but the
         * user can still respond to the prompt. */
@@ -405,18 +392,13 @@ e_trust_prompt_run_with_dialog_ready_callback (GtkWindow *parent,
                ((parsed == NULL) && (local_error != NULL)));
 
        if (parsed != NULL) {
-#else
-       {
-#endif
                gchar *reason;
 
                reason = e_trust_prompt_describe_certificate_errors (certificate_errors);
 
                response = trust_prompt_show (parent, source_extension, source_display_name, host, 
error_text, parsed, reason, dialog_ready_cb, user_data);
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
                gcr_parsed_unref (parsed);
-#endif
                g_free (reason);
        }
 
diff --git a/src/modules/trust-prompt/trust-prompt-gtk.c b/src/modules/trust-prompt/trust-prompt-gtk.c
index 3d6d7f78e..3cbce6f9c 100644
--- a/src/modules/trust-prompt/trust-prompt-gtk.c
+++ b/src/modules/trust-prompt/trust-prompt-gtk.c
@@ -22,6 +22,10 @@
 
 #include <libebackend/libebackend.h>
 
+#define GCR_API_SUBJECT_TO_CHANGE
+#include <gcr-gtk3/gcr-gtk3.h>
+#undef GCR_API_SUBJECT_TO_CHANGE
+
 #include "trust-prompt.h"
 
 static void
@@ -115,9 +119,7 @@ trust_prompt_show (EUserPrompterServerExtension *extension,
                    GcrParsed *parsed,
                    const gchar *reason)
 {
-       GcrCertificateWidget *certificate_widget;
        GcrCertificate *certificate;
-       GckAttributes *attributes;
        GtkWidget *dialog, *widget;
        GtkGrid *grid;
        const guchar *data;
@@ -186,14 +188,10 @@ trust_prompt_show (EUserPrompterServerExtension *extension,
        trust_prompt_add_info_line (grid, _("Reason:"), reason, FALSE, &row);
 
        data = gcr_parsed_get_data (parsed, &length);
-       attributes = gcr_parsed_get_attributes (parsed);
 
        certificate = gcr_simple_certificate_new (data, length);
 
-       certificate_widget = gcr_certificate_widget_new (certificate);
-       gcr_certificate_widget_set_attributes (certificate_widget, attributes);
-
-       widget = GTK_WIDGET (certificate_widget);
+       widget = gcr_certificate_widget_new (certificate);
        gtk_grid_attach (grid, widget, 1, row, 2, 1);
        gtk_widget_show (widget);
 
diff --git a/src/modules/trust-prompt/trust-prompt.h b/src/modules/trust-prompt/trust-prompt.h
index da6b690e3..d40c6eed2 100644
--- a/src/modules/trust-prompt/trust-prompt.h
+++ b/src/modules/trust-prompt/trust-prompt.h
@@ -18,12 +18,14 @@
 #ifndef TRUST_PROMPT_H
 #define TRUST_PROMPT_H
 
-/* XXX Yeah, yeah... */
 #define GCR_API_SUBJECT_TO_CHANGE
+#include <gcr-gtk3/gcr-gtk3.h>
+#undef GCR_API_SUBJECT_TO_CHANGE
 
-#include <gcr/gcr.h>
 #include <libebackend/libebackend.h>
 
+G_BEGIN_DECLS
+
 /* This shows a trust-prompt. The function may not block and returns whether
  * showed a dialog or not. It calls e_user_prompter_server_extension_response()
  * when a user responded to the dialog with one of the TRUST_PROMPT_RESPONSE values.
@@ -42,4 +44,6 @@ trust_prompt_show (EUserPrompterServerExtension *extension,
                   GcrParsed *parsed,
                   const gchar *reason);
 
+G_END_DECLS
+
 #endif /* TRUST_PROMPT_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]