// g++ demo.cxx `pkg-config --cflags --libs gtk+-3.0`
// gtk_window_present demo
// other window should be presented on clicking foo

#include <gtk/gtk.h>

GtkWidget *window_a;
GtkWidget *window_b;

static void change_callback( GtkWidget *widget,
                      gpointer   data )
{
    gtk_window_present(GTK_WINDOW(window_b));
}

int main( int   argc,
          char *argv[] )
{
    gtk_init (&argc, &argv);
    
    window_a = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    window_b = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    GtkWidget *button = gtk_button_new_with_label("foo");
    gtk_container_add(GTK_CONTAINER (window_a), button);

    g_signal_connect (button, "clicked",
		      G_CALLBACK (change_callback), NULL);

    GtkWidget *label = gtk_label_new("this window should present on clicking foo");
    gtk_container_add(GTK_CONTAINER (window_b), label);

    gtk_widget_show_all(window_b);
    gtk_widget_show_all(window_a);

    gtk_main ();
    
    return 0;
}
