[balsa/gtk4: 70/246] Various: Stop using GtkBox child properties




commit 0b471cbe2639283dd5d67983184dc2673408b87d
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Mon Jun 8 20:16:22 2020 -0400

    Various: Stop using GtkBox child properties
    
    Stop using GtkBox padding, fill and expand child properties.
    
    * libbalsa/identity.c (libbalsa_identity_select_dialog),
      (libbalsa_identity_config_dialog):
    * libbalsa/libbalsa-gpgme-cb.c (lb_gpgme_select_key):
    * libbalsa/libbalsa-gpgme-widgets.c (libbalsa_gpgme_key),
      (libbalsa_key_dialog), (create_key_label_with_warn),
      (create_subkey_widget), (smime_show_chain):
    * libbalsa/libbalsa.c (ask_cert_real):

 ChangeLog                         | 12 ++++++++++++
 libbalsa/identity.c               | 16 +++++++++++++---
 libbalsa/libbalsa-gpgme-cb.c      | 10 +++++++---
 libbalsa/libbalsa-gpgme-widgets.c | 29 +++++++++++++++++++++--------
 libbalsa/libbalsa.c               | 11 +++++++++--
 5 files changed, 62 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b3691ac9b..764468bcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -499,6 +499,18 @@
        * src/filter-run-dialog.c (balsa_filter_run_dialog_new): call
        prepare-threading to get ready for filtering.
 
+2020-06-07  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Various: Stop using GtkBox padding, fill and expand child properties
+
+       * libbalsa/identity.c (libbalsa_identity_select_dialog),
+       (libbalsa_identity_config_dialog):
+       * libbalsa/libbalsa-gpgme-cb.c (lb_gpgme_select_key):
+       * libbalsa/libbalsa-gpgme-widgets.c (libbalsa_gpgme_key),
+       (libbalsa_key_dialog), (create_key_label_with_warn),
+       (create_subkey_widget), (smime_show_chain):
+       * libbalsa/libbalsa.c (ask_cert_real):
+
 2020-06-06  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Various: Stop using GtkBox padding, fill and expand child properties
diff --git a/libbalsa/identity.c b/libbalsa/identity.c
index 037711ab0..2dd175d29 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -384,9 +384,13 @@ libbalsa_identity_select_dialog(GtkWindow * parent,
     identity_list_update_real(GTK_TREE_VIEW(tree), identities, initial_id);
 
     frame = gtk_frame_new(NULL);
+    gtk_widget_set_hexpand(frame, TRUE);
+    gtk_widget_set_vexpand(frame, TRUE);
+    gtk_widget_set_halign(frame, GTK_ALIGN_FILL);
+    gtk_widget_set_valign(frame, GTK_ALIGN_FILL);
     gtk_box_pack_start(GTK_BOX
                        (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       frame, TRUE, TRUE, 0);
+                       frame, FALSE, FALSE, 0);
     gtk_container_add(GTK_CONTAINER(frame), tree);
     gtk_container_set_border_width(GTK_CONTAINER(frame), padding);
 
@@ -1673,9 +1677,13 @@ libbalsa_identity_config_dialog(GtkWindow *parent, GList **identities,
                                     IDENTITY_RESPONSE_CLOSE);
 
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, padding);
+    gtk_widget_set_hexpand(hbox, TRUE);
+    gtk_widget_set_vexpand(hbox, TRUE);
+    gtk_widget_set_halign(hbox, GTK_ALIGN_FILL);
+    gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
     gtk_box_pack_start(GTK_BOX
                        (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       hbox, TRUE, TRUE, 0);
+                       hbox, FALSE, FALSE, 0);
 
     gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0);
 
@@ -1688,7 +1696,9 @@ libbalsa_identity_config_dialog(GtkWindow *parent, GList **identities,
                      (GWeakNotify) lbi_free_smtp_server_list,
                      smtp_server_list);
 
