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




commit dab05466e2d0e8b615621d6934a102f1cb541319
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Jun 10 13:40:56 2020 -0400

    Various: Stop using GtkBox child properties
    
    Stop using GtkBox padding, fill and expand child properties
    
    Also clarify access to GtkDialog areas.
    
    * libbalsa/autocrypt.c (autocrypt_db_dialog_run):
    * libbalsa/libbalsa-gpgme-cb.c (lb_gpgme_select_key), (get_passphrase_real):
    * libbalsa/libbalsa-gpgme-widgets.c (libbalsa_key_dialog):
    * libbalsa/libbalsa.c (ask_cert_real):
    * libbalsa/smtp-server.c (libbalsa_smtp_server_dialog):
    * src/balsa-mblist.c (bmbl_mru_show_tree):
    * src/balsa-mime-widget-message.c (bm_header_widget_new):
    * src/filter-edit-dialog.c (filters_edit_dialog):
    * src/filter-export-dialog.c (filters_export_dialog):
    * src/filter-run-dialog.c (balsa_filter_run_dialog_init):
    * src/folder-conf.c (create_imap_folder_dialog),
      (folder_conf_imap_node), (subfolder_conf_clicked_ok),
      (folder_conf_imap_sub_node), (folder_conf_add_imap_sub_cb):
    * src/mailbox-conf.c (create_pop_mailbox_dialog):
    * src/sendmsg-window.c (show_decrypted_warning):
    * src/toolbar-prefs.c (create_toolbar_page):
    
    * src/main-window.c (bw_set_panes), (balsa_window_new): put a new box in
      priv->vbox to hold the panes; that way, we can rearrange the components
      without disturbing the other widgets in priv->vbox.

 ChangeLog                         | 47 ---------------------------------------
 libbalsa/autocrypt.c              |  2 +-
 libbalsa/libbalsa-gpgme-widgets.c |  2 +-
 libbalsa/libbalsa.c               |  6 ++---
 src/balsa-mblist.c                |  3 ++-
 src/balsa-mime-widget-message.c   | 19 ++++------------
 src/filter-edit-dialog.c          |  2 +-
 src/filter-export-dialog.c        |  2 +-
 src/filter-run-dialog.c           |  2 +-
 src/folder-conf.c                 |  4 ++--
 src/main-window.c                 |  8 ++++++-
 src/sendmsg-window.c              |  2 +-
 12 files changed, 23 insertions(+), 76 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index efed18723..a792d0500 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -450,20 +450,6 @@
        * libbalsa/libbalsa-gpgme-cb.c (row_activated_cb),
        (lb_gpgme_select_key):
 
-       Use a BALSA_USE_POPOVER=0 environment variable to switch from
-       GtkPopover back to GtkMenu.
-
-       * libbalsa/libbalsa.c (libbalsa_use_popover):
-       * libbalsa/libbalsa.h:
-       * src/balsa-index.c (move_to_change_state),
-       (bndx_popup_menu_create), (bndx_do_popup):
-       * src/balsa-mblist.c (bmbl_do_popup):
-       * src/balsa-message.c (balsa_headers_attachments_popup),
-       (balsa_message_init), (tree_mult_selection_popup),
-       (tree_button_press_cb), (display_content),
-       (open_with_change_state), (copy_part_change_state),
-       (part_create_menu):
-
 2020-06-10  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Various: Stop using GtkBox padding, fill and expand child properties
@@ -526,39 +512,6 @@
        * src/main-window.c (bw_create_index_widget), (bw_set_panes),
        (balsa_window_new), (bw_notebook_label_new), (bw_find_real):
 
-2020-06-09  Peter Bloomfield  <pbloomfield bellsouth net>
-
-       Various: Stop using GtkBox padding, fill and expand child properties
-
-       * src/spell-check.c (balsa_spell_check_init):
-       * src/store-address.c (store_address_dialog),
-       (store_address_book_frame):
-       * src/toolbar-prefs.c (customize_dialog_cb), (create_toolbar_page):
-
-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
-
-       * src/message-window.c:
-
-2020-06-09  Peter Bloomfield  <pbloomfield bellsouth net>
-
-       Various: Stop using GtkBox padding, fill and expand child properties
-
-       * src/information-dialog.c (balsa_information_list):
-       * src/main-window.c (bw_create_index_widget), (bw_set_panes),
-       (balsa_window_new), (bw_notebook_label_new), (bw_find_real):
-
 2020-06-09  Peter Bloomfield  <pbloomfield bellsouth net>
 
        Various: restore filtering in a mailbox that is not currently
diff --git a/libbalsa/autocrypt.c b/libbalsa/autocrypt.c
index 1c4529601..713b02c07 100644
--- a/libbalsa/autocrypt.c
+++ b/libbalsa/autocrypt.c
@@ -440,7 +440,7 @@ autocrypt_db_dialog_run(const gchar *date_string, GtkWindow *parent)
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
     gtk_widget_set_vexpand(vbox, TRUE);
