From c016311bca0ebf4aca5b152384bc2505e9c402f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 29 Dec 2005 18:30:35 +0000 Subject: [PATCH] No longer annoys the user if there was no settings file (it asked to configure the settings in that case...). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15728 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../translators/jpeg/JPEGTranslator.cpp | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/add-ons/translators/jpeg/JPEGTranslator.cpp b/src/add-ons/translators/jpeg/JPEGTranslator.cpp index 25de28c8b8..36b96b195e 100644 --- a/src/add-ons/translators/jpeg/JPEGTranslator.cpp +++ b/src/add-ons/translators/jpeg/JPEGTranslator.cpp @@ -107,7 +107,7 @@ SaveSettings(jpeg_settings *settings) path.Append(SETTINGS_FILE); } else path.Append(SETTINGS_FILE); - + // Open settings file (create it if there's no file) and write settings FILE *file = NULL; if ((file = fopen( path.Path(), "wb+"))) { @@ -125,14 +125,15 @@ SettingsChangedAlert() // and user wants to run settings if (!gAreSettingsRunning && (new BAlert("Different settings file", - "JPEG settings were set to default because of incompatible settings file.", - "Configure settings", "OK", NULL, B_WIDTH_AS_USUAL, - B_WARNING_ALERT))->Go() == 0) { + "JPEG settings were set to default because of incompatible settings file.", + "Configure settings", "OK", NULL, B_WIDTH_AS_USUAL, + B_WARNING_ALERT))->Go() == 0) { // Create settings window (with no quit on close!), launch // it and wait until it's closed - status_t err; TranslatorWindow *window = new TranslatorWindow(false); window->Show(); + + status_t err; wait_for_thread(window->Thread(), &err); return true; } @@ -158,8 +159,8 @@ LoadSettings(jpeg_settings *settings) // Open settings file (create it if there's no file) and write settings FILE *file = NULL; - if ((file = fopen( path.Path(), "rb"))) { - if ( !fread(settings, sizeof(jpeg_settings), 1, file)) { + if ((file = fopen(path.Path(), "rb")) != NULL) { + if (!fread(settings, sizeof(jpeg_settings), 1, file)) { // settings struct has changed size // Load default settings, and Save them fclose(file); @@ -171,14 +172,10 @@ LoadSettings(jpeg_settings *settings) LoadSettings(settings); } else fclose(file); - } else if ((file = fopen( path.Path(), "wb+"))) { + } else if ((file = fopen(path.Path(), "wb+")) != NULL) { LoadDefaultSettings(settings); fwrite(settings, sizeof(jpeg_settings), 1, file); fclose(file); - // Tell user settings were changed to default, and ask to run settings panel or not - if (SettingsChangedAlert()) - // User configured settings, load them again - LoadSettings(settings); } }