Fix 'make distcheck' failure.
3 /* This is a callback function. The data arguments are ignored
4 * in this example. More on callbacks below. */
5 static void hello( GtkWidget *widget,
8 g_print ("Hello World\n");
11 static gboolean delete_event( GtkWidget *widget,
15 /* If you return FALSE in the "delete_event" signal handler,
16 * GTK will emit the "destroy" signal. Returning TRUE means
17 * you don't want the window to be destroyed.
18 * This is useful for popping up 'are you sure you want to quit?'
21 g_print ("delete event occurred\n");
23 /* Change TRUE to FALSE and the main window will be destroyed with
24 * a "delete_event". */
29 /* Another callback */
30 static void destroy( GtkWidget *widget,
39 /* GtkWidget is the storage type for widgets */
43 /* This is called in all GTK applications. Arguments are parsed
44 * from the command line and are returned to the application. */
45 gtk_init (&argc, &argv);
47 /* create a new window */
48 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
50 /* When the window is given the "delete_event" signal (this is given
51 * by the window manager, usually by the "close" option, or on the
52 * titlebar), we ask it to call the delete_event () function
53 * as defined above. The data passed to the callback
54 * function is NULL and is ignored in the callback function. */
55 g_signal_connect (G_OBJECT (window), "delete_event",
56 G_CALLBACK (delete_event), NULL);
58 /* Here we connect the "destroy" event to a signal handler.
59 * This event occurs when we call gtk_widget_destroy() on the window,
60 * or if we return FALSE in the "delete_event" callback. */
61 g_signal_connect (G_OBJECT (window), "destroy",
62 G_CALLBACK (destroy), NULL);
64 /* Sets the border width of the window. */
65 gtk_container_set_border_width (GTK_CONTAINER (window), 10);
67 /* Creates a new button with the label "Hello World". */
68 button = gtk_button_new_with_label ("Hello World");
70 /* When the button receives the "clicked" signal, it will call the
71 * function hello() passing it NULL as its argument. The hello()
72 * function is defined above. */
73 g_signal_connect (G_OBJECT (button), "clicked",
74 G_CALLBACK (hello), NULL);
76 /* This will cause the window to be destroyed by calling
77 * gtk_widget_destroy(window) when "clicked". Again, the destroy
78 * signal could come from here, or the window manager. */
79 g_signal_connect_swapped (G_OBJECT (button), "clicked",
80 G_CALLBACK (gtk_widget_destroy),
83 /* This packs the button into the window (a gtk container). */
84 gtk_container_add (GTK_CONTAINER (window), button);
86 /* The final step is to display this newly created widget. */
87 gtk_widget_show (button);
90 gtk_widget_show (window);
92 /* All GTK applications must have a gtk_main(). Control ends here
93 * and waits for an event to occur (like a key press or