-    gtk_box_append(GTK_BOX(content_area), vbox);
+    gtk_container_add(GTK_CONTAINER(content_area), vbox);
 
     label = gtk_label_new(_("Double-click key to show details"));
     gtk_widget_set_halign(label, GTK_ALIGN_START);
diff --git a/libbalsa/libbalsa-gpgme-widgets.c b/libbalsa/libbalsa-gpgme-widgets.c
index 3c48a30e4..01fe96800 100644
--- a/libbalsa/libbalsa-gpgme-widgets.c
+++ b/libbalsa/libbalsa-gpgme-widgets.c
@@ -407,7 +407,7 @@ libbalsa_key_dialog(GtkWindow            *parent,
        gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
         gtk_widget_set_vexpand(hbox, TRUE);
         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_pack_start(GTK_BOX(content_area), hbox, FALSE, FALSE, 0);
        gtk_box_set_homogeneous(GTK_BOX(hbox), FALSE);
 
        /* standard key icon; "application-certificate" would be an alternative... */
diff --git a/libbalsa/libbalsa.c b/libbalsa/libbalsa.c
index 227ad0da7..003d6c7b9 100644
--- a/libbalsa/libbalsa.c
+++ b/libbalsa/libbalsa.c
@@ -421,16 +421,14 @@ ask_cert_real(void *data)
     gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
     gtk_widget_set_margin_top(label, 1);
     gtk_widget_set_margin_bottom(label, 1);
-    gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       label, FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(content_area), label, FALSE, FALSE, 0);
     gtk_widget_show(label);
 
     gtk_widget_set_vexpand(cert_widget, TRUE);
     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_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
-                       cert_widget, FALSE, FALSE, 0);
+    gtk_box_pack_start(GTK_BOX(content_area), cert_widget, FALSE, FALSE, 0);
     gtk_widget_show_all(cert_widget);
 
     switch(gtk_dialog_run(GTK_DIALOG(dialog))) {
diff --git a/src/balsa-mblist.c b/src/balsa-mblist.c
index abd3075c6..c51cf84ed 100644
--- a/src/balsa-mblist.c
+++ b/src/balsa-mblist.c
@@ -1821,9 +1821,10 @@ bmbl_mru_show_tree(GtkWidget * widget, gpointer data)
 #if HAVE_MACOSX_DESKTOP
     libbalsa_macosx_menu_for_parent(dialog, mru->window);
 #endif
+
     gtk_widget_set_vexpand(scroll, TRUE);
     gtk_widget_set_valign(scroll, GTK_ALIGN_FILL);
-    gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), scroll);
+    gtk_container_add(GTK_CONTAINER(content_area), scroll);
 
     g_signal_connect(dialog, "size-allocate",
                      G_CALLBACK(bmbl_mru_size_allocate_cb), NULL);
diff --git a/src/balsa-mime-widget-message.c b/src/balsa-mime-widget-message.c
index aa57f4669..316e7c09a 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -510,7 +510,6 @@ bm_header_widget_new(BalsaMessage * bm, GtkWidget * const * buttons)
     GtkWidget *info_bar_widget;
     GtkInfoBar *info_bar;
     GtkWidget *content_area;
-    GtkWidget *vbox;
     GtkWidget *action_area;
     GtkWidget *widget;
     GtkEventController *key_controller;
@@ -527,18 +526,6 @@ bm_header_widget_new(BalsaMessage * bm, GtkWidget * const * buttons)
     g_signal_connect(key_controller, "key-pressed",
                     G_CALLBACK(balsa_mime_widget_key_pressed), bm);
 
-#ifdef GTK_INFO_BAR_WRAPPING_IS_BROKEN
-    hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
-    gtk_container_add(GTK_CONTAINER(hbox), grid);
-    gtk_container_set_border_width(GTK_CONTAINER(hbox), 6);
-
-    action_area = gtk_button_box_new(GTK_ORIENTATION_VERTICAL);
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(action_area),
-                              GTK_BUTTONBOX_START);
-
-    gtk_widget_set_valign(action_area, GTK_ALIGN_FILL);
-    gtk_box_pack_end(GTK_BOX(hbox), action_area, FALSE, FALSE, 0);
-#else                           /* GTK_INFO_BAR_WRAPPING_IS_BROKEN */
     info_bar_widget = gtk_info_bar_new();
     info_bar = GTK_INFO_BAR(info_bar_widget);
 
@@ -549,8 +536,10 @@ bm_header_widget_new(BalsaMessage * bm, GtkWidget * const * buttons)
     gtk_widget_set_vexpand(vbox, TRUE);
     gtk_widget_set_valign(vbox, GTK_ALIGN_START);
     action_area = gtk_info_bar_get_action_area(info_bar);
