#include <gtk/gtk.h> 

char *fichier;
char commande[255];

void file_ok_sel( GtkWidget        *w,
                  GtkFileSelection *fs )
{
    //g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
	
	fichier=gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
	sprintf(commande,"./mangoquest %s",fichier);
	
	printf("commande : %s\n",commande);
	
	/*system(commande);*/
	
} 

void destroy( GtkWidget *widget,
              gpointer   data )
{
    gtk_main_quit ();
} 

int main( int   argc,
          char *argv[] )
{
    GtkWidget *filew;
   
    gtk_init (&argc, &argv);
   
    /* Create a new file selection widget */
    filew = gtk_file_selection_new ("Select the map");
   
    gtk_signal_connect (GTK_OBJECT (filew), "destroy",
(GtkSignalFunc) destroy, &filew);
    /* Connect the ok_button to file_ok_sel function */
    gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
"clicked", (GtkSignalFunc) file_ok_sel, filew );
   
    /* Connect the cancel_button to destroy the widget */
    gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION
                                            (filew)->cancel_button),
       "clicked", (GtkSignalFunc) gtk_widget_destroy,
       GTK_OBJECT (filew));
   
    /* Lets set the filename, as if this were a save dialog, and we are giving
     a default filename */
    gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew),
     "/home/phneutre/.mangoquest/maps/");
	  gtk_file_selection_complete(GTK_FILE_SELECTION(filew),
     "*.shx");


   
    gtk_widget_show(filew);
    gtk_main ();
    return 0;
}
