[balsa/gtk4: 98/294] filter-edit-dialog: Stop using GtkButtonBox




commit 5bf41ee6fce5ce1ddb84bcb0284a75beae95e233
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sat Aug 29 15:40:55 2020 -0400

    filter-edit-dialog: Stop using GtkButtonBox

 src/filter-edit-dialog.c | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)
---
diff --git a/src/filter-edit-dialog.c b/src/filter-edit-dialog.c
index 4b0cb7092..8a239e611 100644
--- a/src/filter-edit-dialog.c
+++ b/src/filter-edit-dialog.c
@@ -180,7 +180,7 @@ static GtkWidget *
 build_left_side(void)
 {
     GtkWidget *vbox, *bbox;
-
+    GtkSizeGroup *size_group;
     GtkWidget *sw;
 
     /*
@@ -218,20 +218,19 @@ build_left_side(void)
     gtk_container_add(GTK_CONTAINER(vbox), sw);
 
     /* new and delete buttons */
-    bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
-    gtk_box_set_spacing(GTK_BOX(bbox), 2);
-    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
+    bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
+    size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
 
     gtk_container_add(GTK_CONTAINER(vbox), bbox);
 
     /* new button */
     /* Translators: button "New" filter */
-    fe_new_button = gtk_button_new_with_mnemonic(C_("filter", "_New"));
+    fe_new_button = libbalsa_button_box_button(C_("filter", "_New"), size_group, GTK_ALIGN_CENTER);
     g_signal_connect(fe_new_button, "clicked",
                     G_CALLBACK(fe_new_pressed), NULL);
     gtk_container_add(GTK_CONTAINER(bbox), fe_new_button);
     /* delete button */
-    fe_delete_button = gtk_button_new_with_mnemonic(("_Delete"));
+    fe_delete_button = libbalsa_button_box_button(("_Delete"), size_group, GTK_ALIGN_CENTER);
     g_signal_connect(fe_delete_button, "clicked",
                     G_CALLBACK(fe_delete_pressed), NULL);
     gtk_container_add(GTK_CONTAINER(bbox), fe_delete_button);
@@ -251,6 +250,7 @@ build_match_page()
     GtkWidget *page, *button;
     GtkWidget *label, *scroll;
     GtkWidget *box = NULL;
+    GtkSizeGroup *size_group;
 
     /* The notebook page */
     page = gtk_grid_new();
@@ -309,20 +309,23 @@ build_match_page()
 
     gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(fe_conditions_list));
 
-    box = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
+    box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
     gtk_widget_set_hexpand(box, TRUE);
     gtk_grid_attach(GTK_GRID(page), box, 0, 3, 2, 1);
-    fe_condition_edit_button = gtk_button_new_with_mnemonic(_("_Edit"));
+
+    size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
+
+    fe_condition_edit_button = libbalsa_button_box_button(_("_Edit"), size_group, GTK_ALIGN_START);
     gtk_widget_set_sensitive(fe_condition_edit_button,FALSE);
     gtk_container_add(GTK_CONTAINER(box), fe_condition_edit_button);
     g_signal_connect(fe_condition_edit_button, "clicked",
                      G_CALLBACK(fe_edit_condition), GINT_TO_POINTER(0));
     /* Translators: button "New" filter match */
-    button = gtk_button_new_with_mnemonic(C_("filter match", "Ne_w"));
+    button = libbalsa_button_box_button(C_("filter match", "Ne_w"), size_group, GTK_ALIGN_CENTER);
     gtk_container_add(GTK_CONTAINER(box), button);
     g_signal_connect(button, "clicked",
                      G_CALLBACK(fe_edit_condition), GINT_TO_POINTER(1));
-    fe_condition_delete_button = gtk_button_new_with_mnemonic(_("_Remove"));
+    fe_condition_delete_button = libbalsa_button_box_button(_("_Remove"), size_group, GTK_ALIGN_END);
     gtk_widget_set_sensitive(fe_condition_delete_button,FALSE);
     gtk_container_add(GTK_CONTAINER(box), fe_condition_delete_button);
     g_signal_connect(fe_condition_delete_button, "clicked",
@@ -492,6 +495,7 @@ build_right_side(GtkWindow * window)
     GtkWidget *rightside;
     GtkWidget *notebook, *page;
     GtkWidget *bbox;
+    GtkSizeGroup *size_group;
 
     rightside = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
 
@@ -510,15 +514,17 @@ build_right_side(GtkWindow * window)
                             page, gtk_label_new(_("Action")));
 
     /* button box */
-    bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
+    bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
     gtk_container_add(GTK_CONTAINER(rightside), bbox);
 
-    fe_apply_button = gtk_button_new_with_mnemonic(_("_Apply"));
+    size_group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
+
+    fe_apply_button = libbalsa_button_box_button(_("_Apply"), size_group, GTK_ALIGN_START);
     g_signal_connect(fe_apply_button, "clicked",
                     G_CALLBACK(fe_apply_pressed), NULL);
     gtk_container_add(GTK_CONTAINER(bbox), fe_apply_button);
 
-    fe_revert_button = gtk_button_new_with_mnemonic(_("Re_vert"));
+    fe_revert_button = libbalsa_button_box_button(_("Re_vert"), size_group, GTK_ALIGN_END);
     g_signal_connect(fe_revert_button, "clicked",
                     G_CALLBACK(fe_revert_pressed), NULL);
     gtk_container_add(GTK_CONTAINER(bbox), fe_revert_button);
@@ -604,12 +610,13 @@ filters_edit_dialog(GtkWindow * parent)
 
     /* main hbox */
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, FILTER_EDIT_PADDING);
-    gtk_widget_set_hexpand(hbox, TRUE);
-    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_widget_set_vexpand(hbox, TRUE);
+    gtk_widget_set_valign(hbox, GTK_ALIGN_FILL);
+    gtk_widget_set_margin_top(hbox, FILTER_EDIT_PADDING);
+    gtk_widget_set_margin_bottom(hbox, FILTER_EDIT_PADDING);
     gtk_container_add(GTK_CONTAINER(content_area), hbox);
 
+    gtk_widget_set_hexpand(piece, FALSE);
     gtk_widget_set_margin_start(piece, FILTER_EDIT_PADDING);
     gtk_widget_set_margin_end(piece, FILTER_EDIT_PADDING);
     gtk_container_add(GTK_CONTAINER(hbox), piece);


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