4 /* Get the selected filename and print it to the console */
5 void file_ok_sel( GtkWidget
*w
,
8 g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs
)));
16 gtk_init (&argc
, &argv
);
18 /* Create a new file selection widget */
19 filew
= gtk_file_selection_new ("File selection");
21 g_signal_connect (G_OBJECT (filew
), "destroy",
22 G_CALLBACK (gtk_main_quit
), NULL
);
23 /* Connect the ok_button to file_ok_sel function */
24 g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew
)->ok_button
),
25 "clicked", G_CALLBACK (file_ok_sel
), (gpointer
) filew
);
27 /* Connect the cancel_button to destroy the widget */
28 g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew
)->cancel_button
),
29 "clicked", G_CALLBACK (gtk_widget_destroy
),
32 /* Lets set the filename, as if this were a save dialog, and we are giving
34 gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew
),
37 gtk_widget_show (filew
);