
#include <stdio.h>
#include <gtk/gtk.h>

static void destroy( GtkWidget *widget,
                     gpointer   data )
{
    gtk_main_quit ();
}

static GtkWidget *window = NULL;

static void
transient_dialog_clicked (GtkButton *button,
			gpointer   user_data)
{
  GtkWidget *dialog = gtk_dialog_new ();
      gtk_window_set_title (GTK_WINDOW (dialog), "Transient dialog");
      gtk_widget_set_size_request (dialog, 200, 200);

	gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ON_PARENT);

      gtk_widget_show_all (dialog);
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *button;
    
    gtk_init (&argc, &argv);
    
    /* Create a new dialog window for the scrolled window to be
     * packed into.  */
    window = gtk_dialog_new ();
    g_signal_connect (G_OBJECT (window), "destroy",
		      G_CALLBACK (destroy), NULL);
    gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
    gtk_container_set_border_width (GTK_CONTAINER (window), 0);
    gtk_widget_set_size_request (window, 300, 300);

      button = gtk_button_new_with_mnemonic ("_Transient Dialog");
      g_signal_connect (button, "clicked",
			G_CALLBACK (transient_dialog_clicked), NULL);
      gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);

    /* Add a "close" button to the bottom of the dialog */
    button = gtk_button_new_with_label ("close");
    g_signal_connect_swapped (G_OBJECT (button), "clicked",
			      G_CALLBACK (gtk_widget_destroy),
			      G_OBJECT (window));
    
    /* this makes it so the button is the default. */
     GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
    
    /* This grabs this button to be the default button. Simply hitting
     * the "Enter" key will cause this button to activate. */
    gtk_widget_grab_default (button);
    gtk_widget_show (button);
   
    gtk_widget_show_all (window);
    
    gtk_main();

   
    return 0;
}
