[gtk+] radiobutton: don't consider hidden buttons in the group for focus



commit 276a510b4b539b1bc83a07e9400fc44631cddf91
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Thu Oct 30 17:02:45 2014 -0700

    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

 gtk/gtkradiobutton.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkradiobutton.c b/gtk/gtkradiobutton.c
index 4e98dd9..e13062a 100644
--- a/gtk/gtkradiobutton.c
+++ b/gtk/gtkradiobutton.c
@@ -743,7 +743,8 @@ gtk_radio_button_focus (GtkWidget         *widget,
       tmp_slist = priv->group;
       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;
          tmp_slist = tmp_slist->next;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]