[gtk/submenu-action-fixes: 1409/1409] menusectionbox: Fix submenu-action for nested menus
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/submenu-action-fixes: 1409/1409] menusectionbox: Fix submenu-action for nested menus
- Date: Sat, 5 Jun 2021 12:56:30 +0000 (UTC)
commit debcc6277581a3c43a77ec5991924abfe6ef0243
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 8 00:43:43 2021 -0500
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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]