[libnma/lr/gtk-4.0: 13/22] tests/cert-chooser: unitfy Gtk3 and Gtk4 layout




commit 0b743bf0ac44fb93d4f39078840b5db6d0f00b6f
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Tue Oct 12 10:21:03 2021 +0200

    tests/cert-chooser: unitfy Gtk3 and Gtk4 layout
    
    We do provide compatibility shim for gtk_box_append() that makes the
    whole #ifdef dance unnecessary.

 src/tests/cert-chooser.c | 44 +++++++++-----------------------------------
 1 file changed, 9 insertions(+), 35 deletions(-)
---
diff --git a/src/tests/cert-chooser.c b/src/tests/cert-chooser.c
index fc514811..e99f684a 100644
--- a/src/tests/cert-chooser.c
+++ b/src/tests/cert-chooser.c
@@ -33,25 +33,19 @@ main (int argc, char *argv[])
                                              "Dismiss",  GTK_RESPONSE_DELETE_EVENT,
                                              NULL);
        content = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog)));
+       gtk_orientable_set_orientation (GTK_ORIENTABLE (content), GTK_ORIENTATION_VERTICAL);
+
 #if GTK_CHECK_VERSION(3,90,0)
        gtk_box_set_spacing (content, 6);
 #endif
 
        widget = nma_cert_chooser_new ("Any", 0);
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        widget = nma_cert_chooser_new ("FLAG_PASSWORDS", NMA_CERT_CHOOSER_FLAG_PASSWORDS);
        nma_cert_chooser_set_cert (NMA_CERT_CHOOSER (widget),
@@ -60,43 +54,23 @@ main (int argc, char *argv[])
        nma_cert_chooser_set_key_uri (NMA_CERT_CHOOSER (widget),
                                      "pkcs11:object=worship;type=doom");
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        widget = nma_cert_chooser_new ("FLAG_CERT", NMA_CERT_CHOOSER_FLAG_CERT);
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        widget = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        widget = nma_cert_chooser_new ("FLAG_PEM", NMA_CERT_CHOOSER_FLAG_PEM);
        gtk_widget_show (widget);
-#if GTK_CHECK_VERSION(3,90,0)
-       gtk_container_add (GTK_CONTAINER (content), widget);
-#else
-       gtk_box_pack_start (content, widget, TRUE, TRUE, 6);
-#endif
+       gtk_box_append (content, widget);
 
        loop = g_main_loop_new (NULL, FALSE);
        g_signal_connect_swapped (dialog, "response", G_CALLBACK (g_main_loop_quit), loop);


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