GNOME Bugzilla – Bug 95651
radiobuttons' get_group and set_group don't match
Last modified: 2004-12-22 21:47:04 UTC
Currently radiobuttons' get_group method is defined like this: Group get_group (); However, group assigning functions expect a reference to the group, not the group itself. Currently you can't do this: rb1.set_group(rb2.get_group()); They lead to this error: from rvalue of type `Gtk::RadioButton_Helpers::Group' /usr/include/gtkmm-2.0/gtkmm/radiobutton.h:158: in passing argument 1 of `Gtk::RadioButton::set_group(Gtk::RadioButton_Helpers::Group &)' Radiobutton's documentation says that this should be possible, but the current implementation seems not to allow this. GTKMM 1.2 did not use references as arguments.
I think that this is just how it is. Please tell us what part of the documentation needs to be corrected, or provide a patch.
The radiobuttons' doc I used was this: http://gtkmm.sourceforge.net/gtkmm2/reference/html/classGtk_1_1RadioButton.html It says: "After constructing the first RadioButton in a group, use get_group() and provide this Group to the constructors ot the other RadioButtons in the same group." You can't do this directly because it returns an object and the constructor wants a reference. Instead you have to declare your own RadioButton_Helpers::Group object and give that as an argument to all radio buttons. I can think of three ways to fix this (in decreasing order of personal preference): 1. make get_group return a reference 2. add a new function to radiobuttons, such as same_group_as(Gtk::Rediobutton &rb) 3. explicitly say in the docs that you need your own Group object I liked the way this worked in GTKMM 1.2. You could assign buttons to same groups without having to fiddle with Radiobutton_Helpers.
It's not ideal, but there was some reason for the change - you might look in the ChangeLog for an explanation. The documentation doesn't sound incorrect.
I looked at the changelog and it seems to be some hairy gtk/glib thing. There's nothing actually incorrect with the documentation. It just doesn't tell the whole story. This is bad for people who read the reference documentation but don't read the examples thoroughly (such as me). The documentation only needs a small change. Possibly something like this (change is for the clip above): " ... RadioButton in a group, use get_group() to store the group to a Radiobutton_Helpers::Group object. Then you provide this Group object to the constructors ..."
Yes, we just wrap the GTK+ behaviour as best we can. Actually, RadioButton::Group is fine, and more obvious. I just corrected the book chapter on RadioButtons (not yet online - it's in CVS) but feel free to add to the reference documentation too.
*** Bug 117664 has been marked as a duplicate of this bug. ***