Added #if HAVE_GTK3 / #elif !HAVE_GTK3 branches around gtk_hbox_new / gtk_vbox_new call sites in the GTK front-end, using gtk_box_new(GTK_ORIENTATION_*, spacing) for GTK3 while keeping the GTK2 constructors explicitly gated under !HAVE_GTK3.

Applied gtk_box_set_homogeneous() in GTK3 branches where the GTK2 code requested homogeneous layout (e.g., dialog hboxes).
Updated remaining helpers and setup/preferences UI box constructors (including the shared mg_box_new helper) to follow the same GTK3/GTK2 branching approach consistently across src/fe-gtk/
This commit is contained in:
2026-01-23 21:28:32 -07:00
parent 5b1a58195e
commit ab3bdf219f
11 changed files with 154 additions and 3 deletions

View File

@@ -882,7 +882,7 @@ setup_create_spin (GtkWidget *table, int row, const setting *set)
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, LABEL_INDENT, 0);
#if HAVE_GTK3
rbox = gtk_hbox_new (0, 0);
rbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (rbox, GTK_ALIGN_START);
gtk_widget_set_valign (rbox, GTK_ALIGN_CENTER);
gtk_table_attach (GTK_TABLE (table), rbox, 3, 4, row, row + 1,
@@ -1023,7 +1023,11 @@ setup_create_radio (GtkWidget *table, int row, const setting *set)
gtk_table_attach (GTK_TABLE (table), wid, 2, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, LABEL_INDENT, 0);
#if HAVE_GTK3
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#elif !HAVE_GTK3
hbox = gtk_hbox_new (0, 0);
#endif
gtk_table_attach (GTK_TABLE (table), hbox, 3, 4, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
@@ -1152,7 +1156,11 @@ setup_create_menu (GtkWidget *table, int row, const setting *set)
g_signal_connect (G_OBJECT (cbox), "changed",
G_CALLBACK (setup_menu_cb), (gpointer)set);
#if HAVE_GTK3
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#elif !HAVE_GTK3
box = gtk_hbox_new (0, 0);
#endif
gtk_box_pack_start (GTK_BOX (box), cbox, 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), box, 3, 4, row, row + 1,
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
@@ -1534,7 +1542,11 @@ setup_create_dark_mode_menu (GtkWidget *table, int row, const setting *set)
g_signal_connect (G_OBJECT (cbox), "changed",
G_CALLBACK (setup_dark_mode_menu_cb), (gpointer)set);
#if HAVE_GTK3
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#elif !HAVE_GTK3
box = gtk_hbox_new (0, 0);
#endif
gtk_box_pack_start (GTK_BOX (box), cbox, 0, 0, 0);
gtk_table_attach (GTK_TABLE (table), box, 3, 4, row, row + 1,
GTK_EXPAND | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
@@ -1809,7 +1821,11 @@ setup_create_color_page (void)
GtkWidget *tab, *box, *label;
int i;
#if HAVE_GTK3
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#elif !HAVE_GTK3
box = gtk_vbox_new (FALSE, 0);
#endif
gtk_container_set_border_width (GTK_CONTAINER (box), 6);
tab = gtk_table_new (9, 2, FALSE);
@@ -2074,7 +2090,11 @@ setup_create_theme_page (void)
ui = g_new0 (setup_theme_ui, 1);
#if HAVE_GTK3
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
#elif !HAVE_GTK3
box = gtk_vbox_new (FALSE, 6);
#endif
gtk_container_set_border_width (GTK_CONTAINER (box), 6);
themes_dir = g_build_filename (get_xdir (), "themes", NULL);
@@ -2092,7 +2112,11 @@ setup_create_theme_page (void)
g_free (markup);
g_free (themes_dir);
#if HAVE_GTK3
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
#elif !HAVE_GTK3
hbox = gtk_hbox_new (FALSE, 6);
#endif
gtk_box_pack_start (GTK_BOX (box), hbox, FALSE, FALSE, 0);
ui->combo = gtk_combo_box_text_new ();
@@ -2100,7 +2124,11 @@ setup_create_theme_page (void)
g_signal_connect (G_OBJECT (ui->combo), "changed",
G_CALLBACK (setup_theme_selection_changed), ui);
#if HAVE_GTK3
button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
#elif !HAVE_GTK3
button_box = gtk_hbox_new (FALSE, 6);
#endif
gtk_box_pack_start (GTK_BOX (hbox), button_box, FALSE, FALSE, 0);
ui->apply_button = gtk_button_new_with_mnemonic (_("_Apply Theme"));
@@ -2317,11 +2345,19 @@ setup_create_sound_page (void)
GtkWidget *sound_play;
GtkTreeSelection *sel;
#if HAVE_GTK3
vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#elif !HAVE_GTK3
vbox1 = gtk_vbox_new (FALSE, 0);
#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 6);
gtk_widget_show (vbox1);
#if HAVE_GTK3
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#elif !HAVE_GTK3
vbox2 = gtk_vbox_new (FALSE, 0);
#endif
gtk_widget_show (vbox2);
gtk_container_add (GTK_CONTAINER (vbox1), vbox2);
@@ -2402,7 +2438,11 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab)
GtkScrolledWindow *sw;
char buf[128];
#if HAVE_GTK3
vvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
#elif !HAVE_GTK3
vvbox = gtk_vbox_new (FALSE, 0);
#endif
/* label */
label = gtk_label_new (NULL);
@@ -2960,11 +3000,19 @@ setup_window_open (void)
g_snprintf(buf, sizeof(buf), _("Preferences - %s"), _(DISPLAY_NAME));
win = gtkutil_window_new (buf, "prefs", 0, 600, 2);
#if HAVE_GTK3
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
#elif !HAVE_GTK3
vbox = gtk_vbox_new (FALSE, 5);
#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_container_add (GTK_CONTAINER (win), vbox);
#if HAVE_GTK3
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
#elif !HAVE_GTK3
hbox = gtk_hbox_new (FALSE, 4);
#endif
gtk_container_add (GTK_CONTAINER (vbox), hbox);
setup_create_tree (hbox, setup_create_pages (hbox));