[balsa/gtk4: 78/294] Various: Stop using GtkBox child properties




commit 4a7e2422dfc58f377169bdea4d2ce2348fde1038
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Tue Jun 9 16:48:29 2020 -0400

    Various: Stop using GtkBox child properties
    
    Stop using GtkBox padding, fill and expand child properties
    
    * src/main-window.c (bw_notebook_label_new): use container-add
      instead of box-pack, to avoid ridiculously wide tabs;
    * src/sendmsg-window.c (sw_get_user_codeset),
      (quote_parts_select_dlg), (subject_not_empty),
      (sendmsg_window_new):

 ChangeLog            | 10 +++++++++
 src/main-window.c    |  4 +---
 src/sendmsg-window.c | 62 ++++++++++++++++++++++++++++++++++++++++++----------
 3 files changed, 61 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c3b29a3ba..71453840b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -565,6 +565,16 @@
        (open_with_change_state), (copy_part_change_state),
        (part_create_menu):
 
+2020-06-09  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       Various: Stop using GtkBox padding, fill and expand child properties
+
+       * src/main-window.c (bw_notebook_label_new): use container-add
+       instead of box-pack, to avoid ridiculously wide tabs;
+       * src/sendmsg-window.c (sw_get_user_codeset),
+       (quote_parts_select_dlg), (subject_not_empty),
+       (sendmsg_window_new):
+
 2020-06-09  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Various: Stop using GtkBox padding, fill and expand child properties
diff --git a/src/main-window.c b/src/main-window.c
index 7af9b11ab..a30dfc771 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2847,9 +2847,7 @@ bw_notebook_label_new(BalsaMailboxNode * mbnode)
                             libbalsa_mailbox_get_unread(balsa_mailbox_node_get_mailbox(mbnode)) > 0);
     g_signal_connect_object(balsa_mailbox_node_get_mailbox(mbnode), "changed",
                             G_CALLBACK(bw_mailbox_changed), lab, 0);
-    gtk_widget_set_hexpand(lab, TRUE);
-    gtk_widget_set_halign(lab, GTK_ALIGN_FILL);
-    gtk_box_pack_start(GTK_BOX(box), lab, FALSE, FALSE, 0);
+    gtk_container_add(GTK_CONTAINER(box), lab);
 
     but = gtk_button_new();
     gtk_widget_set_focus_on_click(but, FALSE);
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 3c0853388..dd5df892c 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -1500,8 +1500,17 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
 
     g_free(msg);
     content_box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
-    gtk_box_pack_start(content_box, info, FALSE, TRUE, 5);
-    gtk_box_pack_start(content_box, charset_button, TRUE, TRUE, 5);
+
+    gtk_widget_set_margin_top(info, 5);
+    gtk_widget_set_margin_bottom(info, 5);
+    gtk_container_add(GTK_CONTAINER(content_box), info);
+
+    gtk_widget_set_vexpand(charset_button, TRUE);
+    gtk_widget_set_valign(charset_button, GTK_ALIGN_FILL);
+    gtk_widget_set_margin_top(charset_button, 5);
+    gtk_widget_set_margin_bottom(charset_button, 5);
+    gtk_container_add(GTK_CONTAINER(content_box), charset_button);
+
     gtk_widget_show(info);
     gtk_widget_show(charset_button);
     gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
@@ -1511,8 +1520,16 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
         GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
         combo_box = gtk_combo_box_text_new();
 
-        gtk_box_pack_start(content_box, hbox, TRUE, TRUE, 5);
-        gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
+        gtk_widget_set_vexpand(hbox, TRUE);
+        gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
+        gtk_widget_set_margin_top(hbox, 5);
+        gtk_widget_set_margin_bottom(hbox, 5);
+        gtk_container_add(GTK_CONTAINER(content_box), hbox);
+
+        gtk_widget_set_hexpand(label, TRUE);
+        gtk_widget_set_halign(label, GTK_ALIGN_FILL);
+        gtk_container_add(GTK_CONTAINER(hbox), label);
+
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
                                        mime_type);
         gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo_box),
