From 6ce35eb387fc71374d63328ec8411226ab7bf353 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 2 Oct 2022 09:51:14 +0300 Subject: [PATCH 42/42] gtk4: Fix filling actions to horizontal gui_dialog Turn entire actions area from GtkGrid to a GtkBox See osdn #45748 Signed-off-by: Marko Lindqvist --- client/gui-gtk-4.0/gui_stuff.c | 20 ++++---------------- client/gui-gtk-4.0/gui_stuff.h | 1 - 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/client/gui-gtk-4.0/gui_stuff.c b/client/gui-gtk-4.0/gui_stuff.c index b50a2c37c9..d7734707f0 100644 --- a/client/gui-gtk-4.0/gui_stuff.c +++ b/client/gui-gtk-4.0/gui_stuff.c @@ -521,20 +521,17 @@ void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, dlg->grid = gtk_grid_new(); dlg->content_counter = 0; - action_area = gtk_grid_new(); - gtk_grid_set_row_spacing(GTK_GRID(action_area), 4); - gtk_grid_set_column_spacing(GTK_GRID(action_area), 4); if (GUI_GTK_OPTION(enable_tabs) && (check_top && notebook != GTK_NOTEBOOK(top_notebook)) && !GUI_GTK_OPTION(small_display_layout)) { /* We expect this to be short (as opposed to tall); maximise usable * height by putting buttons down the right hand side */ - gtk_orientable_set_orientation(GTK_ORIENTABLE(action_area), - GTK_ORIENTATION_VERTICAL); + action_area = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); dlg->vertical_content = FALSE; } else { /* We expect this to be reasonably tall; maximise usable width by * putting buttons along the bottom */ + action_area = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); gtk_orientable_set_orientation(GTK_ORIENTABLE(dlg->grid), GTK_ORIENTATION_VERTICAL); dlg->vertical_content = TRUE; @@ -623,7 +620,6 @@ void gui_dialog_new(struct gui_dialog **pdlg, GtkNotebook *notebook, } dlg->actions = action_area; - dlg->actions_counter = 0; dlg->response_callback = gui_dialog_destroyed; @@ -698,15 +694,7 @@ GtkWidget *gui_dialog_add_button(struct gui_dialog *dlg, GtkWidget *gui_dialog_add_action_widget(struct gui_dialog *dlg, GtkWidget *widget) { - /* When content area is vertical, action area is horizontal, - * and vice versa. */ - if (dlg->vertical_content) { - gtk_grid_attach(GTK_GRID(dlg->actions), widget, - dlg->actions_counter++, 0, 1, 1); - } else { - gtk_grid_attach(GTK_GRID(dlg->grid), widget, - 0, dlg->actions_counter++, 1, 1); - } + gtk_box_append(GTK_BOX(dlg->actions), widget); gtk_size_group_add_widget(gui_action, widget); @@ -1112,7 +1100,7 @@ void dlg_tab_provider_prepare(void) } /**********************************************************************//** - Add widget to the gui_dialog vgrid + Add widget to the gui_dialog grid **************************************************************************/ void gui_dialog_add_content_widget(struct gui_dialog *dlg, GtkWidget *wdg) { diff --git a/client/gui-gtk-4.0/gui_stuff.h b/client/gui-gtk-4.0/gui_stuff.h index 3809bb85d0..fed96904e8 100644 --- a/client/gui-gtk-4.0/gui_stuff.h +++ b/client/gui-gtk-4.0/gui_stuff.h @@ -82,7 +82,6 @@ struct gui_dialog bool vertical_content; int content_counter; - int actions_counter; union { GtkWidget *window; -- 2.35.1