radiobutton: don't consider hidden buttons in the group for focus

When a GtkRadioButton has no focus, it will accept it when there is no
other active button in its group.
If the active button in the group is hidden, for example because the UI
desires not to have a default option pre-selected, currently the focus
will not be accepted, which is not desired behavior.

This commit changes the code to only consider visible buttons in the
group when checking whether another button is active.

https://bugzilla.gnome.org/show_bug.cgi?id=739474
This commit is contained in:
Cosimo Cecchi 2014-10-30 17:02:45 -07:00 committed by Cosimo Cecchi
parent e6e511eb46
commit 276a510b4b

View File

@ -743,7 +743,8 @@ gtk_radio_button_focus (GtkWidget *widget,
tmp_slist = priv->group; tmp_slist = priv->group;
while (tmp_slist) while (tmp_slist)
{ {
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tmp_slist->data))) if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tmp_slist->data)) &&
gtk_widget_get_visible (tmp_slist->data))
selected_button = tmp_slist->data; selected_button = tmp_slist->data;
tmp_slist = tmp_slist->next; tmp_slist = tmp_slist->next;
} }