[gnome-terminal] window: Remove popup accelerators also in submenus



commit 52b2889f3ba204501ac6d154cb1d78aba072d82f
Author: Christian Persch <chpe src gnome org>
Date:   Mon Jan 8 12:06:19 2018 +0100

    window: Remove popup accelerators also in submenus
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792319

 src/terminal-window.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 5adf7d2..8a1bf17 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -263,11 +263,18 @@ popup_menu_remove_accelerators (GtkWidget *menu)
 
   menu_items = gtk_container_get_children (GTK_CONTAINER (menu));
   for (l = menu_items; l != NULL; l = l ->next) {
-    GtkWidget *label;
+    GtkMenuItem *item = (GtkMenuItem*) (l->data);
+    GtkWidget *label, *submenu;
 
-    if (GTK_IS_BIN (l->data) &&
-        GTK_IS_ACCEL_LABEL ((label = gtk_bin_get_child (GTK_BIN (l->data)))))
+    if (!GTK_IS_MENU_ITEM (item))
+      continue;
+
+    if (GTK_IS_ACCEL_LABEL ((label = gtk_bin_get_child (GTK_BIN (item)))))
       gtk_accel_label_set_accel (GTK_ACCEL_LABEL (label), 0, 0);
+
+    /* Recurse into submenus */
+    if ((submenu = gtk_menu_item_get_submenu (item)))
+      popup_menu_remove_accelerators (submenu);
   }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]