which,
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); } else { dialog=dialog = gtk_file_chooser_dialog_new ("Open File", NULL, GTK_FILE_CHOOSER_ACTION_OPEN,
void GUI_FileSel(const char *label, SELFILE_CB * cb, int rw,char **rname){				/* Create the selector */    	GtkWidget *dialog;	char *name=NULL;	char *tmpname;	gchar *selected_filename;        uint8_t res;        GtkFileChooserAction which=GTK_FILE_CHOOSER_ACTION_OPEN;                if(rw) which=GTK_FILE_CHOOSER_ACTION_SAVE;	if(rname)		*rname=NULL;        dialog=dialog = gtk_file_chooser_dialog_new ("Open File",                                      NULL,                                      which,                                      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,                                      GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,                                      NULL);            gtk_window_set_title (GTK_WINDOW (dialog),label);        gtk_register_dialog(dialog);        if(rw)                res=prefs->get(LASTDIR_WRITE,&tmpname);         else               res=prefs->get(LASTDIR_READ,&tmpname);         if(res)	{                DIR *dir;                char *str=PathCanonize(tmpname);                PathStripName(str);                /* LASTDIR may have gone; then do nothing and use current dir instead (implied) */                if( (dir=opendir(str)) )                {                        closedir(dir);                        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),(gchar *)str);                }                delete [] str;        }        if(gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_ACCEPT)	{                        selected_filename= (gchar *) 	gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));#ifdef CYG_MANGLING                        if (*(selected_filename + strlen(selected_filename) - 1) == '\\'){#else			                        if (*(selected_filename + strlen(selected_filename) - 1) == '/'){#endif	                         GUI_Alert("Cannot open directory as file !");                }                else                {                        name=ADM_strdup(selected_filename);                        char *str=PathCanonize(name);                        PathStripName(str);                        if(rw)                                prefs->set(LASTDIR_WRITE,str);			                        else                                prefs->set(LASTDIR_READ,str);                                                delete [] str;                }        }        gtk_unregister_dialog(dialog);        gtk_widget_destroy(dialog);// CYB 2005.02.23        if(cb)        {                fileReadWrite(cb, rw, name);        }        else        {                *rname=name;          }}