-
Cosimo Cecchi authored
Right now, when we create a GtkModelMenu for a GMenuModel, we listen to changes to the menu's attach-widget to detect when a toplevel GtkApplicationWindow becomes available to fetch actions from it. This unfortunately breaks this simple code: GtkWidget *application_window = gtk_application_window_new(); GtkWidget *menu_button = gtk_menu_button_new(); GMenuModel *menu_model = get_menu_model(); gtk_menu_button_set_menu_model(menu_button, menu_model); gtk_container_add(GTK_CONTAINER(application_window), menu_button); Since GtkMenuButton creates a GtkModelMenu and sets itself as its attach widget before it's added to a hierarchy containing a GtkApplicationWindow. Fix the bug by simply listening for changes in the window hierarchy, and creating the menu model when the attach widget is added to an application window. https://bugzilla.gnome.org/show_bug.cgi?id=679454
5dbf3a57