menusectionbox: Fix submenu-action for nested menus

We were not updating the state of submenu-actions
for nested submenus.

Fixes: #3721
This commit is contained in:
Matthias Clasen 2021-03-08 00:43:43 -05:00
parent b11f31afea
commit debcc62775

View File

@ -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
{