#include <gtk/gtk.h>

static GtkWidget *chooser_dialog;
static GtkWidget *chooser_button;

static void
chooser_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer data)
{
	if (response_id == GTK_RESPONSE_NO) {
		gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (chooser_button));
	}
}

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

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_default_size (GTK_WINDOW (window), 200, -1);

	chooser_dialog = gtk_file_chooser_dialog_new ("Choose an icon",
						      GTK_WINDOW (window),
						      GTK_FILE_CHOOSER_ACTION_OPEN,
						      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
						      NULL);

	button = gtk_button_new_with_mnemonic ("No Image");
	gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_BUTTON));
	gtk_widget_show (button);
	gtk_dialog_add_action_widget (GTK_DIALOG (chooser_dialog), button, GTK_RESPONSE_NO);
	gtk_dialog_add_button (GTK_DIALOG (chooser_dialog), GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT);

	chooser_button = gtk_file_chooser_button_new_with_dialog (chooser_dialog);

	g_signal_connect (chooser_dialog, "response",
			  G_CALLBACK (chooser_dialog_response_cb), NULL);

	gtk_container_add (GTK_CONTAINER (window), chooser_button);
	gtk_widget_show_all (window);

	gtk_main ();
	return 0;
}
