/* Confirm that no warnings/criticals get generated by including multiple add/removes in a match w/o waiting on the mainloop to iterate. Copyright 2013 Canonical Ltd. Original sample code by Drew Bliss Modified for automatic testing by Charles Kerr */ #include /* exit() */ #include #include #include #include static GMainLoop * loop = NULL; static GtkWidget * top_gtk = NULL; static DbusmenuMenuitem * top_dbusmenu = NULL; static DbusmenuServer * menuservice = NULL; static void rebuild_menu (void) { GList * l; GList * children; int i; const int n = 10; static int count = 0; if (top_gtk == NULL) { top_gtk = gtk_menu_new (); gtk_widget_show (top_gtk); top_dbusmenu = dbusmenu_gtk_parse_menu_structure (top_gtk); menuservice = dbusmenu_server_new ("/org/ayatana/NotificationItem/test/Menu"); dbusmenu_server_set_root (menuservice, top_dbusmenu); } // remove all the previous children children = gtk_container_get_children (GTK_CONTAINER(top_gtk)); for (l=children; l!=NULL; l=l->next) gtk_widget_destroy (GTK_WIDGET (l->data)); // add a handful of new children for (i=0; i 5) { g_main_loop_quit (loop); return G_SOURCE_REMOVE; } if (iteration <= 2) { rebuild_menu (); } else { int i; for (i=0; i