[balsa/gtk4: 147/311] Various: Stop using GtkBox child properties




commit e9a1144d4d7a019ef6f22e3640f12eb96a308d6a
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               | 14 +++++++++-----
 libbalsa/libbalsa-gpgme-cb.c      |  6 ++++--
 libbalsa/libbalsa-gpgme-widgets.c | 30 ++++++++++--------------------
 libbalsa/libbalsa.c               | 14 ++++++++------
 5 files changed, 43 insertions(+), 33 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2da928b7b..c519ef1b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -723,6 +723,18 @@
        * libbalsa/autocrypt.c (autocrypt_db_dialog_run):
        * libbalsa/html.c (libbalsa_html_new):
 
+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 84dfb2256..77da8565b 100644
--- a/libbalsa/identity.c
+++ b/libbalsa/identity.c
@@ -384,11 +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_container_add(GTK_CONTAINER
+    gtk_box_pack_start(GTK_BOX
                        (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       frame);
+                       frame, FALSE, FALSE, 0);
     gtk_container_add(GTK_CONTAINER(frame), tree);
     gtk_container_set_border_width(GTK_CONTAINER(frame), padding);
 
@@ -1675,11 +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_container_add(GTK_CONTAINER
+    gtk_box_pack_start(GTK_BOX
                        (gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       hbox);
+                       hbox, FALSE, FALSE, 0);
 
     gtk_container_add(GTK_CONTAINER(hbox), frame);
 
@@ -1694,7 +1698,7 @@ libbalsa_identity_config_dialog(GtkWindow *parent, GList **identities,
 
     gtk_widget_set_hexpand(display_frame, TRUE);
     gtk_widget_set_halign(display_frame, GTK_ALIGN_FILL);
-    gtk_container_add(GTK_CONTAINER(hbox), display_frame);
+    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 d06aef9eb..5cb077e6f 100644
--- a/libbalsa/libbalsa-gpgme-cb.c
+++ b/libbalsa/libbalsa-gpgme-cb.c
@@ -219,11 +219,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_container_add(GTK_CONTAINER(vbox), label);
+    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_container_add(GTK_CONTAINER(vbox), label);
+    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
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index 244499f30..213bc4a80 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -218,21 +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) {
-                                    GtkWidget *subkey_widget = create_subkey_widget(subkey);
-
-                                    gtk_widget_set_margin_top(subkey_widget, 2);
-                                    gtk_widget_set_margin_bottom(subkey_widget, 2);
-                                    gtk_container_add(GTK_CONTAINER(subkey_box), subkey_widget);
+                                       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))) {
-                            GtkWidget *subkey_widget = create_subkey_widget(subkey);
-
-                            gtk_widget_set_margin_top(subkey_widget, 2);
-                            gtk_widget_set_margin_bottom(subkey_widget, 2);
-                            gtk_container_add(GTK_CONTAINER(subkey_box), subkey_widget);
+                               gtk_box_pack_end(GTK_BOX(subkey_box), create_subkey_widget(subkey), FALSE, 
FALSE, 0);
                        } else {
                                /* do not print this subkey */
                        }
@@ -413,9 +405,11 @@ libbalsa_key_dialog(GtkWindow            *parent,
 
        hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
        gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
+        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_container_add(GTK_CONTAINER(content_area), hbox);
+       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... */
@@ -426,7 +420,7 @@ libbalsa_key_dialog(GtkWindow            *parent,
        vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
         gtk_widget_set_hexpand(vbox, TRUE);
         gtk_widget_set_halign(vbox, GTK_ALIGN_FILL);
-       gtk_container_add(GTK_CONTAINER(hbox), vbox);
+       gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
        gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
 
        if (message1 != NULL) {
@@ -447,8 +441,6 @@ libbalsa_key_dialog(GtkWindow            *parent,
        scrolledw = gtk_scrolled_window_new(NULL, NULL);
         gtk_widget_set_vexpand(scrolledw, TRUE);
         gtk_widget_set_valign(scrolledw, GTK_ALIGN_FILL);
-        gtk_widget_set_margin_top(scrolledw, 6);
-        gtk_widget_set_margin_bottom(scrolledw, 6);
        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);
@@ -625,7 +617,7 @@ create_key_label_with_warn(const gchar *text,
                gtk_label_set_selectable(GTK_LABEL(label), TRUE);
                gtk_widget_set_hexpand(label, TRUE);
                 gtk_widget_set_halign(label, GTK_ALIGN_FILL);
-               gtk_container_add(GTK_CONTAINER(result), label);
+               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);
@@ -654,8 +646,7 @@ create_subkey_widget(gpgme_subkey_t subkey)
 
        subkey_grid = gtk_grid_new();
        gtk_grid_set_column_spacing(GTK_GRID(subkey_grid), 6);
-        gtk_widget_set_margin_top(subkey_grid, 2);
-        gtk_widget_set_margin_bottom(subkey_grid, 2);
+        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);
@@ -789,9 +780,8 @@ smime_show_chain(GtkWidget *button, gpointer G_GNUC_UNUSED user_data)
        vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
         gtk_widget_set_vexpand(chain, TRUE);
         gtk_widget_set_valign(chain, GTK_ALIGN_FILL);
-        gtk_widget_set_margin_top(chain, 6);
-        gtk_widget_set_margin_bottom(chain, 6);
-       gtk_container_add(GTK_CONTAINER(vbox), chain);
+        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 e4c76d5e0..6d5f31fdd 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -419,16 +419,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);
-    gtk_widget_set_margin_top(label, 1);
-    gtk_widget_set_margin_bottom(label, 1);
-    gtk_container_add(GTK_CONTAINER(content_area), label);
+    g_object_set(label, "margin", 1, NULL);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
+                       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);
-    gtk_widget_set_margin_top(cert_widget, 1);
-    gtk_widget_set_margin_bottom(cert_widget, 1);
-    gtk_container_add(GTK_CONTAINER(content_area), cert_widget);
+    g_object_set(cert_widget, "margin", 1, NULL);
+    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
+                       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]