@@ -1521,7 +1538,11 @@ sw_get_user_codeset(BalsaSendmsg * bsmsg, gboolean * change_type,
         g_signal_connect(combo_box, "changed",
                          G_CALLBACK(sw_charset_combo_box_changed),
                          charset_button);
-        gtk_box_pack_start(GTK_BOX(hbox), combo_box, TRUE, TRUE, 0);
+
+        gtk_widget_set_hexpand(combo_box, TRUE);
+        gtk_widget_set_halign(combo_box, GTK_ALIGN_FILL);
+        gtk_container_add(GTK_CONTAINER(hbox), combo_box);
+
         gtk_widget_show_all(hbox);
     }
 
@@ -3361,9 +3382,15 @@ quote_parts_select_dlg(GtkTreeStore               *tree_store,
 
     gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
-    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);
+
     content_box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog)));
-    gtk_box_pack_start(content_box, hbox, TRUE, TRUE, 0);
+    gtk_widget_set_vexpand(hbox, TRUE);
+    gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
+    gtk_box_pack_start(content_box, hbox, FALSE, FALSE, 0);
 
     if (stats->decrypted > 0U) {
        GtkWidget *warning;
@@ -3395,7 +3422,9 @@ quote_parts_select_dlg(GtkTreeStore               *tree_store,
     gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
                                    GTK_POLICY_AUTOMATIC,
                                    GTK_POLICY_AUTOMATIC);
-    gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0);
+    gtk_widget_set_vexpand(scroll, TRUE);
+    gtk_widget_set_valign(scroll, GTK_ALIGN_FILL);
+    gtk_container_add(GTK_CONTAINER(vbox), scroll);
 
     /* add the tree view */
     tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(tree_store));
@@ -5114,7 +5143,9 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     dialog_vbox = gtk_dialog_get_content_area(GTK_DIALOG(no_subj_dialog));
 
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-    gtk_box_pack_start (GTK_BOX (dialog_vbox), hbox, TRUE, TRUE, 0);
+    gtk_widget_set_vexpand(hbox, TRUE);
+    gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
+    gtk_box_pack_start(GTK_BOX(dialog_vbox), hbox, FALSE, FALSE, 0);
     gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
 
     image = gtk_image_new_from_icon_name("dialog-question",
@@ -5123,7 +5154,9 @@ subject_not_empty(BalsaSendmsg * bsmsg)
     gtk_widget_set_valign(image, GTK_ALIGN_START);
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
-    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);
 
     text_str = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s",
                               _("You did not specify a subject for this message"),
@@ -5141,7 +5174,10 @@ subject_not_empty(BalsaSendmsg * bsmsg)
 
     subj_entry = gtk_entry_new ();
     gtk_entry_set_text(GTK_ENTRY(subj_entry), _("(no subject)"));
-    gtk_box_pack_start (GTK_BOX (hbox), subj_entry, TRUE, TRUE, 0);
+    gtk_widget_set_hexpand(subj_entry, TRUE);
+    gtk_widget_set_halign(subj_entry, GTK_ALIGN_FILL);
+    gtk_container_add(GTK_CONTAINER(hbox), subj_entry);
+
     gtk_entry_set_activates_default (GTK_ENTRY (subj_entry), TRUE);
     gtk_dialog_set_default_response(GTK_DIALOG (no_subj_dialog),
                                     GTK_RESPONSE_OK);
@@ -6899,7 +6935,9 @@ sendmsg_window_new()
     /* Paned window for the addresses at the top, and the content at the
      * bottom: */
     bsmsg->paned = paned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
-    gtk_box_pack_start(GTK_BOX(main_box), paned, TRUE, TRUE, 0);
+    gtk_widget_set_vexpand(paned, TRUE);
+    gtk_widget_set_valign(paned, GTK_ALIGN_FILL);
+    gtk_container_add(GTK_CONTAINER(main_box), paned);
     gtk_widget_show(paned);
 
     /* create the top portion with the to, from, etc in it */


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