tests: Fix issues with menu shells

The menu shell is no longer the direct
parent of menu items.
This commit is contained in:
Matthias Clasen 2019-06-01 03:20:03 +00:00
parent feef0ef93a
commit 0a33d74c1b

View File

@ -2000,7 +2000,7 @@ get_parent_menubar (GtkWidget *menuitem)
GtkMenuShell *menu_shell;
GtkWidget *attach = NULL;
menu_shell = GTK_MENU_SHELL (gtk_widget_get_parent (menuitem));
menu_shell = GTK_MENU_SHELL (gtk_widget_get_ancestor (menuitem, GTK_TYPE_MENU_SHELL));
g_assert (GTK_IS_MENU_SHELL (menu_shell));
@ -2008,7 +2008,7 @@ get_parent_menubar (GtkWidget *menuitem)
{
if (GTK_IS_MENU (menu_shell) &&
(attach = gtk_menu_get_attach_widget (GTK_MENU (menu_shell))) != NULL)
menu_shell = GTK_MENU_SHELL (gtk_widget_get_parent (attach));
menu_shell = GTK_MENU_SHELL (gtk_widget_get_ancestor (attach, GTK_TYPE_MENU_SHELL));
else
menu_shell = NULL;
}