Re: bug with Gtk2::ActionGroup->add_radio_actions() ?




On Jul 24, 2006, at 3:03 PM, Jaap Karssenberg wrote:

I try to add a number of radio actions to a menu without setting one of
them active yet. (The reason for this is that I want the "on_change"
callback to be called when I later set the default value from the
applications config file).

The C api reference say about the "value" argument to "add_radio_actions()"

        the value of the action to activate initially, or -1 if no
        action should be activated

I tried setting this value to -1 and to undef, but somehow the first
radio action is always set active.

Could this be a bug in the perl bindings or do I need to look elsewhere ?

The implementation of add_radio_actions() in the bindings is very similar to the implementation of gtk_action_group_add_radio_actions_full() in gtk+; it had to be reimplemented to handle marshaling parameters from the perl stack. The logic is basically:

    pull fixed arguments from the stack
    create a temp array big enough to hold all the entries
    parse the entries from the rest of the stack
    for each action
         create the action
         add to group
         if (value == entries[i].value)
             gtk_toggle_action_set_active (action, TRUE);
         more setup

The "value" argument appears only in two places --- where it is pulled from the stack, and where it is compared with entries [i].value. The entries are parsed by a local function which will coerce undef to 0, but should leave -1 unchanged.


Of course, some time has passed (*cough*) since you posted this, and maybe the bug has already been fixed. Are you still seeing this behavior?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]