diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/blocks.cxx | 2 | ||||
| -rw-r--r-- | test/preferences.fl | 34 | ||||
| -rw-r--r-- | test/sudoku.cxx | 2 |
3 files changed, 30 insertions, 8 deletions
diff --git a/test/blocks.cxx b/test/blocks.cxx index 2128d8a08..a08e6ed40 100644 --- a/test/blocks.cxx +++ b/test/blocks.cxx @@ -497,7 +497,7 @@ class BlockWindow : public Fl_Double_Window { }; -Fl_Preferences BlockWindow::prefs_(Fl_Preferences::USER, "fltk.org", "blocks"); +Fl_Preferences BlockWindow::prefs_(Fl_Preferences::USER_L, "fltk.org", "blocks"); int main(int argc, char *argv[]) { diff --git a/test/preferences.fl b/test/preferences.fl index e7d5b1756..ef2cc5d1a 100644 --- a/test/preferences.fl +++ b/test/preferences.fl @@ -45,7 +45,7 @@ Function {saveAndCloseWindowCB( Fl_Widget*, void* )} {open private return_type v Fl::delete_widget(myWindow);} {} } -Function {} {open return_type int +Function {} {open selected return_type int } { Fl_Window myWindow { label {My Preferences} @@ -78,7 +78,7 @@ Function {} {open return_type int xywh {0 0 100 20} } MenuItem {} { - label {p.m.} selected + label {p.m.} xywh {0 0 100 20} } } @@ -206,10 +206,32 @@ int intValue; char buffer[80]; double doubleValue; -Fl_Preferences app( Fl_Preferences::USER, project, application ); +char path[ FL_PATH_MAX ]; +Fl_Preferences::Root root = + Fl_Preferences::filename(path, FL_PATH_MAX, Fl_Preferences::USER_L, project, application); +if (root == Fl_Preferences::UNKNOWN_ROOT_TYPE) { + printf("Location of future Preferences file not found.\\n"); +} else { + printf("Preferences file will be located at:\\n%s\\n", path); +} + +Fl_Preferences app( Fl_Preferences::USER_L, project, application ); - char path[ FL_PATH_MAX ]; - app.getUserdataPath( path, sizeof(path) ); + root = app.filename(path, FL_PATH_MAX); + if (root == Fl_Preferences::UNKNOWN_ROOT_TYPE) { + printf("Location of app Preferences file not found.\\n"); + } else if (root == Fl_Preferences::MEMORY) { + printf("App Preferences are memory mapped.\\n"); + } else { + printf("App Preferences file is actually located at:\\n%s\\n", path); + } + + app.getUserdataPath( path, sizeof(path) ); + if (path[0]) { + printf("Preferences user data directory is located at:\\n%s\\n", path); + } else { + printf("Location of Preferences user data directory not found.\\n"); + } Fl_Preferences bed( app, "Bed" ); bed.get( "alarm", buffer, "8:00", 79 ); @@ -278,7 +300,7 @@ Fl_Preferences app( Fl_Preferences::USER, project, application ); Function {writePrefs()} {open return_type void } { - code {Fl_Preferences app( Fl_Preferences::USER, project, application ); + code {Fl_Preferences app( Fl_Preferences::USER_L, project, application ); Fl_Preferences bed( app, "Bed" ); diff --git a/test/sudoku.cxx b/test/sudoku.cxx index 28437fbd8..9884c117d 100644 --- a/test/sudoku.cxx +++ b/test/sudoku.cxx @@ -625,7 +625,7 @@ SudokuCell::handle(int event) { // Sudoku class globals... Fl_Help_Dialog *Sudoku::help_dialog_ = (Fl_Help_Dialog *)0; -Fl_Preferences Sudoku::prefs_(Fl_Preferences::USER, "fltk.org", "sudoku"); +Fl_Preferences Sudoku::prefs_(Fl_Preferences::USER_L, "fltk.org", "sudoku"); // Create a Sudoku game window... |
