Hi Aniello,

That callback in gtk_action_group_add_radio_actions connects to the
"changed" signal of the radio actions.

And from the docs:
The ::changed signal is emitted on every member of a radio group when
the active member is changed. The signal gets emitted after the
::activate signals for the previous and current active members.

So, this way you can check which of the actions was changed (1st
argument of the cb) and the one that got activated (2nd argument of the cb).

On the other hand, the approach you mentioned (having a callback when
the user presses the pen button) may be accomplished using
GtkToggleAction objects with which you can assign a callback for every
action.
Since a radio button is a toggle button, it might work.


Cheers,

--
Joaquim Rocha

Aniello Del Sorbo wrote:
> Actually I think I should use the on_change callback function in
> gtk_action_group_add_radio_actions.
> 
> Trying it..
> 
> Will report.
> Aniello
> 
> 2009/9/15 Aniello Del Sorbo <ani...@gmail.com>:
>> Hi,
>>
>> I have an issue with my interface.
>>
>> I've created my interface using GtkUIManager from an xml file.
>> In this file I've created a toolbar:
>>
>>        <toolbar action='HildonToolBar'>
>>                <toolitem action='Pen'/>
>>                <toolitem action='Eraser'/>
>>                <toolitem action='Highlighter'/>
>>                <toolitem action='Text'/>
>>        </toolbar>
>>
>> in the code I've this gtkradioaction entries:
>>
>> static GtkRadioActionEntry hildon_tools_radio_entries[] = {
>>  { "Pen", "pen", N_("_Pen"), "<control><shift>P", NULL, 0 },
>>  { "Eraser", "eraser", N_("_Eraser"), "<control><shift>E", NULL, 1 },
>>  { "Highlighter", "highlighter", N_("_Highlighter"),
>> "<control><shift>H", NULL, 2 },
>>  { "Text", "text", N_("_Text"), "<control><shift>T", NULL, 3 }
>> };
>>
>> that I add to an action group like this:
>>
>> gtk_action_group_add_radio_actions (action_group, hildon_tools_radio_entries,
>>                  G_N_ELEMENTS(hildon_tools_radio_entries), 0, NULL,
>> hildon_window);
>>
>> They show up fine, I can click on them and only one at a time is
>> selected. And that's fine.
>> But now, how can I set up a callback action whenever, for example, a
>> Pen button is toggled?
>>
>> It worked for menus as the action entries for those had a callback
>> entry I used to specify the callback function.
>> But I am lost on how to connect those radio buttons to actual function
>> in order to perform what they need.
>>
>> Also I want them to reflect the choice the user makes in the menu
>> (actually, I have not dug into the menu issue yet, but I've noticed
>> there are buttons now in Fremantle).
>>
>> Anyway.. suggestions?
>>
>> Thanks!
>>
>> --
>> anidel
>>
> 
> 
> 

_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to