fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0001-gtkmenusectionbox-remove-submenus-when-the-parent-it.patch

f3b657
From 22cd8e9d4fabd6006c29e8d3f921f1ca72c1c1f2 Mon Sep 17 00:00:00 2001
f3b657
From: Jonathan Matthew <jonathan@d14n.org>
f3b657
Date: Wed, 9 Mar 2016 22:44:45 +1000
f3b657
Subject: [PATCH] gtkmenusectionbox: remove submenus when the parent item is
f3b657
 removed
f3b657
f3b657
https://bugzilla.gnome.org/show_bug.cgi?id=749405
f3b657
---
f3b657
 gtk/gtkmenusectionbox.c | 16 ++++++++++++++++
f3b657
 1 file changed, 16 insertions(+)
f3b657
f3b657
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
f3b657
index 2de27da..455637d 100644
f3b657
--- a/gtk/gtkmenusectionbox.c
f3b657
+++ b/gtk/gtkmenusectionbox.c
f3b657
@@ -195,9 +195,25 @@ gtk_menu_section_box_remove_func (gint     position,
f3b657
                                   gpointer user_data)
f3b657
 {
f3b657
   GtkMenuSectionBox *box = user_data;
f3b657
+  GtkMenuTrackerItem *item;
f3b657
+  GtkWidget *widget;
f3b657
   GList *children;
f3b657
 
f3b657
   children = gtk_container_get_children (GTK_CONTAINER (box->item_box));
f3b657
+
f3b657
+  widget = g_list_nth_data (children, position);
f3b657
+
f3b657
+  item = g_object_get_data (G_OBJECT (widget), "GtkMenuTrackerItem");
f3b657
+  if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU)) {
f3b657
+    GtkWidget *stack, *subbox;
f3b657
+
f3b657
+    stack = gtk_widget_get_ancestor (GTK_WIDGET (box->toplevel), GTK_TYPE_STACK);
f3b657
+    subbox = gtk_stack_get_child_by_name (GTK_STACK (stack), gtk_menu_tracker_item_get_label (item));
f3b657
+    if (subbox != NULL) {
f3b657
+      gtk_container_remove (GTK_CONTAINER (stack), subbox);
f3b657
+    }
f3b657
+  }
f3b657
+
f3b657
   gtk_widget_destroy (g_list_nth_data (children, position));
f3b657
   g_list_free (children);
f3b657
 
f3b657
-- 
f3b657
2.7.4
f3b657