[balsa/gtk4: 164/312] Various: Stop using GtkBox child properties




commit 96cca2d60869ae3dbfcbdb5bdd9d0e3da37c1207
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                         | 33 ---------------------------------
 libbalsa/libbalsa-gpgme-widgets.c |  2 +-
 libbalsa/libbalsa.c               |  6 ++----
 src/balsa-mblist.c                |  3 ++-
 src/balsa-mime-widget-message.c   | 12 ------------
 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                 | 25 ++++++++++++++++++++++---
 src/sendmsg-window.c              |  2 +-
 11 files changed, 33 insertions(+), 60 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6cd223f33..3ec0f18a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -613,39 +613,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/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 a79f8599c..316e7c09a 100644
--- a/src/balsa-mime-widget-message.c
+++ b/src/balsa-mime-widget-message.c
@@ -526,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);
 
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index f5b73d9ab..827ccf3b0 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 9f117f3e6..605a9fc72 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -654,8 +654,21 @@ bw_set_panes(BalsaWindow * window)
 
         priv->mblist_parent = priv->paned_parent;
         priv->notebook_parent = NULL;
-        priv->mblist_parent = priv->paned_parent;
-        priv->notebook_parent = priv->paned_child;
+
+       gtk_paned_pack1(GTK_PANED(priv->paned_parent),
+                        bw_frame(priv->mblist), TRUE, TRUE);
+        gtk_paned_pack2(GTK_PANED(priv->paned_parent), priv->paned_child,
+                        TRUE, TRUE);
+        gtk_paned_pack1(GTK_PANED(priv->paned_child),
+                        bw_frame(index_widget), TRUE, FALSE);
+       gtk_paned_pack2(GTK_PANED(priv->paned_child),
+                        bw_frame(priv->preview), TRUE, TRUE);
+        width_preference = BALSA_INDEX_NARROW;
+       break;
+    case LAYOUT_DEFAULT:
+    default:
+       priv->paned_parent = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);
+       priv->paned_child  = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
 
        gtk_paned_pack1(GTK_PANED(priv->paned_parent),
                         bw_frame(priv->mblist), TRUE, TRUE);
@@ -2283,8 +2296,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 f8be466f3..7a57dd140 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -3488,7 +3488,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]