I'm no expert.., but seems like maybe your radio group isn't the same
for your 3 gtk_radio_menu_item_new_with_mnemonic calls, otherwise Gtk
handles toggling of the radio buttons for you.

Note, to prevent your callback being triggered when you call
gtk_check_menu_item_set_active, you can use
g_signal_handlers_block_by_func or one of its variants.

On Mon, 2016-05-09 at 22:34 -0400, Matt Postiff wrote:
> Hi,
> 
> Still learning with gtk2. I have a menu with a submenu. That submenu 
> contains items for three mutually exclusive states in my program: A, B, and 
> C. 
> Each menu item is created with code like:
>      A_menu_item = gtk_radio_menu_item_new_with_mnemonic(group, "label")
> 
> In the constructor, my program does
>      gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (A_menu_item), 
> true); // default
> to set the checkmark next to A to start things.
> 
> Then if the user clicks on Menu | Submenu | B, it was my understanding 
> that B would get the checkmark/true, and A's checkmark would be auto
> erased/false and I could process what is necessary when B becomes true.
> 
> I have a shared handler for activate signal on these menu items, and 
> when B is clicked, I see a situation where both A and B are true. What 
> am I missing?
> 
> I thought OK, maybe gtk leaves it to me to figure out which radio item 
> needs to be turned on, and turn the rest off. But this has me call
>      gtk_check_menu_item_set_active(menuitem, false);
> for each of the menuitems that shouldn't be on. This generates more 
> signals to my signal handler, and I end up with a mess of nested calls 
> to the signal handler and my program gets totally confused, not to 
> mention its author.
> 
> Thanks for any guidance. You all have been helpful to me before :-)
> 
> Matt
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to