From debcc6277581a3c43a77ec5991924abfe6ef0243 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 8 Mar 2021 00:43:43 -0500 Subject: [PATCH] menusectionbox: Fix submenu-action for nested menus We were not updating the state of submenu-actions for nested submenus. Fixes: #3721 --- gtk/gtkmenusectionbox.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c index 6210119c35..8dd8fe18f3 100644 --- a/gtk/gtkmenusectionbox.c +++ b/gtk/gtkmenusectionbox.c @@ -292,6 +292,22 @@ open_submenu (GtkWidget *button, gtk_widget_grab_focus (focus); } +static void +submenu_shown (GtkPopoverMenu *popover, + GtkMenuTrackerItem *item) +{ + if (gtk_menu_tracker_item_get_should_request_show (item)) + gtk_menu_tracker_item_request_submenu_shown (item, TRUE); +} + +static void +submenu_hidden (GtkPopoverMenu *popover, + GtkMenuTrackerItem *item) +{ + if (gtk_menu_tracker_item_get_should_request_show (item)) + gtk_menu_tracker_item_request_submenu_shown (item, FALSE); +} + static void gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item, int position, @@ -324,6 +340,9 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item, g_object_bind_property (item, "label", widget, "text", G_BINDING_SYNC_CREATE); g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE); g_object_bind_property (item, "sensitive", widget, "sensitive", G_BINDING_SYNC_CREATE); + + g_signal_connect (submenu, "show", G_CALLBACK (submenu_shown), item); + g_signal_connect (submenu, "hide", G_CALLBACK (submenu_hidden), item); } else {