GTK4: aspect of grouped toggle buttons

Hello world,
still migrating my app from GTK3 to GTK4, facing some issue with the looks, of the toggle buttons.
I created the button group using:

gchar * title[5];
gchar * occup[5];
GtkWidget * but[5];
int i;
for (i=0; i<5; i++)
  if (!i)
    but[i]  gtk_toggle_button_new_with_label (title[i]);
#ifdef GTK4
    but[i] = gtk_toggle_button_new_with_label (title[i]);
    gtk_toggle_button_set_group ((GtkToggleButton *)but[i], (GtkToggleButton *)but[0]);
    but[i] = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON(but[0]));
    gtk_container_add ((GtkContainer *)but[i], title[i]);
    g_signal_connect (G_OBJECT(but[i]), "toggled", G_CALLBACK(toggle_occ), NULL);

And all this works just fine, buttons behave as they should only they look like this (each bold line is a button and I am using pango markup to get the bold fonts):


And it is very hard to understand visually that these are toogle/radio button, is there any way to draw
a radio symbol or anything else in front of each buttons (as it appears in GTK3) ?

Thanks in advance for your lights.


Use GtkCheckButton instead of GtkToggleButton. Once a check button is in a group, it’ll use the radio indicator instead of the check.

Thanks for taking the time to reply, and answer, works just fine :wink:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.