-    gtk_box_pack_start(GTK_BOX(hbox), display_frame, TRUE, TRUE, 0);
+    gtk_widget_set_hexpand(display_frame, TRUE);
+    gtk_widget_set_halign(display_frame, GTK_ALIGN_FILL);
+    gtk_box_pack_start(GTK_BOX(hbox), display_frame, FALSE, FALSE, 0);
 
     select = gtk_tree_view_get_selection(tree);
     g_signal_connect(select, "changed",
diff --git a/libbalsa/libbalsa-gpgme-cb.c b/libbalsa/libbalsa-gpgme-cb.c
index 297574571..890669cf4 100644
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@ -218,11 +218,13 @@ lb_gpgme_select_key(const gchar * user_name, lb_key_sel_md_t mode, GList * keys,
        }
     label = libbalsa_create_wrap_label(prompt, FALSE);
     g_free(prompt);
-    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
+    gtk_widget_set_valign(label, GTK_ALIGN_FILL);
+    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
     label = gtk_label_new(_("Double-click key to show details"));
     gtk_widget_set_halign(label, GTK_ALIGN_START);
-    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 0);
+    gtk_widget_set_valign(label, GTK_ALIGN_FILL);
+    gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
     scrolled_window = gtk_scrolled_window_new(NULL, NULL);
     gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW
@@ -230,7 +232,9 @@ lb_gpgme_select_key(const gchar * user_name, lb_key_sel_md_t mode, GList * keys,
                                        GTK_SHADOW_ETCHED_IN);
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
+    gtk_widget_set_vexpand(scrolled_window, TRUE);
+    gtk_widget_set_valign(scrolled_window, GTK_ALIGN_FILL);
+    gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
 
     model = gtk_list_store_new(GPG_KEY_NUM_COLUMNS, G_TYPE_STRING,     /* user ID */
                               G_TYPE_STRING,   /* key bits */
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index 386868d6d..18951f474 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -218,13 +218,13 @@ libbalsa_gpgme_key(const gpgme_key_t     key,
                                /* if the signature is invalid, the fingerprint only the end of the subkey's 
fingerprint */
                                offs = strlen(subkey->fpr) - fingerprint_len;
                                if (strcmp(fingerprint, &subkey->fpr[offs]) == 0) {
-                                       gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey), 
FALSE, FALSE, 2);
+                                       gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey), 
FALSE, FALSE, 0);
                                }
                        } else if ((((subkey_capa & GPG_SUBKEY_CAP_SIGN) != 0U) && (subkey->can_sign != 0)) ||
                                           (((subkey_capa & GPG_SUBKEY_CAP_ENCRYPT) != 0U) && 
(subkey->can_encrypt != 0)) ||
                                           (((subkey_capa & GPG_SUBKEY_CAP_CERTIFY) != 0U) && 
(subkey->can_certify != 0)) ||
                                           (((subkey_capa & GPG_SUBKEY_CAP_AUTH) != 0U) && 
(subkey->can_authenticate != 0))) {
-                               gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey), FALSE, 
FALSE, 2);
+                               gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey), FALSE, 
FALSE, 0);
                        } else {
                                /* do not print this subkey */
                        }
@@ -403,7 +403,11 @@ libbalsa_key_dialog(GtkWindow            *parent,
 
        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
        gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
-       gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, TRUE, TRUE, 0);
+        gtk_widget_set_hexpand(hbox, TRUE);
+        gtk_widget_set_vexpand(hbox, TRUE);
+        gtk_widget_set_halign(hbox, GTK_ALIGN_FILL);
+        gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
+       gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), hbox, FALSE, FALSE, 0);
        gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
 
        /* standard key icon; "application-certificate" would be an alternative... */
