X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=filebrowser%2Fselfile.c;h=2e3495589291cf45700edfcd2816971b1d3453b0;hb=715e33a60133ac9ac76b3aa0a5cf6f14f0f3930f;hp=a858e345b8e140899247eac846579b2925a47e6c;hpb=5dca19a2828b0e6e0594b734792533e0c4f76146;p=xboard.git diff --git a/filebrowser/selfile.c b/filebrowser/selfile.c index a858e34..2e34955 100644 --- a/filebrowser/selfile.c +++ b/filebrowser/selfile.c @@ -139,6 +139,8 @@ XtIntervalId SFdirModTimerId; int (*SFfunc)(); +Boolean SFpathFlag; // [HGM] + static char *oneLineTextEditTranslations = "\ Return: redraw-display()\n\ CtrlM: redraw-display()\n\ @@ -676,6 +678,12 @@ XsraSelFile(toplevel, prompt, ok, cancel, failed, cancel = "Cancel"; } + if(SFpathFlag != (mode && mode[0] == 'p')) { // [HGM] ignore everything that is not a directory + if(SFdirs) XtFree(SFdirs); + SFdirs = NULL; // kludge to throw away all cached info + SFpathFlag = !SFpathFlag; + } + if (firstTime) { firstTime = 0; SFdisplay = XtDisplay(toplevel); @@ -749,6 +757,10 @@ XsraSelFile(toplevel, prompt, ok, cancel, failed, break; case SEL_FILE_OK: *name_return = SFgetText(); + if(mode && (mode[0] == 'p' || mode[0] == 'f')) { // [HGM] for use in file-option browse button + SFprepareToReturn(); + return stderr; + } if (fp = SFopenFile(*name_return, mode, prompt, failed)) { SFprepareToReturn();