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 635253 - GtkRadioButton constructors don't mark group as "allow-none"
GtkRadioButton constructors don't mark group as "allow-none"
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
2.91.x
Other Linux
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-11-19 09:19 UTC by Martin Pitt
Modified: 2010-11-19 15:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.84 KB, patch)
2010-11-19 09:21 UTC, Martin Pitt
accepted-commit_now Details | Review

Description Martin Pitt 2010-11-19 09:19:09 UTC
In the current introspection data, the various gtk_radio_button_new_* constructors take an existing group or widget. These all allow to pass a "None" widget or group list, so that it becomes much easier to build a radio button list in a loop (pass in None the first time, and the previously created button in all other iterations).

The "allow-none" is missing, though, so you currently have to work around this with something like

   b = None
   for option in my_options:
       # use previous radio button as group
       if b:
           b = Gtk.RadioButton.new_with_label_from_widget(b, option)
       else:
           b = Gtk.RadioButton.new_with_label([], option)

It should just work with

   b = None
   for option in my_options:
       # use previous radio button as group
       b = Gtk.RadioButton.new_with_label_from_widget(b, option)

but that currently throws

TypeError: unbound method new_with_label_from_widget() must be called with RadioButton instance as first argument (got NoneType instance instead)
Comment 1 Martin Pitt 2010-11-19 09:21:23 UTC
Created attachment 174830 [details] [review]
patch
Comment 2 Martin Pitt 2010-11-19 09:26:03 UTC
Whoopsie, seems I accidentally screwed up the severity.
Comment 3 Johan (not receiving bugmail) Dahlin 2010-11-19 13:06:38 UTC
Review of attachment 174830 [details] [review]:

If you've tested annotations and are sure that they are correct you can just push them to Gtk+ without opening a bug.
Comment 4 Martin Pitt 2010-11-19 15:32:10 UTC
Thanks. I tested it, and some do work now, like Gtk.RadioButton.new_with_label(None, "hello") . Unfortunately some still remain broken (like new_with_label_from_widget()) due to bug 561264, but that's an orthogonal issue. The "allow-none" tags are still correct to have IMHO.