From 2a64cf4514f5be4d7d6c660f960ece024a6928c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jir=CC=8Ci=CC=81=20Techet?= Date: Mon, 16 Feb 2015 16:27:12 +0100 Subject: [PATCH] Resync menu after activating radio item Since the "radio item" menu entry concept does not exist in OS X, we need to resync the OS X menu after switching the radio entry to get it to the same state as the underlying GtkMenu. --- src/cocoa_menu_item.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cocoa_menu_item.c b/src/cocoa_menu_item.c index dd46586..daaab01 100644 --- a/src/cocoa_menu_item.c +++ b/src/cocoa_menu_item.c @@ -472,6 +472,15 @@ cocoa_menu_item_sync (GtkWidget* menu_item) } +static void +menu_item_activate (GtkMenuItem *item) +{ + g_return_if_fail (GTK_IS_MENU_ITEM (item)); + + gtk_menu_item_activate(item); + if (GTK_IS_RADIO_MENU_ITEM (item)) + [(_GNSMenuBar*)[NSApp mainMenu] resync]; +} /* * If the menu item does contain an image Widget, depending of what @@ -574,7 +583,7 @@ cocoa_menu_item_add_item (NSMenu* cocoa_menu, GtkWidget* menu_item, int index) NSString *title = [NSString stringWithUTF8String: (text ? text : "")]; GClosure *menu_action = - g_cclosure_new_object_swap (G_CALLBACK (gtk_menu_item_activate), + g_cclosure_new_object_swap (G_CALLBACK (menu_item_activate), G_OBJECT (menu_item)); g_closure_set_marshal (menu_action, g_cclosure_marshal_VOID__VOID); -- 2.2.1