-    gtk_container_add(GTK_CONTAINER(action_area), vbox);
-
+    gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area),
+                                   GTK_ORIENTATION_VERTICAL);
+    gtk_button_box_set_layout(GTK_BUTTON_BOX(action_area),
+                              GTK_BUTTONBOX_START);
     if (balsa_message_get_face_box(bm) == NULL) {
         GtkWidget *face_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 697df3129..7d060b2b9 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -599,7 +599,7 @@ filters_edit_dialog(GtkWindow * parent)
     gtk_widget_set_halign(hbox, GTK_ALIGN_FILL);
     gtk_widget_set_margin_start(hbox, FILTER_EDIT_PADDING);
     gtk_widget_set_margin_end(hbox, FILTER_EDIT_PADDING);
-    gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(fe_window))), hbox);
+    gtk_container_add(GTK_CONTAINER(content_area), hbox);
 
     gtk_widget_set_margin_start(piece, FILTER_EDIT_PADDING);
     gtk_widget_set_margin_end(piece, FILTER_EDIT_PADDING);
diff --git a/src/filter-export-dialog.c b/src/filter-export-dialog.c
index 66093a43e..815bdadaa 100644
--- a/src/filter-export-dialog.c
+++ b/src/filter-export-dialog.c
@@ -98,7 +98,7 @@ filters_export_dialog(GtkWindow * parent)
     gtk_widget_set_valign(sw, GTK_ALIGN_FILL);
     gtk_widget_set_margin_top(sw, 2);
     gtk_widget_set_margin_bottom(sw, 2);
-    gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(fex_window))), sw);
+    gtk_container_add(GTK_CONTAINER(content_area), sw);
 
     /* Populate the list of filters */
 
diff --git a/src/filter-run-dialog.c b/src/filter-run-dialog.c
index b386a377d..0fc3a4b0c 100644
--- a/src/filter-run-dialog.c
+++ b/src/filter-run-dialog.c
@@ -312,7 +312,7 @@ balsa_filter_run_dialog_init(BalsaFilterRunDialog *p)
 
     gtk_widget_set_vexpand(hbox, TRUE);
     gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
-    gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(p))), hbox);
+    gtk_container_add(GTK_CONTAINER(content_area), hbox);
 
     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
     gtk_widget_set_hexpand(vbox, TRUE);
diff --git a/src/folder-conf.c b/src/folder-conf.c
index 285d05386..b3d5e1175 100644
--- a/src/folder-conf.c
+++ b/src/folder-conf.c
@@ -355,7 +355,7 @@ create_imap_folder_dialog(LibBalsaServer  *server,
        gtk_widget_set_vexpand(vbox, TRUE);
 
        label = libbalsa_create_wrap_label(message, FALSE);
-       gtk_container_add(GTK_CONTAINER(vbox), label);
+       gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
 
        scrolled_wind = gtk_scrolled_window_new(NULL,NULL);
        gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_wind),
@@ -915,7 +915,7 @@ folder_conf_imap_sub_node(BalsaMailboxNode * mn)
     gtk_widget_set_hexpand(sub_folder_data->parent_folder, TRUE);
     gtk_widget_set_halign(sub_folder_data->parent_folder, GTK_ALIGN_FILL);
     gtk_container_add(GTK_CONTAINER(hbox), sub_folder_data->parent_folder);
-    gtk_container_add(GTK_CONTAINER(hbox), button);
+    gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 
     gtk_widget_set_hexpand(hbox, TRUE);
     gtk_grid_attach(GTK_GRID(grid), hbox, 1, row, 1, 1);
diff --git a/src/main-window.c b/src/main-window.c
index 5ca2223b7..29aeda26c 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -2305,8 +2305,14 @@ balsa_window_new(GtkApplication *application)
     priv->toolbar = balsa_toolbar_new(model, G_ACTION_MAP(window));
     gtk_box_pack_start(GTK_BOX(priv->vbox), priv->toolbar, FALSE, FALSE, 0);
 
+    priv->content_area = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+    gtk_widget_show(priv->content_area);
+    gtk_widget_set_vexpand(priv->content_area, TRUE);
+    gtk_widget_set_valign(priv->content_area, GTK_ALIGN_FILL);
+    gtk_container_add(GTK_CONTAINER(priv->vbox), priv->content_area);
+
     priv->bottom_bar = hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-    gtk_container_add(GTK_CONTAINER(priv->vbox), hbox);
+    gtk_box_pack_start(GTK_BOX(priv->vbox), hbox, FALSE, FALSE, 0);
 
     priv->progress_bar = gtk_progress_bar_new();
     g_object_add_weak_pointer(G_OBJECT(priv->progress_bar),
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 383893bd6..d16c5376b 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -3485,7 +3485,7 @@ show_decrypted_warning(GtkWindow *parent)
        remind_btn = gtk_check_button_new_with_label(_("Do not remind me again."));
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remind_btn), FALSE);
        gtk_widget_show(remind_btn);
-       gtk_container_add(GTK_CONTAINER(message_area), remind_btn);
+       gtk_box_pack_end(GTK_BOX(message_area), remind_btn, FALSE, FALSE, 0);
        gtk_dialog_run(GTK_DIALOG(dialog));
        balsa_app.warn_reply_decrypted = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remind_btn));
        gtk_widget_destroy(dialog);


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