diff options
| author | Greg Ercolano <erco@seriss.com> | 2020-07-14 11:34:18 -0700 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2020-07-14 11:34:18 -0700 |
| commit | 54425030774eb04b29c749ffa85d224c8bbfcc34 (patch) | |
| tree | f6e8b0c9fd46f5bcf160de82d613e7799288e277 /src/Fl_File_Chooser2.cxx | |
| parent | 58296c373a79ac404e86f8a4b20a5309db2f00de (diff) | |
| parent | da76085fe71d2271847f95f5aa0694a9373fbba0 (diff) | |
Merge branch 'issue-99a': add OS error messages to Fl_File_Chooser
Pulling in Greg & Albrecht's work on PR #99 and PR #103.
This includes supporting operating system error messages
in the user's local language, which took some extra effort.
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index de2b7c160..ec04bd77c 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -1020,17 +1020,15 @@ void Fl_File_Chooser::preview(int e) Fl_Group *p = previewBox->parent(); if (e) { int w = p->w() * 2 / 3; - fileList->resize(fileList->x(), fileList->y(), - w, fileList->h()); - previewBox->resize(fileList->x()+w, previewBox->y(), - p->w()-w, previewBox->h()); + fileList->resize(fileList->x(), fileList->y(), w, fileList->h()); + errorBox->resize(errorBox->x(), errorBox->y(), w, errorBox->h()); + previewBox->resize(fileList->x()+w, previewBox->y(), p->w()-w, previewBox->h()); previewBox->show(); update_preview(); } else { - fileList->resize(fileList->x(), fileList->y(), - p->w(), fileList->h()); - previewBox->resize(p->x()+p->w(), previewBox->y(), - 0, previewBox->h()); + fileList->resize(fileList->x(), fileList->y(), p->w(), fileList->h()); + errorBox->resize(errorBox->x(), errorBox->y(), p->w(), errorBox->h()); + previewBox->resize(p->x()+p->w(), previewBox->y(), 0, previewBox->h()); previewBox->hide(); } p->init_sizes(); @@ -1070,7 +1068,14 @@ Fl_File_Chooser::rescan() okButton->deactivate(); // Build the file list... - fileList->load(directory_, sort); + if ( fileList->load(directory_, sort) <= 0 ) { + if ( fileList->errmsg() ) errorBox->label(fileList->errmsg()); // show OS errormsg when possible + else errorBox->label("No files found..."); + show_error_box(1); + } else { + show_error_box(0); + } + if (Fl::system_driver()->dot_file_hidden() && !showHiddenButton->value()) remove_hidden_files(); // Update the preview box... update_preview(); @@ -1094,7 +1099,13 @@ void Fl_File_Chooser::rescan_keep_filename() strlcpy(pathname, fn, sizeof(pathname)); // Build the file list... - fileList->load(directory_, sort); + if (fileList->load(directory_, sort) <= 0) { + if ( fileList->errmsg() ) errorBox->label(fileList->errmsg()); // show OS errormsg when possible + else errorBox->label("No files found..."); + show_error_box(1); + } else { + show_error_box(0); + } if (Fl::system_driver()->dot_file_hidden() && !showHiddenButton->value()) remove_hidden_files(); // Update the preview box... update_preview(); |
