Added GTK utility helpers for box/grid creation and attachment that map GTK3 layout settings while preserving GTK2 fallbacks.

Updated multiple GTK UI layout paths (setup, server list, notify, ban list, join dialog, and menu) to use the new helpers for GTK3-safe box/grid creation and attachment behavior.
Added GTK3-safe attach option definitions and updated helper signatures to avoid GTK2-only types/macros in public headers.
Updated gtkutil grid-attachment helpers to use the new attach option type in alignment/expansion logic.
Switched banlist grid attachments to the new helper option flags for GTK3 builds.
This commit is contained in:
2026-02-05 01:59:15 -07:00
parent 0074a8ba1e
commit eb46631a7d
9 changed files with 186 additions and 207 deletions

View File

@@ -393,65 +393,43 @@ fe_notify_ask (char *nick, char *networks)
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
#if HAVE_GTK3
table = gtk_grid_new ();
table = gtkutil_grid_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
#if HAVE_GTK3
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
gtk_grid_set_column_spacing (GTK_GRID (table), 8);
#else
table = gtk_table_new (2, 3, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
#endif
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), table);
label = gtk_label_new (msg);
#if HAVE_GTK3
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
#else
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 0, 1);
#endif
gtkutil_grid_attach_defaults (table, label, 0, 1, 0, 1);
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), nick);
g_signal_connect (G_OBJECT (entry), "activate",
G_CALLBACK (notifygui_add_enter), dialog);
#if HAVE_GTK3
gtk_grid_attach (GTK_GRID (table), entry, 1, 0, 1, 1);
#else
gtk_table_attach_defaults (GTK_TABLE (table), entry, 1, 2, 0, 1);
#endif
gtkutil_grid_attach_defaults (table, entry, 1, 2, 0, 1);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (notifygui_add_cb), entry);
label = gtk_label_new (_("Notify on these networks:"));
#if HAVE_GTK3
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
#else
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
#endif
gtkutil_grid_attach_defaults (table, label, 0, 1, 2, 3);
wid = gtk_entry_new ();
g_object_set_data (G_OBJECT (entry), "net", wid);
g_signal_connect (G_OBJECT (wid), "activate",
G_CALLBACK (notifygui_add_enter), dialog);
gtk_entry_set_text (GTK_ENTRY (wid), networks ? networks : "ALL");
#if HAVE_GTK3
gtk_grid_attach (GTK_GRID (table), wid, 1, 2, 1, 1);
#else
gtk_table_attach_defaults (GTK_TABLE (table), wid, 1, 2, 2, 3);
#endif
gtkutil_grid_attach_defaults (table, wid, 1, 2, 2, 3);
label = gtk_label_new (NULL);
g_snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", _("Comma separated list of networks is accepted."));
gtk_label_set_markup (GTK_LABEL (label), buf);
#if HAVE_GTK3
gtk_grid_attach (GTK_GRID (table), label, 1, 3, 1, 1);
#else
gtk_table_attach_defaults (GTK_TABLE (table), label, 1, 2, 3, 4);
#endif
gtkutil_grid_attach_defaults (table, label, 1, 2, 3, 4);
gtk_widget_show_all (dialog);
}