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

GtkWidget* window;
GtkWidget* filechooser;

static void stop()
{
    printf("Selected path: %s\n", gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(filechooser)));
    gtk_main_quit();
}

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

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    filechooser = gtk_file_chooser_button_new("Select a directory", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);

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

    gtk_signal_connect(GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (stop), NULL);
    gtk_main();
}

