Hi.

Sorry for the delay, but you left out the list from your reply and I
missed your mail.

> Thank you for answer, but the documentation states
>
> gtk_radio_tool_button_set_group ()
>
> void                gtk_radio_tool_button_set_group     (GtkRadioToolButton 
> *button,
>                                                          GSList *group);
>
> Adds button to group, removing it from the group it belonged to before.
>
> button :
>
> a GtkRadioToolButton
>
> group :
>
> an existing radio button group
>
>
> but no where says that this group may be deleted, may be it's a documentation 
> bug?))

Well, if you look on this subject from technical view, NULL pointer
represent empty GSList, so groups are never actually deleted. But in
real life, this really doesn't matter.

> in code below we add some buttons to group but the length of list of buttons 
> belonging to that group equals 1!
> #include <gtk/gtk.h>
> int main (int argc, char **argv)
> {
> GtkWidget *radio_tool_btn_1 = NULL;
> GtkWidget *radio_tool_btn_2 = NULL;
> GtkWidget *radio_tool_btn_3 = NULL;
> GtkWidget *radio_tool_btn_4 = NULL;
> GSList *group1 = NULL;
> GSList *group2 = NULL;
> gint add_group_length_before = -1;
> gint add_group_length_after = -1;
> gtk_init (&argc, &argv);
> radio_tool_btn_1 = GTK_WIDGET(gtk_radio_tool_button_new(NULL));
> group1 = 
> gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(radio_tool_btn_1));
> radio_tool_btn_2 = GTK_WIDGET(gtk_radio_tool_button_new(NULL));
> group2 = 
> gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(radio_tool_btn_2));
> radio_tool_btn_3 = GTK_WIDGET(gtk_radio_tool_button_new(group2));
> radio_tool_btn_4 = GTK_WIDGET(gtk_radio_tool_button_new(group2));
> add_group_length_before = g_slist_length(group2);
> gtk_radio_tool_button_set_group(GTK_RADIO_TOOL_BUTTON(radio_tool_btn_3), 
> group1);
> group2 = 
> gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(radio_tool_btn_2));
> add_group_length_after = g_slist_length(group2);
> printf("after:%d\nbefore:%d\n", add_group_length_after, 
> add_group_length_before);
> return 0;
> }
> what you think about that??/  thanks)

add_group_length_before is 1 because adding button to groups prepends
elements to linked list. You haven't updated your pointer after the
last addition, which means that group2 points to last element in list
and g_slist_length() thus returns 1. Try adding this call just before
first g_slist_length() call and check the results then:

group2 = 
gtk_radio_tool_button_get_group(GTK_RADIO_TOOL_BUTTON(radio_tool_btn_2));

Tadej

--
Tadej Borovšak
tadeboro.blogspot.com
[email protected]
[email protected]
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to