[evolution] Pack GcrCertificateWidget into a scrolled window and use show_all() on it



commit 4389a8664de1fae49be8c32ff93e2146131564c5
Author: Milan Crha <mcrha redhat com>
Date:   Tue Aug 9 11:48:23 2022 +0200

    Pack GcrCertificateWidget into a scrolled window and use show_all() on it
    
    This helps to show the certificate properly when using gcr4, because
    the GcrCertificateWidget is not scrollable on its own anymore and
    the content is hidden without using gtk_widget_show_all().

 .../gui/contact-editor/e-contact-editor.c          |  2 +-
 src/smime/gui/certificate-manager.c                | 24 ++++++++++++++++++++--
 src/smime/gui/e-cert-selector.c                    | 23 ++++++++++++++++++++-
 3 files changed, 45 insertions(+), 4 deletions(-)
---
diff --git a/src/addressbook/gui/contact-editor/e-contact-editor.c 
b/src/addressbook/gui/contact-editor/e-contact-editor.c
index 5061e29203..ff52cde4da 100644
--- a/src/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/src/addressbook/gui/contact-editor/e-contact-editor.c
@@ -3573,7 +3573,7 @@ init_certs (EContactEditor *editor)
        gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (list_store));
 
        certificate_widget = GTK_WIDGET (gcr_certificate_widget_new (NULL));
-       gtk_widget_show (certificate_widget);
+       gtk_widget_show_all (certificate_widget);
        widget = e_builder_get_widget (editor->priv->builder, "cert-preview-scw");
        gtk_container_add (GTK_CONTAINER (widget), certificate_widget);
 
diff --git a/src/smime/gui/certificate-manager.c b/src/smime/gui/certificate-manager.c
index 58568e5533..c00dbeab12 100644
--- a/src/smime/gui/certificate-manager.c
+++ b/src/smime/gui/certificate-manager.c
@@ -1278,7 +1278,27 @@ cm_prepare_certificate_widget (GcrCertificate *certificate)
                widget = GTK_WIDGET (certificate_widget);
        }
        #else
-       widget = gcr_certificate_widget_new (certificate);
+       {
+               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);
@@ -2196,7 +2216,7 @@ e_cert_manager_new_certificate_viewer (GtkWindow *parent,
        widget = GTK_WIDGET (certificate_widget);
        gtk_container_set_border_width (GTK_CONTAINER (widget), 5);
        gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0);
-       gtk_widget_show (widget);
+       gtk_widget_show_all (widget);
 
        g_free (subject_name);
 
diff --git a/src/smime/gui/e-cert-selector.c b/src/smime/gui/e-cert-selector.c
index 4986047c01..24e084683b 100644
--- a/src/smime/gui/e-cert-selector.c
+++ b/src/smime/gui/e-cert-selector.c
@@ -161,6 +161,9 @@ 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;
@@ -176,8 +179,26 @@ e_cert_selector_new (gint type,
 
        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));
-       gtk_widget_show (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_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"));
 


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