summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Matthew <jonathan@d14n.org>2016-03-09 22:44:45 +1000
committerMatthias Clasen <mclasen@redhat.com>2016-05-05 15:03:58 -0400
commit761f19e7d7b81dac63643628b8a1f7935d9f0342 (patch)
treed9dfaaad1c2014d1a51cbd4134a5a9f945dbecef
parentc33d8c7005f11d32451b92f18006ba317bc9eae0 (diff)
downloadgtk+-761f19e7d7b81dac63643628b8a1f7935d9f0342.tar.gz
gtkmenusectionbox: remove submenus when the parent item is removed
https://bugzilla.gnome.org/show_bug.cgi?id=749405
-rw-r--r--gtk/gtkmenusectionbox.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index 2de27dab0b..455637d6e5 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -195,9 +195,25 @@ gtk_menu_section_box_remove_func (gint position,
gpointer user_data)
{
GtkMenuSectionBox *box = user_data;
+ GtkMenuTrackerItem *item;
+ GtkWidget *widget;
GList *children;
children = gtk_container_get_children (GTK_CONTAINER (box->item_box));
+
+ widget = g_list_nth_data (children, position);
+
+ item = g_object_get_data (G_OBJECT (widget), "GtkMenuTrackerItem");
+ if (gtk_menu_tracker_item_get_has_link (item, G_MENU_LINK_SUBMENU)) {
+ GtkWidget *stack, *subbox;
+
+ stack = gtk_widget_get_ancestor (GTK_WIDGET (box->toplevel), GTK_TYPE_STACK);
+ subbox = gtk_stack_get_child_by_name (GTK_STACK (stack), gtk_menu_tracker_item_get_label (item));
+ if (subbox != NULL) {
+ gtk_container_remove (GTK_CONTAINER (stack), subbox);
+ }
+ }
+
gtk_widget_destroy (g_list_nth_data (children, position));
g_list_free (children);