After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 95651 - radiobuttons' get_group and set_group don't match
radiobuttons' get_group and set_group don't match
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other All
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
: 117664 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-10-13 01:44 UTC by Jussi Pakkanen
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jussi Pakkanen 2002-10-13 01:44:06 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.
Comment 1 Murray Cumming 2002-10-13 10:41:30 UTC
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.
Comment 2 Jussi Pakkanen 2002-10-13 13:15:11 UTC
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.
Comment 3 Murray Cumming 2002-10-14 12:50:49 UTC
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.
Comment 4 Jussi Pakkanen 2002-10-14 13:39:02 UTC
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 ..."
Comment 5 Murray Cumming 2002-10-14 18:22:06 UTC
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.
Comment 6 Olav Vitters 2003-07-17 10:38:06 UTC
*** Bug 117664 has been marked as a duplicate of this bug. ***