Re: [patch] adding radio buttons to radio groups



On Tue, Jan 19, 1999 at 06:28:55PM -0800, Shawn T . Amundson wrote:
> Currently using gtk_radio_button_set_group requires you to 
> set the radio button to inactive, like this:
> 
>   rb_a = gtk_radio_button_new_with_label (NULL, "A");
>   rb_b = gtk_radio_button_new_with_label (NULL, "B");
>   rb_c = gtk_radio_button_new_with_label (NULL, "C");
>   
>   radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (rb_a));
>   gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_b), radiogroup);
>   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb_b), FALSE); 
> 
>   radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (rb_a));
>   gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_c), radiogroup);
>   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb_a), FALSE);
                                                     ^^^^
I meant that to be rb_c.

> 
> It would seem better to not require it, so the same would like look
> this:
> 
>   rb_a = gtk_radio_button_new_with_label (NULL, "A");
>   rb_b = gtk_radio_button_new_with_label (NULL, "B");
>   rb_c = gtk_radio_button_new_with_label (NULL, "C");
>   
>   radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (rb_a));
>   gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_b), radiogroup);
> 
>   radiogroup = gtk_radio_button_group (GTK_RADIO_BUTTON (rb_a));
>   gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_c), radiogroup);
> 
> This simple patch changes all added radio buttons to have active 
> set to FALSE when using gtk_radio_button_set_group().  I couldn't 
> find any code that actually uses gtk_radio_button_set_group(), and 
> I suspect nothing would break with this patch even if it was used.
> 
> Index: gtkradiobutton.c
> ===================================================================
> RCS file: /debian/home/gnomecvs/gtk+/gtk/gtkradiobutton.c,v
> retrieving revision 1.17
> diff -u -r1.17 gtkradiobutton.c
> --- gtkradiobutton.c    1999/01/12 15:12:09     1.17
> +++ gtkradiobutton.c    1999/01/20 02:11:34
> @@ -182,6 +182,8 @@
>           
>           tmp_button->group = radio_button->group;
>         }
> +
> +      GTK_TOGGLE_BUTTON (radio_button)->active = FALSE;
>      }
>    else
>      {
> 
> I'll apply it tomorrow unless someone thinks it's a bad idea.
> 
> -Shawn
> 
> --
> Shawn T. Amundson               
> amundson@gimp.org               http://www.gimp.org/~amundson
> 
> "The assumption that the universe looks the same in every
>  direction is clearly not true in reality." - Stephen Hawking
> 
> 
> -- 
>          To unsubscribe: mail gtk-devel-list-request@redhat.com with 
>                        "unsubscribe" as the Subject.
> 
--
Shawn T. Amundson               
amundson@gimp.org               http://www.gimp.org/~amundson

"The assumption that the universe looks the same in every
 direction is clearly not true in reality." - Stephen Hawking



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