Re: [java-gnome-hackers] RadioAction and RadioMenuItem coverage
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2010-02-15 21:52:20
|
On Mon, 2010-02-15 at 22:15 +0100, Guillaume Mazoyer wrote: > Done. And the test case confirms what I was thinking. Great. The extra check you put in [which was actually a no-op type check] was misleading you. The error you were getting from GTK was in fact telling you the problem - which was that you were passing a NULL down to a constructor that doesn't accept them. So here's what I did to make Guillaume's branch work. Mostly it was just choosing different constructors to achieve the desired effect. I took a guess and experimented with what happens if you call gtk_radio_menu_action_new() with NULL as the GSList*. Turns out it works. === modified file 'src/bindings/org/gnome/gtk/RadioMenuItem.java' --- src/bindings/org/gnome/gtk/RadioMenuItem.java 2010-02-01 15:49:40 +0000 +++ src/bindings/org/gnome/gtk/RadioMenuItem.java 2010-02-15 21:36:47 +0000 @@ -73,11 +73,23 @@ * @since 4.0.15 */ public RadioMenuItem(RadioMenuItemGroup group, String label) { - this(GtkRadioMenuItem.createRadioMenuItemWithLabelFromWidget(group.getMember(), label)); + super(createFirstOrNext(group, label)); group.setMember(this); enclosingGroup = group; } + private static long createFirstOrNext(RadioMenuItemGroup group, String label) { + final RadioMenuItem first; + + first = group.getMember(); + + if (first == null) { + return GtkRadioMenuItem.createRadioMenuItemWithMnemonic(null, label); + } else { + return GtkRadioMenuItem.createRadioMenuItemWithMnemonicFromWidget(first, label); + } + } + Anyway, my fix to your branch is at bzr://research.operationaldynamics.com/bzr/java-gnome/hackers/andrew/radio-things Merge away :) On Fri, 2010-02-12 at 09:00 +0100, Guillaume Mazoyer wrote: > 'hackers/guillaume/toggle-action' Incidentally, if you copy a class verbatim, it'd be nice to put a note saying where you got the code from. It would have made it easier to realize that: $ diff src/bindings/org/gnome/gtk/RadioButtonGroup.java src/bindings/org/gnome/gtk/RadioMenuItemGroup.java wasn't going to show anything meaningful. That class sure is ulgy. And now there are two of them. :( You're right that it'd be nice to be able to have some group thing that was common for all the RadioWhatevers. Not sure how we'd do that, though. AfC Sydney -- Andrew Frederick Cowie Operational Dynamics is an operations and engineering consultancy focusing on IT strategy, organizational architecture, systems review, and effective procedures for change management: enabling successful deployment of mission critical information technology in enterprises, worldwide. http://www.operationaldynamics.com/ Sydney New York Toronto London |