/*
 * Testcase for GTK+ 2.14 GtkFileChooserButton
 *
 * Creates a GtkFileChooserButton with a single filter.
 *
 * Open the dialog the first time. Filter is selected as expected.
 * Open the dialog the second time. No filter is selected.
 *
 * This worked correctly in GTK+ 2.12.
 */

#include <gtk/gtk.h>

int
main (int argc, char **argv)
{
	gtk_init (&argc, &argv);

	g_print ("Compiled with GTK+ %i.%i.%i\n",
			GTK_MAJOR_VERSION,
			GTK_MINOR_VERSION,
			GTK_MICRO_VERSION);
	g_print ("Using GTK+ %i.%i.%i\n",
			gtk_major_version,
			gtk_minor_version,
			gtk_micro_version);

	GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	GtkWidget *button = gtk_file_chooser_button_new ("Booyah",
			GTK_FILE_CHOOSER_ACTION_OPEN);

	/* create a filter */
	GtkFileFilter *filter = gtk_file_filter_new ();
	gtk_file_filter_set_name (filter, "The Works");
	gtk_file_filter_add_pattern (filter, "*");

	/* add it to the chooser */
	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (button), filter);

	gtk_container_add (GTK_CONTAINER (window), button);

	g_signal_connect_swapped (window, "destroy",
			G_CALLBACK (gtk_main_quit), NULL);

	gtk_widget_show_all (window);

	gtk_main ();
}
