Need gtk_radio_button_get_group_active_index()
@federico
Submitted by Federico Mena Quintero Link to original bug (#166995)
Description
People are doing egregious things to get the index of the active radio button in a radio group. The control center has this (gnome-network-preferences.c):
enum ProxyMode { PROXYMODE_NONE, PROXYMODE_MANUAL, PROXYMODE_AUTO };
static void proxy_mode_radiobutton_clicked_cb (GtkWidget *widget, GladeXML *dialog) { GSList *mode_group; int mode;
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)))
return;
mode_group = g_slist_copy (gtk_radio_button_get_group
(GTK_RADIO_BUTTON (WID ("none_radiobutton"))));
mode_group = g_slist_reverse (mode_group);
mode = g_slist_index (mode_group, widget);
g_slist_free (mode_group);
if (mode == PROXYMODE_MANUAL)
...
This is horrible. We should give people an easy way to figure out the selected index in the group, akin to gtk_combo_box_get_active().
Version: 2.6.x