#include <gtk/gtk.h>
    
static void
present_cb (GtkButton *button,
            gpointer user_data)
{
  gtk_window_present (GTK_WINDOW (user_data));
}

static gboolean
on_timeout (gpointer user_data)
{
  gtk_window_present (GTK_WINDOW (user_data));

  return G_SOURCE_REMOVE;
}

static void
iconify_present_cb (GtkButton *button,
                    gpointer user_data)
{
  gtk_window_iconify (GTK_WINDOW (user_data));
  g_timeout_add_seconds (3, on_timeout, user_data);
}

int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *bbox;
  GtkWidget *button;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "gtk_window_present test case");
  g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_widget_destroyed),
                    &window);  

  bbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
  gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
  gtk_container_add (GTK_CONTAINER (window), bbox);
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
  gtk_box_set_spacing (GTK_BOX (bbox), 40);

  button = gtk_button_new_with_label ("Present");
  g_signal_connect (button,
                    "clicked",
                    G_CALLBACK (present_cb),
                    window);
  gtk_container_add (GTK_CONTAINER (bbox), button);

  button = gtk_button_new_with_label ("Iconify & Present");
  g_signal_connect (button,
                    "clicked",
                    G_CALLBACK (iconify_present_cb),
                    window);
  gtk_container_add (GTK_CONTAINER (bbox), button);

  gtk_widget_show_all (window);
  gtk_main ();

  return 0;
}
