#include <iostream>
#include <gtk/gtk.h>

void
ClickCallback(GtkWidget *widget, GdkEventButton *event, gpointer callback_data)
{

GtkWidget* dialog = gtk_file_chooser_dialog_new("My Dialog", NULL, GTK_FILE_CHOOSER_ACTION_OPEN, "test" );

GtkFileFilter* filter = gtk_file_filter_new();
gtk_file_filter_add_pattern (filter, "*");
gtk_file_filter_set_name (filter, "This is a really long name. Much, much longer than fits on my monitor. GTK+ really should ellipsise this text, but I suspect that it will not. There is really only one way to find out though.");

gtk_file_chooser_add_filter(GTK_FILE_CHOOSER (dialog), filter);
gtk_dialog_run(GTK_DIALOG(dialog));
}

static gboolean
QuitCallback(GtkWidget *window, gpointer data)
{
  gtk_main_quit();
  return FALSE;
}

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

  // Create a window with a button 
  GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  GtkWidget *vbox =  gtk_vbox_new(FALSE, 0);

    GtkWidget *gButton = gtk_button_new_with_label("Open FileChooserDialog");
    g_signal_connect(G_OBJECT(gButton), "button_press_event",
                     G_CALLBACK(ClickCallback), NULL);
    gtk_container_add(GTK_CONTAINER(vbox), gButton);

  gtk_container_add(GTK_CONTAINER(window), vbox);

  // Quit when our window closes
  g_signal_connect(G_OBJECT(window), "delete-event", 
		   G_CALLBACK(QuitCallback), NULL);

  gtk_widget_show_all(window);
  gtk_main();
  return 0;
}
