#include <gtk/gtk.h>

GtkWidget *window;


static void
button_clicked_cb ()
{
  GtkWidget *dialog = gtk_dialog_new ();
  gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
  gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);

  gtk_window_resize (GTK_WINDOW (dialog), 50, 50);

  gtk_widget_show_all (dialog);
}

void
main (int argc, char **argv)
{
  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  GtkWidget *button = gtk_button_new_with_label ("Show Dialog");
  g_signal_connect (G_OBJECT (button), "clicked", button_clicked_cb, NULL);
  gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
  gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
  gtk_container_add (GTK_CONTAINER (window), button);



  gtk_window_resize (GTK_WINDOW (window), 200, 200);
  gtk_widget_show_all (window);
  gtk_main ();
}