@@ -412,7 +416,9 @@ libbalsa_key_dialog(GtkWindow            *parent,
        gtk_widget_set_valign(icon, GTK_ALIGN_START);
 
        vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
-       gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
+        gtk_widget_set_hexpand(vbox, TRUE);
+        gtk_widget_set_halign(vbox, GTK_ALIGN_FILL);
+       gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
        gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
 
        if (message1 != NULL) {
@@ -431,7 +437,9 @@ libbalsa_key_dialog(GtkWindow            *parent,
        }
 
        scrolledw = gtk_scrolled_window_new(NULL, NULL);
-       gtk_box_pack_start(GTK_BOX(vbox), scrolledw, TRUE, TRUE, 6);
+        gtk_widget_set_vexpand(scrolledw, TRUE);
+        gtk_widget_set_valign(scrolledw, GTK_ALIGN_FILL);
+       gtk_container_add(GTK_CONTAINER(vbox), scrolledw);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledw), GTK_POLICY_NEVER, 
GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolledw), 120);
 
@@ -604,9 +612,10 @@ create_key_label_with_warn(const gchar *text,
                buf = g_markup_printf_escaped("<span fgcolor=\"red\">%s</span>", text);
                label = libbalsa_create_wrap_label(buf, TRUE);
                g_free(buf);
-               gtk_widget_set_hexpand(label, TRUE);
                gtk_label_set_selectable(GTK_LABEL(label), TRUE);
-               gtk_box_pack_start(GTK_BOX(result), label, FALSE, TRUE, 0U);
+               gtk_widget_set_hexpand(label, TRUE);
+                gtk_widget_set_halign(label, GTK_ALIGN_FILL);
+               gtk_box_pack_start(GTK_BOX(result), label, FALSE, FALSE, 0U);
        } else {
                result = libbalsa_create_wrap_label(text, FALSE);
                gtk_widget_set_hexpand(result, TRUE);
@@ -635,6 +644,7 @@ create_subkey_widget(gpgme_subkey_t subkey)
 
        subkey_grid = gtk_grid_new();
        gtk_grid_set_column_spacing(GTK_GRID(subkey_grid), 6);
+        g_object_set(subkey_grid, "margin", 2, NULL);
 
        /* print a warning for a bad subkey status */
        details_str = create_status_str(subkey->expired != 0U, subkey->revoked != 0U, subkey->disabled != 0U, 
subkey->invalid != 0U);
@@ -766,7 +776,10 @@ smime_show_chain(GtkWidget *button, gpointer G_GNUC_UNUSED user_data)
        geometry_manager_attach(GTK_WINDOW(dialog), "CertChain");
        chain = x509_cert_chain_smime(g_object_get_data(G_OBJECT(button), "certid"));
        vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
-       gtk_box_pack_start(GTK_BOX(vbox), chain, TRUE, TRUE, 6);
+        gtk_widget_set_vexpand(chain, TRUE);
+        gtk_widget_set_valign(chain, GTK_ALIGN_FILL);
+        g_object_set(chain, "margin", 6, NULL);
+       gtk_box_pack_start(GTK_BOX(vbox), chain, FALSE, FALSE, 0);
 
        gtk_widget_show_all(vbox);
        gtk_dialog_run(GTK_DIALOG(dialog));
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 1cfbd0b70..03cd6202e 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -417,11 +417,18 @@ ask_cert_real(void *data)
     label = gtk_label_new(str->str);
     g_string_free(str, TRUE);
     gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+    g_object_set(label, "margin", 1, NULL);
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       label, FALSE, FALSE, 1);
+                       label, FALSE, FALSE, 0);
     gtk_widget_show(label);
+
+    gtk_widget_set_hexpand(cert_widget, TRUE);
+    gtk_widget_set_vexpand(cert_widget, TRUE);
+    gtk_widget_set_halign(cert_widget, GTK_ALIGN_FILL);
+    gtk_widget_set_valign(cert_widget, GTK_ALIGN_FILL);
+    g_object_set(cert_widget, "margin", 1, NULL);
     gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       cert_widget, TRUE, TRUE, 1);
+                       cert_widget, FALSE, FALSE, 0);
     gtk_widget_show_all(cert_widget);
 
     switch(gtk_dialog_run(GTK_DIALOG(dialog))) {


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