/* Test program for GtkFontSelectionDialog. Behaves as
   expected when built with gtk 2, but is partially
   broken when built against gtk 3 (version 3.4.3 used).

   Allin Cottrell, 2011-09-13
*/

#include <gtk/gtk.h>

static void fontsel (GtkWidget *button, gpointer data)
{
    GtkWidget *fontsel;

    fontsel = gtk_font_selection_dialog_new("font selector");
    gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontsel), 
					    "sans 10"); 
    g_signal_connect_swapped
	(G_OBJECT(gtk_font_selection_dialog_get_cancel_button
		  GTK_FONT_SELECTION_DIALOG(fontsel)),
	 "clicked", G_CALLBACK(gtk_widget_destroy),
	 fontsel);
    gtk_widget_show(fontsel);
}

int main (int argc, char *argv[])
{
    GtkWidget *w, *button;

    gtk_init(&argc, &argv);

    w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    g_signal_connect(G_OBJECT(w), "destroy",
		     G_CALLBACK(gtk_main_quit), NULL);

    button = gtk_button_new_with_label("Fonts");
    g_signal_connect(G_OBJECT(button), "clicked", 
		     G_CALLBACK(fontsel), w);
    gtk_container_add(GTK_CONTAINER(w), button);

    gtk_widget_show_all(w);

    gtk_main();

    return 0;
}
